Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week 9 - Wednesday.  What did we talk about last time?  Fresnel reflection  Snell's Law  Microgeometry effects  Implementing BRDFs  Image based.

Similar presentations


Presentation on theme: "Week 9 - Wednesday.  What did we talk about last time?  Fresnel reflection  Snell's Law  Microgeometry effects  Implementing BRDFs  Image based."— Presentation transcript:

1 Week 9 - Wednesday

2  What did we talk about last time?  Fresnel reflection  Snell's Law  Microgeometry effects  Implementing BRDFs  Image based rendering

3

4

5

6  So far, we have only been talking about lighting as coming from a particular source  Lighting like that happens mostly in space  On earth, area lighting has a huge impact  Sky light from the sun's light scattering through the atmosphere  Indoor lighting is usually indirect (because a bare bulb hurts the eyes)

7  Area lights are complex  The book describes the 3D integration over a hemisphere of angles needed to properly quantify radiance  No lights in reality are point lights  All lights have an area that has some effect

8  The simplest model of indirect light is ambient light  This is light that has a constant value  It doesn't change with direction  It doesn't change with distance  Without modeling occlusion (which usually ends up looking like shadows) ambient lighting can look very bad  We can add ambient lighting to our existing BRDF formulation with a constant term:

9

10

11  A more complicated tool for area lighting is environment mapping (EM)  The key assumption of EM is that only direction matters  Light sources must be far away  The object does not reflect itself  In EM, we make a 2D table of the incoming radiance based on direction  Because the table is 2D, we can store it in an image

12  The radiance reflected by a mirror is based on the reflected view vector r = 2(nv)n – v  The reflectance equation is: where RF is the Fresnel reflectance and L i is the incoming radiance from vector r

13  Steps: 1. Generate or load a 2D image representing the environment 2. For each pixel that contains a reflective object, compute the normal at the corresponding location on the surface 3. Compute the reflected view vector from the view vector and the normal 4. Use the reflected view vector to compute an index into the environment map 5. Use the texel for incoming radiance

14  It doesn't work well with flat surfaces  The direction doesn't vary much, mapping a lot of the surface to a narrow part of the environment map  Normal mapping combined with EM helps a lot  The range of values in an environment map may be large (to cover many light intensities)  As a consequence, the space requirements may be higher than normal textures

15  Blinn and Newell used a longitude/latitude system with a projection like Mercator   is longitude and goes from 0 to 2π   is latitude and goes from 0 to π  We can compute these from the normalized reflected view vector:   = arccos(-r z )   = atan2(r y, r x )  Problems  There are too many texels near the poles  The seam of the left and the right halves cannot easily be interpolated across

16  Imagine the environment is viewed through a perfectly reflective sphere  The resulting sphere map (also called a light probe) is what you'd see if you photographed such a sphere (like a Christmas ornament)  The sphere map has a basis giving its own coordinate system (h,u,f)  The image was generated by looking along the f axis, with h to the right and u up (all normalized)

17  To use the sphere map, convert the surface normal n and the view vector v to the sphere space by multiplying by the following matrix:  Sphere mapping only shows the environment on the front of the sphere  It is view dependent

18  Cubic environmental mapping is the most popular current method  Fast  Flexible  Take a camera, render a scene facing in all six directions  Generate six textures  For each point on the surface of the object you're rendering, map to the appropriate texel in the cube

19  Pros  Fast, supported by hardware  View independent  Shader Model 4.0 can generate a cube map in a single pass with the geometry shader  Cons  It has better sampling uniformity than sphere maps, but not perfect (isocubes improve this)  Still requires high dynamic range textures (lots of memory)  Still only works for distant objects

20  We have talked about using environment mapping for mirror-like surfaces  The same idea can be applied to glossy (but not perfect) reflections  By blurring the environment map texture, the surface will appear rougher  For surfaces with varying roughness, we can simply access different mipmap levels on the cube map texture

21  Environment mapping can be used for diffuse colors as well  Such maps are called irradiance environment maps  Because the viewing angle is not important for diffuse colors, only the surface normal is used to decide what part of the irradiance map is used

22

23

24  Global illumination basics

25  Keep reading Chapter 8  Start reading Chapter 9


Download ppt "Week 9 - Wednesday.  What did we talk about last time?  Fresnel reflection  Snell's Law  Microgeometry effects  Implementing BRDFs  Image based."

Similar presentations


Ads by Google