Illumination Model Wireframe rendering simple, ambiguous Color filling flat without any 3D information Requires modeling interaction of light with the object/surface to have a different color (shade) in 3D
Illumination Model The reflected light is scattered depending upon the surface properties and incident light Ambient light comes from all directions, is scattered in all directions Diffuse light comes from one direction and is scattered in all directions Specular light comes from one direction and is scattered in preferred direction
Illumination Model Phong Illumination Model I ambient reflection diffeuse reflection specular reflection = + + total n k I k I cos θ k I cos α = + + a a d l s l n k I k I ( L N ) k I ( R V ) = + • + • a a d l s l m n k I k I ( L N ) k I ( R V ) = + ∑ • + • a a d i i s i i i 1 =
Illumination Model Phong Illumination Model Local computation for obtaining color (intensity) at a point of the surface Basic inputs are light(s), material properties
Polygon Shading Shading Process of applying illumination model to surface points Polygon (approximates the 3D shape/surface) Approaches • Flat Shading • Gouraud Shading • Phong Shading
Polygon Shading Flat Shading One intensity for the whole polygon constant shading For each face/polygon ► Select a point P on the face ► Find normal to the face n p P ► Find intensity I at P n p ► Fill the polygon with I Not smooth
Polygon Shading Flat Shading Example
Polygon Shading Flat Shading • Computationally fast • Not smooth • Mach Band effect
Polygon Shading Gouraud Shading Smooth shading • Compute intensity at vertices of a polygon ð Needs vertex normal • Fill the interior with shade (intensity) using interpolation
Polygon Shading Gouraud Shading Vertex Normal N 4 Normal at the vertex is average of N 2 normals of the faces incident at N v the vertex N 3 n P i N = ∑ v N 1 n i 1 = i
Polygon Shading Gouraud Shading Vertex Normal
Polygon Shading Gouraud Shading Interpolation (x 1 , y 1 ) I 1 Scan line I a I s I b I 4 (x 4 , y 4 ) Scan conversion! (x 2 , y 2 ) I 2 (x 3 , y 3 ) I 3
Polygon Shading Gouraud Shading Interpolation (x 1 , y 1 ) I 1 1 (x a , y s ) (x s , y s ) (x b , y s ) I [ I ( y y ) I ( y y )] = − + − a 1 s 2 2 1 s y y − Scan line I a I s I b I 4 1 2 1 I [ I ( y y ) I ( y y )] (x 4 , y 4 ) = − + − b 1 s 4 4 1 s y y (x 2 , y 2 ) − 1 4 1 I 2 I [ I ( x x ) I ( x x )] = − + − s a b s b s a x x − b a (x 3 , y 3 ) I 3
Polygon Shading Gouraud Shading Example
Polygon Shading Gouraud Shading Handling Specular Reflections- Highlights Not Right
Polygon Shading Phong Shading Interpolate normals and then compute intensity Not to confuse with Phong Illumination Model
Polygon Shading Phong Shading (x 1 , y 1 ) N 1 Illumination using N s Scan line N s I s N a N s N b N 4 (x 4 , y 4 ) (x 2 , y 2 ) N 2 (x 3 , y 3 ) N 3
Polygon Shading Phong Shading • More accurate specular component • Reduced Mach band effect • Better shape approximation N 1 N 2 Original surface Computationally more intensive
Polygon Shading Phong Shading Example
Polygon Shading Phong Shading Example
Polygon Shading Problems Interpolated shading Polygon Silhouette
Polygon Shading Problems Interpolated shading Interpolation Inaccuracy (screen space vs world space) Linear Interpolation Perspective Interpolation
Polygon Shading Problems Interpolated shading Animation V 1 V 2 Rotate P P V 3 V 1 V 4 V 2 V 4 V 3
Polygon Shading Problems Interpolated shading Vertex Normal Vertex Normals Face Normals
Polygon Shading Graphics Pipeline Order Illumination computation is done early after modeling transformation Shading is done towards the end with rasterization (scan conversion)
Polygon Shading Transparency Simple Model Non refractive I kI ( − 1 k ) I = + reflected transmitte d k is the opacity factor (coefficient)
Recommend
More recommend