Week 9 - Wednesday. What did we talk about last time? Fresnel reflection Snell's Law ...

25
CS361 Week 9 - Wednesday

Transcript of Week 9 - Wednesday. What did we talk about last time? Fresnel reflection Snell's Law ...

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

CS361Week 9 - Wednesday

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

Last time

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

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

Questions?

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

Project 3

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

Area Lighting

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

Area lighting

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)

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

Area light sources

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

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

Ambient light

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:

kiL

n

kkAo EfLL θcos),()(

1amb

vlcv

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

Student Lecture: Environment Mapping

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

Environment Mapping

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

Environment mapping

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

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

Mirror reflection

The radiance reflected by a mirror is based on the reflected view vector r = 2(n•v)n – v

The reflectance equation is:

where RF is the Fresnel reflectance and Li is the incoming radiance from vector r

)()()( rv ioFo LθRL

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

EM algorithm

Steps:1. Generate or load a 2D image representing the environment2. For each pixel that contains a reflective object, compute the normal at

the corresponding location on the surface3. Compute the reflected view vector from the view vector and the normal4. Use the reflected view vector to compute an index into the environment

map5. Use the texel for incoming radiance

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

Problems with EM

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

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

Blinn and Newell's method 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(-rz)

= atan2(ry, rx) Problems

There are too many texels near the poles The seam of the left and the right halves cannot easily be interpolated

across

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

Sphere mapping

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)

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

Sphere mapping continued 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

1000

0

0

0

zyx

zyx

zyx

fff

uuu

hhh

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

Cubic environmental mapping 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

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

Pros and cons of cubic mapping 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

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

Glossy reflections

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

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

Irradiance environment mapping 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

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

Quiz

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

Upcoming

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

Next time…

Global illumination basics

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

Reminders

Keep reading Chapter 8 Start reading Chapter 9