Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest...

20
Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi http://www.cs.columbia.edu/~cs4160 Guest Lecturer: Aner Benartzi

Transcript of Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest...

Page 1: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Computer Graphics (Spring 2003)

COMS 4160, Lecture 18: Shading 2

Ravi Ramamoorthihttp://www.cs.columbia.edu/~cs4160

Guest Lecturer:Aner Benartzi

Page 2: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Building up the BRDF• Bi-Directional Reflectance Distribution Function

• Function based on viewing direction.

• Tells us how bright a surface is.

• Why should a surface be bright?– Incoming Hemisphere– Incoming Intensity

• Relates incoming light energy to outgoing light energy.

Page 3: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Function of Viewing “direction”• A direction in 3-D, in relation to a point on

a surface, can be given with 2 angles– ,– same as the angles in spherical coordinates– r is not needed for direction only

Page 4: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Solid Angels• Not enough to view an object from a single line of sight.

– infinitesimally small viewing area leads to 0 incoming energy.

– need a range of directions.

• In 2D the span of directions is an angle.

• In 3D the equivalent value is a solid angle

Page 5: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Differential Solid Angles

Page 6: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

BRDF as a Ratio• Just a ratio of the incoming light to the

outgoing light.– 4D function.

( )( , )

( ) cos

r ri r

i i i i

Lf

L d

Page 7: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

The Reflection Equation

Page 8: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Brdf Viewer plots

Diffuse

bv written by Szymon Rusinkiewicz

Torrance-Sparrow

Anisotropic

Page 9: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Incoming vs. Outgoing Energy• Desirable properties of BRDF:

– Ratio between Zero and One.– Linear– Reciprocity (Hemholtz reciprocity)

Page 10: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Properties of BRDF’s

Page 11: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Emperical BRDF• Sample many incoming and outgoing

directions.

• Store the results in a 4D data structure

i

i

oo

Page 12: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Analytical BRDF: TS example• One famous analytically derived BRDF is

the Torrance-Sparrow model.

• T-S is used to model specular surface, like the Phong model.– more accurate than Phong– has more parameters that can be set to match

different materials– derived based on assumptions of underlying

geometry. (instead of ‘because it works well’)

Page 13: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Torrance-Sparrow• Assume the surface is made up grooves at the

microscopic level.

• Assume the faces of these grooves (called microfacets) are perfect reflectors.

• Take into account 3 phenomena

Shadowing Masking Interreflection

Page 14: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Torrance-Sparrow Result

( ) ( , ) ( )

4cos( )cos( )

i i r h

i r

F G Df

Fresnel term:allows for wavelength

dependency(ignore for now)

Geometric Attenuation:reduces the output based on the

amount of shadowing or masking that occurs.

Distribution:distribution function

determines what percentage of

microfacets are oriented to reflect in the viewer direction.

How much of the macroscopic surface is visible to the light

source

How much of the macroscopic

surface is visible to the viewer

Page 15: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Other BRDFs• Toon Shaders

– view independent– discrete in lighting dependance

• Anisotropic– some BRDFs depend on the orientation of the

surface.– Hair, Brushed Steel

Page 16: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Anisotropic vs. Isotropic• The 4D BRDF we’ve seen so far can handle

anisotropic surfaces.

• Most surfaces are isotropic– Appear the same when rotated about the normal– The overall orientation in the phi direction

doesn’t matter– only need to worry about the difference

between – BRDF becomes a 3D function:

Page 17: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Complex Lighting• So far we’ve looked at simple, discrete light

sources.

• Real environments contribute many colors of light from many directions.

• The complex lighting of a scene can be captured in an Environment map.– Just paint the environment on a sphere.

Page 18: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Environment Maps• Instead of determining the lighting direction by

knowing what lights exist...• Determine what light exists by knowing the

lighting direction.

Blinn and Newell 1976, Miller and Hoffman, 1984Later, Greene 86, Cabral et al. 87

Page 19: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Limitations• Carefully constructed BRDFs can create very

realistic scenes. A good BRDF alone still has limitations:– The silhouettes of objects are still polygonal.– The resolution of surface normals is only as fine as

the number of polygons.• Can use bump maps

– Nothing takes into account objects shadowing themselves.

• Can use shadow maps

Page 20: Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi cs4160 Guest Lecturer: Aner Benartzi.

Limitations (cont)• More limitations of modeling appearance

only with a BRDF:– Any reflections or transparency can’t include

other scene objects.• requires ray-tracing

– Sometimes light leaves a different point from the one it entered (subsurface scattering).

– Some objects contribute significantly to the lighting in the scene.

• requires global illumination