Lighting Lights Also in Unity Emissive Materials Elements

  • Slides: 34
Download presentation
Lighting

Lighting

Lights

Lights

Also in Unity: Emissive Materials

Also in Unity: Emissive Materials

Elements of Illumination at a point N – The surface normal L – Vector

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

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

Types of Light Ø Ambient Ø Diffuse Ø Specular Ø Emissive

Ambient Illumination Small amount of light that is assumed to hit all surfaces. Simulates

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

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 Ө L N

Diffuse Reflection Ø Diffuse reflection - light reflected in all directions equally (or close

Diffuse Reflection Ø Diffuse reflection - light reflected in all directions equally (or close to equally) l 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

Specular Reflection Ø Specular reflection - If the light hits the surface and is reflected off mostly in a reflection direction, we have specular reflection. l l 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

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

Diffuse and Specular colors Ø Typically the colors reflected for diffuse and specular reflection are different l Diffuse – Generally the surface appearance l 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 (60 W bulb vs 100 W

Light Source Intensity Ø Intensity of light source (60 W bulb vs 100 W 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

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

Emissive Light

Emissive Light

Shade Maps Ø Way to shade textures or polygons non- uniformly Ø Calculate a

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

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

Precomputed Real-time Lighting

Precomputed Real-time Lighting

Forward Mapping n Forward mapping is what we are used to.

Forward Mapping n Forward mapping is what we are used to.

Forward Mapping Take each primitive n Figure out where on the screen it should

Forward Mapping Take each primitive n Figure out where on the screen it should appear n Also known is feed-forward n

Ray Tracing Ø Ray tracing is the “inverse” of the “forward” mapping we are

Ray Tracing Ø Ray tracing is the “inverse” of the “forward” mapping we are used to.

Ray Tracing Ø Also known as inverse mapping or feedbackward

Ray Tracing Ø Also known as inverse mapping or feedbackward

Ray-Tracing Attempts to trace the paths of light that contribute to each pixel that

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: Ø l l Ø Reflection Refraction Atmospheric effects Shadows Results in very realistic scenes l Used in movies, animations, cutscenes

Ray Tracing Ø Ø Cast ray from camera through the view port into the

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.

Ray Tracing

Ray Tracing

Reflective Material Ø If material is reflective, cast a ray in angle of reflection.

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

Refractive Material Ø If material is not opaque, cast a refraction ray(s) through the material Ø Recursively find the color at the refracted object