Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... ·...

51
Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics and Media Lab. Seoul National University 2011 Fall 3D Rendering by David Keegan

Transcript of Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... ·...

Page 1: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Chapter 8.

The Rendering Equation

Graphics Programming, 29th Sep.

Graphics and Media Lab.

Seoul National University 2011 Fall

3D Rendering by David Keegan

Page 2: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Goal of This Chapter

• Understand the basic radiometry

• Understand BRDF and reflection models

• Understand the rendering equation

Page 3: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Solid Angle

• A quantity that measures the relative coverage of a hemisphere.

– Unit: sr – steradian

• The whole hemisphere is 2π sr.

Page 4: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

(Radiant) Flux F

• Time rate of the flow of radiant energy Q

– Amount of energy arriving at a surface during 1 sec.

– Unit: Watt

Page 5: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Irradiance E

• Flux arriving at a surface location x

– Unit: W/m2

– Positional distribution of flux

surface

Page 6: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

(Radiant) Intensity I

• Radiant flux per unit solid angle

– Unit: W/sr

– Directional distribution of flux

Page 7: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Radiance L

• Radiant intensity per unit projected area

– Unit: W/m2sr

– Flux density per unit projected area per unit solid angle

surface

Page 8: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Radiance L

• Radiant intensity per unit projected area

– Unit: W/m2sr

– Irradiance in terms of radiance:

dxLxE cos),()(

Page 9: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Radiance L

• Radiant intensity per unit projected area

– Unit: W/m2sr

– Flux in terms of radiance:

Page 10: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Light Emission Example

• Assume a point light source with power

• What is the irradiance E at a surface?

• What is the radiance L at a surface?

Page 11: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Light Scattering

3D Rendering by Kevin Beason

Page 12: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Light Scattering

3D Rendering by Kevin Beason

Page 13: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Light Scattering

3D Rendering by Kevin Beason

Page 14: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Light Scattering

• Materials interact with light in different ways.

• Different materials have different appearances given the same lighting conditions.

• The reflectance properties of a surface are described by a reflectance function, which models the interaction of light reflecting at a surface.

• The bi-directional reflectance distribution function (BRDF) is the most general expression of reflectance of a material

Page 15: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

The BRDF

• The BRDF is defined as the ratio between differential radiance reflected in an exitant direction, and incident irradiance through a differential solid angle

Page 16: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

• The BRDF is defined as the ratio between differential radiance reflected in an exitant direction, and incident irradiance through a differential solid angle

The BRDF

incoming

outgoing

Page 17: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Why BRDF is Complicated? • How about

• Differential irradiance dE(p,w’) – dEi(x,w’) Li(x,w’)cosi dw’ – Why do we put d in front of E?

• dLr(x,w) differential exitance radiance due to dEi(x,w’) • dLr(x,w) dEi(x,w’)

– Why? – The relationship is called the “linearity assumption”.

• fr(x,w,w’) fr(x,w’,w) – Reciprocity: the value of the BRDF will remain unchanged if the

incident and exitant directions are interchanged.

ww

w

w

www

dpL

xdL

xdE

xdLxf

ii

r

i

rr

cos),(

),(

),(

),(),,(

),(

),(),,(

w

www

xL

xLxf

i

rr

Page 18: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

The Scattering Equation

wwwww

wwwww

dxLpf

dxLpfxL

ir

iirr

)(n ),(),,(

cos ),(),,(),(

• Calculation of the exitant radiance from x toward w, by summing contributions made by all the incident radiances.

Page 19: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Reflectance r

• Why dF instead of F?

• BRDF vs. Reflectance – Both are about a surface point x.

– Reflectance: General (or average) tendency of reflection

– BRDF: Bi-directional reflection distribution

Page 20: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Object Color and Reflectance

• How do we see the color? – The surface absorbs photons of certain range of l

– Is it general or direction specific behavior of the surface?

• Object color is represented with the reflectance! – For red, use the vector reflectance r(1,0,0).

– For yellow, use r(0.5,0.5,0).

– …

Page 21: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Diffuse Reflection

• A diffuse surface reflects light in all directions

– A special case of diffuse reflection is Lambertian: the reflection is uniform over the whole hemisphere.

Rendered using Mitsuba

Page 22: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Lambertian

• For a Lambertian surface, the reflected radiance is constant in all directions regardless of the irradiance.

• This gives a constant BRDF:

)(

)(

)(

),()(,

xE

xL

xE

xLxf

i

r

i

rdr

w

Constant wrt w

Page 23: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Specular Reflection

• Specular reflection happens when light strikes a smooth surface – e.g. Metal, glass, and water

Page 24: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Specular Reflection

• Specular reflection happens when light strikes a smooth surface – e.g. Metal, glass, and water

• The reflected radiance due to specular reflection is:

and the reflection direction is:

Page 25: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Relationship Between Reflectance and Index of Refraction

• From left-to-right, only the index of refraction is varied. – We can observe the reflectance is related with the IOR.

– Why such thing happens?

Image from Maya 2009 Mental Ray Document

Page 26: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

The Fresnel Equations

• For smooth homogeneous metals and dielectrics, specular reflectance is given by the following formulae for polarized lights:

Page 27: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Specular Reflectance for Unpolarized Light

• For unpolarized light the specular reflectance becomes:

• The amount of refracted ray is computed as:

)(2

1)( 22

|| rrr rs F

Page 28: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

More General Reflection Models

• Phong

• Microfacet models

– Torrance-Sparrow

– Oren-Nayar

• Lafortune

• BSSDF

Page 29: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

What’s Next?

• Now, we know how to describe light.

• We also know how it gets reflected.

• From now on, let’s talk about how light travels around!

Page 30: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

The Rendering Equation

• Introduced by David Immel et al. and James Kajiya in 1986.

• The rendering equation describes the total amount of light coming from a point x along a particular viewing direction. – Based on the law of conservation of energy.

Image from Wikipedia

Page 31: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

The Rendering Equation

• In short, the outgoing radiance Lo is the sum of the emitted radiance Le and the reflected radiance Lr:

• Using BRDF, we can rewrite about eq. as:

• How can we solve the above eq?

– Difficult!

Page 32: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Understanding the Situation

E

D

S

L

D

E: Eye, D: Diffuse, S: Specular

Page 33: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Light -> Eye

E

D

S

L

D

E: Eye, D: Diffuse, S: Specular

Page 34: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics
Page 35: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Light -> Diffuse -> Eye

E

D

S

L

D

E: Eye, D: Diffuse, S: Specular

Page 36: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics
Page 37: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Light -> Specular -> Eye

E

D

S

L

D

E: Eye, D: Diffuse, S: Specular

Page 38: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics
Page 39: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Light -> Specular -> Specular -> Diffuse -> Eye

E

D

S

L

D

E: Eye, D: Diffuse, S: Specular

Page 40: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics
Page 41: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Light -> Specular -> Specular -> Diffuse -> Diffuse -> Specular -> Diffuse -> Specular -> … -> Eye

E

D

S

L

D

E: Eye, D: Diffuse, S: Specular

Page 42: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Computing Rendering Equation

• You might have felt that solving the rendering eq won’t be a trivial job.

– How can we evaluate this integral numerically?

• Let’s rewrite the eq in more readable (and computable) form.

1. Neumann series expansion

2. Light transport notation

Page 43: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Neumann Series Expansion

• The rendering eq can be represented using the following compact form:

where the integral operator T is:

Page 44: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Neumann Series Expansion

• Then, recursive evaluation of L=Le+TL gives:

E

D

S

L

D

Page 45: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Light Transport Notation

• We can also represent light traversals in general form. – L: a light source

– E: the eye

– S: a specular reflection/refraction

– D: a diffuse reflection

• Using regular expression: – (k)+: one or more of k events

– (k)*: zero or more of k events

– (k)?: zero or one k events

– (k|k’): a k or a k’ events

Page 46: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

LE

E

D

S

L

D

Page 47: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

LSE

E

D

S

L

D

Page 48: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

LSSDE

E

D

S

L

D

Page 49: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

L(S|D)+DE

E

D

S

L

D

Page 50: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

Ray Tracing Models

• Appel’s Method (1968) – E(D|G)L – aka. Ray casting – Only computes local illuminations

• Whitted’s Method (1980) – ES*(D|G)L – aka. (Recursive) ray tracing – Only computes local illuminations

• Kajiya’s Method (1986) – E[(D|G|S)+(D|G)]L – aka. Path tracing – Fully computes local and global illuminations

* G is glossy reflection

Page 51: Chapter 8. The Rendering Equationgraphics.snu.ac.kr/class/graphics2011/materials/ch08... · 2016-10-14 · Chapter 8. The Rendering Equation Graphics Programming, 29th Sep. Graphics

How to Solve the Rendering Equation

• Trace all possible paths, and integrates every contribution

– Called the “path tracing”

– Extremely expensive.

• The next two lectures will teach how to integrate the equation numerically.

– Monte-Carlo integration

E

D

S

L

D