1 / 22

Lighting

Lighting. CS 4363/6353. What is Light?. A very complex process How is your face being lit right now? Light bounces (mirrors, shiny objects ) Light refracts through other media (water, heat) Light comes from everywhere (Global Illumination)

leena
Download Presentation

Lighting

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lighting CS 4363/6353

  2. What is Light? • A very complex process • How is your face being lit right now? • Light bounces (mirrors, shiny objects) • Light refracts through other media (water, heat) • Light comes from everywhere (Global Illumination) • Light mixes with other light and the materials it hits • Light bounces off of lakes in weird ways (Fresnel effect) • THUS • We’re forced to make approximations • Tradeoff between time and realism • “If it looks good, it is good” – Michael Abrash http://en.wikipedia.org/wiki/File:Global_illumination.JPG http://darrentakenaga.com/3d.html

  3. Basic Lighting • We can break light down into four components: • Diffuse – the way light “falls off” of an object • Specular – the “shininess” of the object • Ambient – a minimum amount of light used to simulate “global illumination” • Emit – a “glowing” effect

  4. Interaction between Material and Lights • The final color of an object is comprised of many things: • The base color (called a “material”) • The light color • Any textures we apply (later) • The material has four individual components, and so do the lights! • Diffuse color (cdand ld) • Specular color (csand ls) • Ambient color (caand la) • Emit color (ceand le) • Example: what if you shine a red light on a white ball? What color will it be?

  5. General Lighting • Comprised of several vectors • l – the incoming light vector • n – the normal of the plane/vertex • r – the reflection vector • v – the viewpoint (camera) v n l r θ θ

  6. LambertianReFlectance(diffuse Component) • Light falling on an object is the same regardless of the observer’s viewpoint • Good for rough surfaces without specular highlights • where and are normalized n l θ http://en.wikipedia.org/wiki/Lambertian

  7. LambertianReFlectance(diffuse Component) • Technically, it should be: n l θ http://en.wikipedia.org/wiki/Lambertian

  8. BLINN-PHONG Reflection(Specular Component) • Describes the specular highlight and is dependent on viewpoint v • Also describes a “half-vector” h that is halfway between v and l h v n r l θ θ

  9. BLINN-PHONG Reflection(Specular Component) • - which is really Blinn’s contribution to the original Phong model h v n r l θ θ

  10. BLINN-PHONG Reflection(Specular Component) • Our final specular equation is: h v n r l θ θ

  11. Determining • is the “shininess” factor • It relates to the size of the specular hightlight • Realize that will always be < 1.0, so raising it to a power will make it smaller

  12. Ambient and Emit Components • Ambient: • Used to simulate light bouncing around the environment (global illumination) • Real world is far too complex for real time • Emit: • Used to make the object “glow” • Does not emit light!!! • Both: • Independent of viewpoint • Super easy to calculate

  13. Final Color • To determine the final color (excluding textures) we sum up all components: http://en.wikipedia.org/wiki/Phong_reflection_model

  14. What about Multiple lights? • Sum them all together • Assuming there are count number of lights

  15. Common Kinds of Lights • Point light • Directional Light • Spot Light • Area Light • Interesting fact: • Lights cannot be seen! • Only their effects • We can light per vertex (fast) or per fragment (slower)

  16. Point Lights • These lights have a position in 3D space • Sometimes called a “Lamp” • Light emanates from the light in all directions • Distance d determines brightness (“attenuation”):

  17. Directional Lights • Are infinitely far away- • position in NO WAY matters • Have only direction • Sometimes called “Suns” • All objects are lit evenly

  18. Spotlights • Point light source • Conical in shape

  19. Spotlights • Point light source • Conical in shape • Have: • An inner and outer cone angle • Umbra – areas that are fully in shadow • Penumbra – areas that are in partial shadow • Note: There’s an ambient light

  20. Area Lights • A “surface” lights objects • Has a position and direction • Provides for a smoother drop off than point • Larger surface == smoother shadows • Expensive to calculate

  21. Common Methods of Shading • Flat shading: • light is calculated once per polygon • Very fast • Phong (“fung”) shading: • Light is calculated once per fragment • More expensive, but looks better! http://en.wikipedia.org/wiki/File:Phong-shading-sample.jpg

  22. Gouraud Shading(pronounced “ger-oh”) • In between flat and phong shading • Process • Lights each vertex (similar to Project 1) • Interpolates between those vertices (along the edges) • Fast, but bad for specular highlight for low-poly objects http://en.wikipedia.org/wiki/Gouraud_shading

More Related