Elements of Illumination at a point N – The surface normal L – Vector to the light V – Vector to the eye R – Reflection direction
Reflection Amount of light reflected to the eye Objects the same “color” may reflect light very differently This consists of several components…
Types of Light • Ambient • Diffuse • Specular • Emissive
Ambient Illumination Small amount of light that is assumed to hit all surfaces. Simulates the idea of light bouncing around the room. Used as sunlight, or “general light” Technically, if only ambient light existed, everything would be black and white.
Diffuse Reflection • Light diffuses over space • Lambert’s law: The smaller the angle of reflection, the more intense the reflected light is. • i = N·L Ө N L
Diffuse Reflection • Diffuse reflection - light reflected in all directions equally (or close to equally) • Most objects have a component of diffuse reflection (other than pure specular reflection objects like mirrors) Diffuse reflection is what makes the blue ball blue!
Specular Reflection • Specular reflection - If the light hits the surface and is reflected off mostly in a reflection direction, we have specular reflection. • A perfect specular object (no diffusion at all) is a mirror. • Most objects have some specular characteristics Specular reflection makes bright highlights on objects.
Specular Illumination Diffuse Only Materials are assumed to have two colors: a diffuse color and a specular color. Specular Contribution
Diffuse and Specular colors • Typically the colors reflected for diffuse and specular reflection are different • Diffuse – Generally the surface appearance • Specular – The color of bright highlights, often more white then the surface color Diffuse illumination is view independent. Specular illumination is view dependent.
Light Source Intensity • Intensity of light source (60W bulb vs 100W bulb) • This is a multiplicative factor for the diffused light. • i = a + l(N·L)
Distance Falloff • Light gets less intense with distance • Falloff distance: distance at which light is no longer visible (f) • Changes the light intensity factor (l) • l’ = l(f-d)/(f+d) • i = a+l’(N·L) d f
Shade Maps • Way to shade textures or polygons non-uniformly • Calculate a shade map: Rectangle that covers the polygon. • Calculate blocks of shading • Draw shade on top of texture
Tricks • Depth cueing: Further surfaces = fog or some other effect besides just getting dark • Fake shadows: Draw a dark circle under an object so it doesn’t look like it’s floating • MIP Mapping: Keep small versions of polygons for far-away objects
Forward Mapping • Forward mapping is what we are used to.
Forward Mapping • Take each primitive • Figure out where on the screen it should appear • Also known is feed-forward
Ray Tracing • Ray tracing is the “inverse” of the “forward” mapping we are used to.
Ray Tracing • Also known as inverse mapping or feed-backward
Ray-Tracing • Attempts to trace the paths of light that contribute to each pixel that make up a scene • Instead of computing visible surfaces, determine intensity contributions • Compute global illumination • Allows for: • Reflection • Refraction • Atmospheric effects • Shadows • Results in very realistic scenes • Used in movies, animations, cut-scenes
Ray Tracing • Cast ray from camera through the view port into the scene. • From point on object, cast “shadow ray” to the light • If hits light, angle gives intensity for color. • If hits object, draw a shadow.
Reflective Material • If material is reflective, cast a ray in angle of reflection. • Recursively find the color at the reflected object
Refractive Material • If material is not opaque, cast a refraction ray(s) through the material • Recursively find the color at the refracted object