110 likes | 258 Views
Lighting and Illumination. Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling
E N D
Lighting and Illumination • Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling • Consider local illumination (only light sources are used, not reflections from other objects), isotropic (not anisotropic where reflected light changes with rotation of object) • No model can do it all
Lighting: Components • Objects can emit light (eg. light bulbs, glowing objects, spot lights) • Light can be diffused from an object • Light can be reflected off one object to another • Light can be absorbed (partially or fully) by an object
Light Rays: Which Direction? • We think of “seeing” as if the direction is from our eyes to a position on the screen (or in the world) • But rays of light come from sources and objects to our eyes • Light sources emit light, which then can enter our eyes directly or first interact with an object through specular or diffuse reflection – or interact with several objects before hitting our eyes
Lighting: Realism • In order to accurately represent the effects of lighting we would need to trace rays from all light sources, let them interact with objects before entering our eyes, and calculate the result using laws of physics • Recursion could be overwhelming- calculations become impossible • Some simplifying assumptions must be made • But the more of these calculations that take place the more realistic the rendering; difference between real-time and realism
Lighting: Reflectance • Objects have different capabilities to reflect light: bidirectional reflectance distribution function gives the amount of reflected radiance in a given direction for a given incoming direction (BRDF) • Think of a mirror, a shiny table top, a glossy picture, a matte picture, a black shirt • Most computer graphics models reduce this function to two properties of the material: specular and diffuse
Lighting: Reflectance (con’t) • A material’s diffuse reflectance goes in all directions; dependent on position of light source; same for the entire object • The specular reflectance (mirror-like) goes in one direction and the angle of incidence is equal to the angle of reflectance (with the normal) • We look at combinations of these two from a light source
Light: summary • Objects can emit light, reflect light or absorb light • In a simplified version, reflected light can be thought of as a combination of diffuse and specular • Objects can also be transparent, partially transparent or opaque • Also have ambient light, indirect illumination
Lights: Processing (put in draw not setup) • ambientLight comes from all directions and in Processing takes a color. • directionalLight has a color and a direction. The rays are parallel (think of sunlight) and strike the objects; the result is strongest when the normals to the surfaces are parallel to the direction • pointLight emanates from a particular location and shines in all directions (think of a lightbulb); the function takes a color and a location. • spotLighthas a color, a location, a direction, and angle and a concentration (think of the theater) • The lights() function sets up a default ambient light of color 128 and a directional light of color 128 pointing in 0,0,-1
Shading • Flat shading: calculate illumination once for each patch or triangle • Gouraud shading: calculate for each vertex and then use interpolation for each edge and interpolation for each interior point • Phong uses interpolated normals