Top Banner
, = (, ) , + , , ′′ , ′′ ′′ INFOMAGR – Advanced Graphics Jacco Bikker - November 2016 - February 2017 Lecture 6 - “Light Transport” Welcome!
48

Lecture 6 -“Light Transport”

Jan 10, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lecture 6 -“Light Transport”

𝑰 𝒙, 𝒙′ = 𝒈(𝒙, 𝒙′) 𝝐 𝒙, 𝒙′ + 𝑺

𝝆 𝒙, 𝒙′, 𝒙′′ 𝑰 𝒙′, 𝒙′′ 𝒅𝒙′′

INFOMAGR – Advanced GraphicsJacco Bikker - November 2016 - February 2017

Lecture 6 - “Light Transport”

Welcome!

Page 2: Lecture 6 -“Light Transport”

Today’s Agenda:

Introduction

The Rendering Equation

Light Transport

Page 3: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 3

Whitted

Page 4: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 4

Whitted

Page 5: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 5

Whitted

Missing:

Area lights Glossy reflections Caustics Diffuse interreflections

Diffraction Polarization Phosphorescence Temporal effects

Motion blur Depth of field Anti-aliasing

Page 6: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 6

Anti-aliasing

Adding anti-aliasing to a Whitted-style ray tracer:

Send multiple primary rays through each pixel, and average their result.

Problem:

How do we aim those rays? What if all rays return the same color?

Page 7: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 7

Anti-aliasing – Sampling Patterns

Adding anti-aliasing to a Whitted-style ray tracer:

Send multiple primary rays through each pixel, and average their result.

Problem:

How do we aim those rays? What if all rays return the same color?

Page 8: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 8

Anti-aliasing – Sampling Patterns

Page 9: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 9

Anti-aliasing – Sampling Patterns

Page 10: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 10

Anti-aliasing – Sampling Patterns

Adding anti-aliasing to a Whitted-style ray tracer:

Send multiple primary rays through each pixel, and average their result.

Problem:

How do we aim those rays? What if all rays return the same color?

Page 11: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 11

Whitted

Missing:

Area lights Glossy reflections Caustics Diffuse interreflections

Diffraction Polarization Phosphorescence Temporal effects

Motion blur Depth of field Anti-aliasing

Page 12: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 12

Distribution Ray Tracing*

*: Distributed Ray Tracing, Cook et al., 1984

Soft shadows

Page 13: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 13

Distribution Ray Tracing*

*: Distributed Ray Tracing, Cook et al., 1984

Glossy reflections

Page 14: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 14

Distribution Ray Tracing*

*: Distributed Ray Tracing, Cook et al., 1984

?

Page 15: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 15

Distribution Ray Tracing*

*: Distributed Ray Tracing, Cook et al., 1984

Page 16: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 16

Distribution Ray Tracing

Whitted-style ray tracing is a point sampling algorithm:

We may miss small features We cannot sample areas

Area sampling:

Anti-aliasing: one pixel Soft shadows: one area light source Glossy reflection: directions in a cone Diffuse reflection: directions on the hemisphere

Page 17: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 17

Area Lights

Visibility of an area light source:

𝑉𝐴 = 𝐴

𝑉 𝑥,ꙍ𝑖 𝑑ꙍ𝑖

Analytical solution case 1:

𝑉𝐴 = 𝐴𝑙𝑖𝑔ℎ𝑡 − 𝐴𝑙𝑖𝑔ℎ𝑡⋂𝑠𝑝ℎ𝑒𝑟𝑒

Analytical solution case 2:

𝑉𝐴 = ?

Page 18: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 18

Approximating Integrals

An integral can be approximated as a Riemann sum:

𝑉𝐴 = 𝐴

𝐵

𝑓(𝑥) 𝑑𝑥 ≈

𝑖=1

𝑁

𝑓 𝑡𝑖 𝛥𝑖 , where

𝑖=1

𝑁

𝛥𝑖 = 𝐵 − 𝐴

Note that the intervals do not need to be uniform, as long as we sample the full interval. If the intervals are uniform, then

𝑖=1

𝑁

𝑓 𝑡𝑖 𝛥𝑖 = 𝛥𝑖

𝑖=1

𝑁

𝑓 𝑡𝑖 =𝐵 − 𝐴

𝑁

𝑖=1

𝑁

𝑓 𝑡𝑖 .

Regardless of uniformity, restrictions apply to 𝑁 when sampling multi-dimensional functions (ideally, 𝑁 = 𝑀𝑑). Also note that aliasing may occur if the intervals are uniform.

Image from Wikipedia

Page 19: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 19

Monte Carlo Integration

Alternatively, we can approximate an integral by taking random samples:

𝑉𝐴 = 𝐴

𝐵

𝑓(𝑥) 𝑑𝑥 ≈𝐵 − 𝐴

𝑁

𝑖=1

𝑁

𝑓 x𝑖

Here, x1. . x𝑁 ∈ [𝐴, 𝐵].As 𝑁 approaches infinity, 𝑉𝐴 approaches the expected value of 𝑓.

Unlike in Riemann sums, we can use arbitrary 𝑁 for Monte Carlo integration, regardless of dimension.

Image from Wikipedia

Page 20: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 20

Monte Carlo Integration of Area Light Visibility

To estimate the visibility of an area light source, we take 𝑁random point samples.

In this case, 5 out of 6 samples are unoccluded:

𝑉 ≈1

61 + 1 + 1 + 0 + 1 + 1 =

5

6

In terms of Monte Carlo integration:

𝑉 = 𝒮2𝑉(𝑝) 𝑑𝑝 ≈

1

𝑁

𝑖=1

𝑁

𝑉 𝑝

With a small number of samples, the variance in the estimate shows up as noise in the image.

Page 21: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 21

Monte Carlo Integration of Area Light Visibility

We can also use Monte Carlo to estimate the contribution of multiple lights:

1. Take the average of N samples from each light source;2. Sum the averages.

𝐸 𝑥 ← =

𝑖=1

2

𝐿𝑖 𝑉(𝑥 ↔ 𝑙𝑖)

𝑥

Page 22: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 22

Monte Carlo Integration of Area Light Visibility

Alternatively, we can just take 𝑁 samples, and pick a random light source for each sample.

𝐸 𝑥 ← =2

𝑁

𝑖=1

𝑁

𝐿 𝑞 𝑉 𝑞 𝑝 , 𝑞 ∈ {1,2}

=1

𝑁

𝑖=1

𝑁𝐿 𝑞 𝑉 𝑞 𝑝

0.5

𝑥

Page 23: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 23

Monte Carlo Integration of Area Light Visibility

We obtain a better estimate with fewer samples if we do not treat each light equally.

In the previous example, each light had a 50% probability of being sampled. We can use an arbitrary probability, by dividing the sample by this probability.

𝐸 𝑥 ← =1

𝑁

𝑖=1

𝑁𝐿 𝑞 𝑉 𝑞 𝑝

𝜌 𝑞, 𝜌 𝑞 = 1, 𝜌 𝑞 > 0

𝑥

Page 24: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 24

Distribution Ray Tracing

Key concept of distribution ray tracing:

We estimate integrals using Monte Carlo integration.

Integrals in rendering:

Area of a pixel Lens area (aperture) Frame time Light source area Cones for glossy reflections Wavelengths …

Page 25: Lecture 6 -“Light Transport”

Introduction

Advanced Graphics – Light Transport 25

Open Issues

Remaining issues:

Energy distribution in the ray tree / efficiency Diffuse interreflections

Page 26: Lecture 6 -“Light Transport”

Today’s Agenda:

Introduction

The Rendering Equation

Light Transport

Page 27: Lecture 6 -“Light Transport”

Rendering Equation

Advanced Graphics – Light Transport 27

Whitted, Cook & Beyond

Missing in Whitted:

Area lights Glossy reflections Caustics Diffuse interreflections

Diffraction Polarization Phosphorescence Temporal effects

Motion blur Depth of field Anti-aliasing

Cook:

Area lights Glossy reflections× Caustics× Diffuse interreflections

× Diffraction× Polarization× Phosphorescence× Temporal effects

Motion blur Depth of field Anti-aliasing

Page 28: Lecture 6 -“Light Transport”

Rendering Equation

Advanced Graphics – Light Transport 28

Whitted, Cook & Beyond

Cook’s solution to rendering:

Sample the many-dimensional integral using Monte Carlo integration.

𝐴𝑝𝑖𝑥𝑒𝑙

𝐴𝑙𝑒𝑛𝑠

𝑇𝑓𝑟𝑎𝑚𝑒

𝛺𝑔𝑙𝑜𝑠𝑠𝑦

𝐴𝑙𝑖𝑔ℎ𝑡

Ray optics are still used for specular reflections and refractions:The ray tree is not eliminated.

(In fact: for each light, one or more shadow rays are produced)

Page 29: Lecture 6 -“Light Transport”

Rendering Equation

Advanced Graphics – Light Transport 29

God’s Algorithm

1 room1 bulb100 watts1020 photons per second

Photon behavior:

Travel in straight lines Get absorbed, or change direction:

Bounce (random / deterministic) Get transmitted

Leave into the void Get detected

Page 30: Lecture 6 -“Light Transport”

Light Transport

Advanced Graphics – Light Transport 30

Page 31: Lecture 6 -“Light Transport”

Rendering Equation

Advanced Graphics – Light Transport 31

God’s Algorithm - Mathematically

A photon may arrive at a sensor after travelling in a straight line from a light source to the sensor:

𝐿 𝑠 ← 𝑥 = 𝐿𝐸(𝑠 ← 𝑥)

Or, it may be reflected by a surface towards the sensor:

𝐿 𝑠 ← 𝑥 = 𝐴

𝑓𝑟 𝑠 ← 𝑥 ← 𝑥′ 𝐿 𝑥 ← 𝑥′ 𝐺 𝑥 ↔ 𝑥′ 𝑑𝐴(𝑥′)

Those are the options.Adding direct and indirect illumination together:

𝐿 𝑠 ← 𝑥 = 𝐿𝐸 𝑠 ← 𝑥 + 𝐴

𝑓𝑟 𝑠 ← 𝑥 ← 𝑥′ 𝐿 𝑥 ← 𝑥′ 𝐺 𝑥 ↔ 𝑥′ 𝑑𝐴(𝑥′)

Page 32: Lecture 6 -“Light Transport”

𝐿 𝑠 ← 𝑥 = 𝐿𝐸 𝑠 ← 𝑥 + 𝐴

𝑓𝑟 𝑠 ← 𝑥 ← 𝑥′ 𝐿 𝑥 ← 𝑥′ 𝐺 𝑥 ↔ 𝑥′ 𝑑𝐴(𝑥′)

Rendering Equation

Advanced Graphics – Light Transport 32

God’s Algorithm - Mathematically

Emission

Hemisphere

Reflection

Indirect

Geometry factor

Page 33: Lecture 6 -“Light Transport”

Rendering Equation

Advanced Graphics – Light Transport 33

𝐿 𝑠 ← 𝑥 = 𝐿𝐸 𝑠 ← 𝑥 + 𝐴

𝑓𝑟 𝑠 ← 𝑥 ← 𝑥′ 𝐿 𝑥 ← 𝑥′ 𝐺 𝑥 ↔ 𝑥′ 𝑑𝐴(𝑥′)

The Rendering Equation:*

Light transport from lights to sensor Physically based

The equation allows us to determine to which extendrendering algorithms approximate real-world lighttransport.

*: The Rendering Equation, Kajiya, 1986

Page 34: Lecture 6 -“Light Transport”

Rendering Equation

Advanced Graphics – Light Transport 34

to the Rendering Equation:

Light sourc𝐿 𝑠 ← 𝑥 = 𝐿𝐸 𝑠 ← 𝑥 + 𝐴 𝑓𝑟 𝑠 ← 𝑥 ← 𝑥′ 𝐿 𝑥 ← 𝑥′ 𝐺 𝑥 ↔ 𝑥′ 𝑑𝐴(𝑥′)

Rasterization, according es limited to 𝑁 point lights Visibility handled by z-buffer / Painter’s algorithm Visibility not supported for lights

𝐿 𝑠 ← 𝑥 = 𝐿𝐸 𝑠 ← 𝑥 +

𝑖=1

𝑁𝐿

𝑓𝑟 𝑠 ← 𝑥 ← 𝐿𝑖 𝐿𝑖 𝐺 𝑥 ↔ 𝐿𝑖

(note: this does not take into account approximations such as shadow maps and environment maps)

Page 35: Lecture 6 -“Light Transport”

Rendering Equation

Advanced Graphics – Light Transport 35

𝐿 𝑠 ← 𝑥 = 𝐿𝐸 𝑠 ← 𝑥 + 𝐴

𝑓𝑟 𝑠 ← 𝑥 ← 𝑥′ 𝐿 𝑥 ← 𝑥′ 𝐺 𝑥 ↔ 𝑥′ 𝑑𝐴(𝑥′)

Whitted-style ray tracing, according to the Rendering Equation:

Inter-surface reflections limited to specular surfaces Light sources limited to 𝑁 point lights Visibility is supported

𝐿 𝑠 ← 𝑥 = 𝐿𝐸 𝑠 ← 𝑥 +

𝑖=1

𝑁𝐿

𝑓𝑟 𝑠 ← 𝑥 ← 𝐿𝑖 𝐿𝑖 𝐺 𝑥 ↔ 𝐿𝑖

+ 𝐴

𝑓𝑟𝛿 𝑠 ← 𝑥 ← 𝑥′ 𝐿 𝑥 ← 𝑥′ 𝐺 𝑥 ↔ 𝑥′ 𝑑𝐴(𝑥′)

(note: only specular recursive transport supported)

Page 36: Lecture 6 -“Light Transport”

Today’s Agenda:

Introduction

The Rendering Equation

Light Transport

Page 37: Lecture 6 -“Light Transport”

Light Transport

Advanced Graphics – Light Transport 37

𝐿 𝑠 ← 𝑥 = 𝐿𝐸 𝑠 ← 𝑥 + 𝐴

𝑓𝑟 𝑠 ← 𝑥 ← 𝑥′ 𝐿 𝑥 ← 𝑥′ 𝐺 𝑥 ↔ 𝑥′ 𝑑𝐴(𝑥′)

Relation between real-world light transport and the RE:

1. Each sensor element registers an amount of photons arriving from the first surface visible though that pixel.

2. This surface may be emissive, in which case it produced the sensed photons.3. This surface may also reflect photons, arriving from other surfaces in the scene.4. For the other surfaces: goto 2.

Page 38: Lecture 6 -“Light Transport”

Light Transport

Advanced Graphics – Light Transport 38

Light Transport Quantities

Radiant flux - 𝛷 :

“Radiant energy emitted, reflected, transmitted or received, per unit time.”

Units: watts = joules per second𝑊 = 𝐽 𝑠−1 .

Simplified particle analogy: number of photons.

Note: photon energy depends on electromagnetic wavelength:

E =hc

λ, where h is Planck’s constant, c is the speed of light,

and λ is wavelength. At λ = 550nm (yellow), a single photon carries 3.6 ∗ 10−19 joules.

Page 39: Lecture 6 -“Light Transport”

Light Transport

Advanced Graphics – Light Transport 39

Light Transport Quantities

In a vacuum, radiant flux emitted by a point light source remains constant over distance:

A point light emitting 100W delivers 100W to the surface of a sphere of radius r around the light. This sphere has an area of 𝜋𝑟2; energy per surface area thus decreases by 1/𝑟2.

In terms of photons: the density of the photon distribution decreases by 1/𝑟2.

Page 40: Lecture 6 -“Light Transport”

Light Transport

Advanced Graphics – Light Transport 40

Light Transport Quantities

A surface receives an amount of light energy proportional to its solid angle: the two-dimensional space that an object subtends at a point.

Solid angle units: steradians (sr).

Corresponding concept in 2D: radians; the length of the arc on the unit sphere subtended by an angle.

Page 41: Lecture 6 -“Light Transport”

Light Transport

Advanced Graphics – Light Transport 41

Light Transport Quantities

Radiance - 𝐿 :

“The power of electromagnetic radiation emitted, reflected, transmitted or received per unit projected area per unit solid angle.”

Units: 𝑊𝑠𝑟−1𝑚−2

Simplified particle analogy: Amount of particles passing through a pipe with unit diameter, per unit time.

Note: radiance is a continuous value:while flux at a point is 0 (since both area and solid angle are 0), we can still define flux per area per solid angle for that point.

𝐿

Page 42: Lecture 6 -“Light Transport”

Light Transport

Advanced Graphics – Light Transport 42

Light Transport Quantities

Irradiance - 𝐸 :

“The power of electromagnetic radiation per unit area incident on a surface.”

Units: Watts per 𝑚2 = joules per second per 𝑚2

𝑊𝑚−2 = 𝐽𝑚−2𝑠−1 .

Simplified particle analogy: number of photons arriving per unit area per unit time, from all directions.

𝑁

Page 43: Lecture 6 -“Light Transport”

Light Transport

Advanced Graphics – Light Transport 43

Light Transport Quantities

Converting radiance to irradiance:

𝐸 = 𝐿 cos 𝜃

𝐿

𝐿 𝑁

𝜃

Page 44: Lecture 6 -“Light Transport”

Light Transport

Advanced Graphics – Light Transport 44

Pinhole Camera

A camera should not accept light from all directions for a particular pixel on the film. A pinhole ensures that only a single direction is sampled.

In the real world, an aperture with a lens is used to limit directions to a small range, but only on the focal plane.

Page 45: Lecture 6 -“Light Transport”

Light Transport

Advanced Graphics – Light Transport 45

Light Transport

𝐿 𝑠 ← 𝑥 = 𝐿𝐸 𝑠 ← 𝑥 + 𝐴

𝑓𝑟 𝑠 ← 𝑥 ← 𝑥′ 𝐿 𝑥 ← 𝑥′ 𝐺 𝑥 ↔ 𝑥′ 𝑑𝐴(𝑥′)

𝐿𝑜 𝑥, 𝜔𝑜 = 𝐿𝐸 𝑥, 𝜔𝑜 + 𝛺

𝑓𝑟 𝑥, 𝜔𝑜, 𝜔𝑖 𝐿𝑖 𝑥, 𝜔𝑖 cos 𝜃𝑖 𝑑𝜔𝑖

Radiance Radiance Radiance

Irradiance

BRDF

Page 46: Lecture 6 -“Light Transport”

Light Transport

Advanced Graphics – Light Transport 50

Flux / Particle Count / Probability

So far, we measured light transport as energy:

Radiance = Joules per second per square meter;Irradiance = Radiance projected to the surface.

Alternatively, we can imagine this as a large number of particles (say, 1020). How does this affect the concept of radiance, irradiance and BRDF?

Alternatively, we can think of irradiance and the BRDF as a probability distribution. How does this affect the concept of irradiance and the BRDF?

Page 47: Lecture 6 -“Light Transport”

Today’s Agenda:

Introduction

The Rendering Equation

Light Transport

Page 48: Lecture 6 -“Light Transport”

INFOMAGR – Advanced GraphicsJacco Bikker - November 2016 - February 2017

END of “Light Transport”next lecture: “Path Tracing”