0% found this document useful (0 votes)
3 views

Lecture 40-Pre-Read

The document discusses basic illumination models in computer graphics, focusing on how light interacts with surfaces to determine their color and brightness. It outlines the factors affecting lighting, including the light source, surface properties, and observer position, and differentiates between global and local illumination models. Key concepts such as ambient light, diffuse light, Lambert's law, and specular light are also explained, along with examples and OpenGL material settings.

Uploaded by

gokulranjan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Lecture 40-Pre-Read

The document discusses basic illumination models in computer graphics, focusing on how light interacts with surfaces to determine their color and brightness. It outlines the factors affecting lighting, including the light source, surface properties, and observer position, and differentiates between global and local illumination models. Key concepts such as ambient light, diffuse light, Lambert's law, and specular light are also explained, along with examples and OpenGL material settings.

Uploaded by

gokulranjan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

R1UC408B - Computer Graphics

B.TECH (CSE) - IV Sem

Pre Read learning material

Lecture 40

Basic Illumination Models

Dr. Gokul Rajan V, Associate Professor, SCSE


Illumination Models

 Illumination model, also known as Shading model or Lighting model,


 to calculate the intensity of light that is reflected at a given point on
surface.
 Three factors on which lighting effect depends on:
 Light Source : Light source is the light emitting source. There are three types of
light sources: Their position, electromagnetic spectrum and shape determine the
lighting effect.
o Point Sources – The source that emit rays in all directions (A bulb in a room).
o Parallel Sources – Can be considered as a point source which is far from the surface (The sun).
o Distributed Sources – Rays originate from a finite area (A tube light).

 Surface : When light falls on a surface part of it is reflected and part of it is


absorbed. Now the surface structure decides the amount of reflection and
absorption of light. The position of the surface and positions of all the nearby
surfaces also determine the lighting effect.
Dr. Gokul Rajan V, Associate Professor, SCSE
 Observer : The observer’s position and sensor spectrum sensitivities also affect the
Illumination (Lighting) Model

• To model the interaction of light with surfaces to


determine the final color & brightness of the surface
• Global illumination
• Local illumination
Global Illumination Vs Local illumination

• Global Illumination models: take • Only consider the light, the observer
into account the interaction of light position, and the object material
from all the surfaces in the scene. properties
Basic Illumination Model

• Simple and fast method for calculating surface intensity at a


given point
• Lighting calculation are based on:
• The background lighting conditions
• The light source specification: color, position
Ambient light (background light)

• The light that is the result from the light reflecting off other surfaces in the
environment
• A general level of brightness for a scene that is independent of the light
positions or surface directions -> ambient light
• Has no direction
• Each light source has an ambient light contribution, Ia
• For a given surface, we can specify how much ambient light the surface
can reflect using an ambient reflection coefficient : Ka (0 < Ka < 1)
Ambient Light

• So the amount of light that the surface reflect is therefore


Iamb = Ka * Ia
Diffuse Light

• The illumination that a surface receives from a light source and


reflects equally in all directions
• This type of reflection is called Lambertian Reflection (thus,
Lambertian surfaces)
• The brightness of the surface is indepenent of the observer
position (since the light is reflected in all direction equally)
Lambert’s Law

• How much light the surface receives from a light source


depends on the angle between its angle and the vector
from the surface point to the light (light vector)
• Lambert’s law: the radiant energy ’Id’ from a small surface
da for a given light source is:
Id = IL * cos(q)
IL : the intensity of the light source
q is the angle between the surface
normal (N) and light vector (L)
The Diffuse Component

• Surface’s material property: assuming that the surface can reflect Kd


(0<Kd<1), diffuse reflection coefficient) amount of diffuse light:
Idiff = Kd * IL * cos(q)
If N and L are normalized, cos(q) = N*L
Idiff = Kd * IL * (N*L)
• The total diffuse reflection = ambient + diffuse
Idiff = Ka * Ia + Kd * IL * (N*L)
Examples

Sphere diffusely lighted from various angles !


Specular Light
 These are the bright spots on objects (such as polished
metal, apple ...)
 Light reflected from the surface unequally to all directions.
 The result of near total reflection of the incident light in a
concentrated region around the specular reflection angle
OpenGL Materials
GLfloat white8[] = {.8, .8, .8, 1.}, white2 = {.2,.2,.2,1.},black={0.,0.,0.};
GLfloat mat_shininess[] = {50.}; /* Phong exponent */

glMaterialfv( GL_FRONT_AND_BACK,
GL_AMBIENT, black);

glMaterialfv( GL_FRONT_AND_BACK,
GL_DIFFUSE, white8);

glMaterialfv( GL_FRONT_AND_BACK,
GL_SPECULAR, white2);

glMaterialfv( GL_FRONT_AND_BACK,
GL_SHININESS, mat_shininess);
OpenGL Lighting
GLfloat white[] = {1., 1., 1., 1.};
GLfloat light0_position[] = {1., 1., 5., 0.}; /* directional light (w=0) */

glLightfv(GL_LIGHT0, GL_POSITION, light0_position);


glLightfv(GL_LIGHT0, GL_DIFFUSE, white);
glLightfv(GL_LIGHT0, GL_SPECULAR, white);
glEnable(GL_LIGHT0);

glEnable(GL_NORMALIZE); /* normalize normal vectors */


glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);/* two-sided lighting*/

glEnable(GL_LIGHTING);

You might also like