9
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

Lighting and Illumination Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling Consider

Embed Size (px)

Citation preview

Page 1: Lighting and Illumination Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling Consider

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

Page 2: Lighting and Illumination Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling Consider

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

Page 3: Lighting and Illumination Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling Consider

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

Page 4: Lighting and Illumination Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling Consider

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

Page 5: Lighting and Illumination Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling Consider

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

Page 6: Lighting and Illumination Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling Consider

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

Page 7: Lighting and Illumination Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling Consider

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

Page 8: Lighting and Illumination Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling Consider

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.

• spotLight has 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

Page 9: Lighting and Illumination Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling Consider

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