Shading I 1
Objectives Learn to shade objects ==> images appear threedimensional Introduce types of light-material interactions Build simple reflection model Phong model Can be used with real time graphics hardware 2
Why we need shading Suppose build model of sphere using many polygons and color it with glcolor ==> get something like But want 3
Shading Why image of real sphere look like Light-material interactions ==> each point different color or shade Need to consider Light sources Material properties Location of viewer Surface orientation 4
Scattering Light strikes A Some scattered Some absorbed Some of scattered light strikes B Some scattered Some absorbed Some of this scattered light strikes A and so on 5
Rendering Equation Infinite scattering and absorption of light can be described by the rendering equation Cannot be solved in general Ray tracing = special case for perfectly reflecting surfaces Rendering equation: global and includes Shadows Multiple scattering from object to object 6
Global Effects shadow translucent surface multiple reflection 7
Local vs Global Rendering Correct shading requires global calculation involving all objects and light sources Incompatible with pipeline model shade each polygon independently local rendering In CG, especially real time CG, happy if things look right Many techniques for approximating global effects 8
Light-Material Interaction Light strikes object ==> partially absorbed and partially scattered (reflected) Amount reflected determines color and brightness of object Surface appears red under white light because red component of light reflected rest absorbed Reflected light scatter depends on surface smoothness orientation 9
Light Sources General light sources difficult must integrate light from all points on source 10
Simple Light Sources Point source Model with position and color Distant source = infinite distance away (parallel) Spotlight Restrict light from ideal point source Ambient light Same amount of light everywhere in scene Can model contribution of many sources and reflecting surfaces 11
Surface Types Smoother surface ==> more reflected light in direction of perfect mirror reflection Very rough surface scatters light in all directions smooth surface rough surface 12
Phong Model Simple model, can be computed rapidly Has three components Diffuse Specular Ambient Uses four vectors l: To source v: To viewer n: Normal r: Perfect reflector 13
Ideal Reflector Normal determined by local orientation Angle of incidence = angle of reflection Three vectors must be coplanar r = 2 (l n ) n - l 14
Lambertian Surface Perfectly diffuse reflector Light scattered equally in all directions Amount of light reflected proportional to vertical component of incoming light reflected light ~cos θ i - cos θ i = l n if vectors normalized Also three coefficients, k r, k b, k g how much of each color component reflected 15
Specular Surfaces Most surfaces neither ideal diffusers nor perfectly specular (ideal reflectors) Smooth surfaces show specular highlights due to incoming light reflected in directions concentrated close to direction of perfect reflection specular highlight 16
Modeling Specular Relections Phong proposed using term that dropped off as angle between viewer and ideal reflection increased I r ~ k s I cos α φ reflected shininess coef intensity incoming intensity absorption coef φ 17
The Shininess Coefficient Values of α between 100 and 200 correspond to metals Values between 5 and 10 give surface that look like plastic cos α φ -90 φ 90 18