Illumination and Shading How to shade a surface

  • Slides: 20
Download presentation

Illumination and Shading • How to shade a surface – Position (Light/Surface) – Orientation

Illumination and Shading • How to shade a surface – Position (Light/Surface) – Orientation (Light/Surface) – Characteristics (Light/Surface) Light in Reflection (diffuse) • Local Illumination Models Reflection Specular Internal Reflection – Individual point and – The light source/s Illuminate it • Global Illumination Models – The light source and – The interchange of light between all the surfaces emission Transmitted Light

Ambient Light • Non reflective • Self-luminous • Illumination equation I=ki • I is

Ambient Light • Non reflective • Self-luminous • Illumination equation I=ki • I is the resulting intensity • Ki is the object’s intrinsic intensity • An ambient illumination variable is associated with each point • Evaluating the ambient equation <==> Lighting the object.

Diffuse Reflection • Point light source • The brightness depends on the angle q

Diffuse Reflection • Point light source • The brightness depends on the angle q between direction to the light L and the surface normal N • If the light bean q I = Ip kd cos(q) – Has cross sectional deferential are d. A – It intercepts an area d. A/cos(q) of the surface. N q N d. A S 1 d. A/cos(q ) S 2

Combining Shading Models Series of pictures of sphere illuminated by diffuse reflection model only

Combining Shading Models Series of pictures of sphere illuminated by diffuse reflection model only using different Kd values (0. 4, 0. 55, 0. 7, 0. 85, 1. 0). Series of pictures of sphere illuminated by ambient and diffuse reflection model. Ia = Ib = 1. 0, Kd = 0. 4 and Ka = {0. 0, 0. 15, 0. 30, 0. 45, 0. 60}

Light Source Attenuation

Light Source Attenuation

Specular Reflection Phone Illumination Developed by Phong Bui-Toung for nonperfect reflection. The model assumes

Specular Reflection Phone Illumination Developed by Phong Bui-Toung for nonperfect reflection. The model assumes that the maximum specular reflection occurs when is zero and falls off sharply as increases. The rapid falloff is approximated by cos n( ). I = Ia K a + fatt Id [Kd. Od cos( ) +W( )cos n( )] Od : Object diffuse factor. W( ): Factor of specular reflection light L N R V

Specular Reflection

Specular Reflection

Shading Models for Polygons Shading We can shade a surface by calculating the surface

Shading Models for Polygons Shading We can shade a surface by calculating the surface normal at each visible point and applying the desired model at that point. Constant Flat Shading Applies an illumination model one to determine a singles intensity value that is then used to shade the entire polygon. Interpolated Shading information is linearly interpolated across triangle from illumination values determined at it vertices

Polygon Mesh Shading Gouraud Shading extends the concept of interpolated shading applied to individual

Polygon Mesh Shading Gouraud Shading extends the concept of interpolated shading applied to individual polygons by interpolating polygon vertex illumination values that take into account the surface being approximated. A vertex intensity is computed by using the vertex normal with any desired shading model. Phong Shading interpolates the surface normal vector, rather than the intensity. Interpolation occurs across a polygon span on a scan line.

Interpolated Shading Problems • • • Polygonal Silhouette Perspective distortion Orientation dependence Problem at

Interpolated Shading Problems • • • Polygonal Silhouette Perspective distortion Orientation dependence Problem at shared vertices Inaccurate vertex normal

Light & Material in Open. GL GLfloat GLfloat lit_mbient[] = {0. 2, 1. 0};

Light & Material in Open. GL GLfloat GLfloat lit_mbient[] = {0. 2, 1. 0}; lit_diffuse[] = {1. 0, 1. 0}; lit_specular[] = {1. 0, 1. 0}; lit_position[] = {-2. 0, 1. 0, 3. 0, 1. 0}; lit_spot_dir[] = {-1. 0, -1. 0}; lit_shine[] = {50. 0}; gl. Shade. Model(GL_SMOOTH); gl. Enable(GL_LIGTING); gl. Enable(GL_LIGHT 0); gl. Lightfv(GL_LIGHT 0, GL_POSITION, lit_ position); gl. Lightfv(GL_LIGHT 0, GL_AMBIENT, lit_ ambient); gl. Lightfv(GL_LIGHT 0, GL_DIFFUSE, lit_diffuse); gl. Lightfv(GL_LIGHT 0, GL_SPECULAR, lit_specular); gl. Lightfv(GL_LIGHT 0, GL_SHININESS, lit_shine);

Material

Material