210 likes | 219 Views
This chapter explores the interaction between light and surfaces, the rendering equation, and various approximation and reflection models in computer graphics. Topics include ray tracing, radiosity, specular and diffuse surfaces, light sources, and the Phong reflection model.
E N D
CAP 4703Computer Graphic Methods Prof. Roy Levow Chapter 6
Light and Matter • Surface may • emit light • reflect light • Rendering equation • Recusrively applying the effect from a source to the viewer yields the • Equation cannot be solved in general • Approximate approaches can be computationally intensive
Approximations • Ray tracing • trace light from source to eye • most rays don’t reach the eye • Radiosity • Treat surfaces as small regions each emitting fixed light • Calculate emission independent of viewer • Simplified ray tracing • Single interaction between light source and each surface
Interaction with Surfaces • Specular surface • Similar to mirror • Light leaves atsame angle as entry
Interaction with Surfaces (cont) • Diffuse Surface • Light leaves inall directions
Translucent Surface some light penetrates surface leaves at modified angle – refraction some reflected Interaction with Surfaces (cont)
Six variable illumination function I(x,y,x,theta, phi, lambda) Generally too complex to compute for all points Light Sources
Light Sources • Consider four simpler light sources • Ambient lighting • Omnidirectional; constant everywhere • Point source • Radiates in all directions • Spot lights • Small cone of constant light • Distant light • rays are parallel
Color Sources • Describe color with 3-dimensional RGB vector • (Ir, Ig, Ib)T
Characteristics of Light Sources • Ambient light • every point in scene receives same light in every direction • Point source • Intensity decreases with inverse square of distance • Often approximate with form (a + bd +cd2)-1where d is distance to soften effect
Characteristics of Light Sources • Spot light • Light limited to cone of angle • diminishes toward edges of cone as cose(theta) for some value of e • intensity as for point source • Distant source • constant intensity • fixed direction
Described by 4 vectors n – normal to p v – to viewer l – to source r – reflected ray Phong Reflection Model
Phong Reflection Model • Supports • ambient • diffuse • specular or combination of these • Uses 3 x 3 matrix • columns for r – g – b • rows for ambient, diffuse, specular • Color source and reflection matrices
Phong Reflection Model • resulting intensity is sum or products of corresponding terms Iir = RiraLira+RirdLird+RirsLirs = Iira+Iird+Iirs for red, etc • Sum over all points for complete effect
Ambient Reflection • Ra = ka, 0 <= ka <= 1 • a fraction of light is reflected • one coefficient for each color
Diffuse reflection • Lambertian surfaces • reflect only vertical component • Rd proportional to cos(theta) • Id = kd (l . n) Ld/ (a + bd +cd2)
Specular Reflection • Phong model equation Is = ks Ls (R . v)a ks is shininess coefficient
OpenGL Shading • Polygonal shading • Generate shading on individual polygons • Flat shading glShadeModel(GL_FLAT); • select one vertex of polygon for normal • same color throughout polygon • tends to produce artificial looking surfaces with distinctly colored regions • eye is very sensitive to change • Mach Bands
Interpolative and Gourand Shading • GL_SMOOTH • average normals • example: plates 4 & 5