02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate...

13
02941 Physically Based Rendering Path Tracing Jeppe Revall Frisvad June 2020

Transcript of 02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate...

Page 1: 02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate rays from the camera through pixel positions. 2. Trace the rays and evaluate the

02941 Physically Based RenderingPath Tracing

Jeppe Revall Frisvad

June 2020

Page 2: 02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate rays from the camera through pixel positions. 2. Trace the rays and evaluate the

Heckbert’s Light Transport Notation

I Path tracing includes all light paths: L(S |D)∗E .References:

- Heckbert, P. S. Adaptive radiosity textures for bidirectional ray tracing. Computer Graphics (Proceedings of ACM SIGGRAPH 90) 24(4),pp. 145–154, August 1990.

Page 3: 02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate rays from the camera through pixel positions. 2. Trace the rays and evaluate the

Progressive unidirectional path tracing

1. Generate rays from the camera through pixel positions.

2. Trace the rays and evaluate the rendering equation for each ray.

3. Randomize the position within the pixel area to Monte Carlo integrate(measure) the radiance arriving in a pixel.

p0

p1

p2

p3

http://www.pbr-book.org/

I Noise is reduced by progressive updatesof the measurement.

I Update the rendering result in a pixel Lj afterrendering a new frame with result Lnew using

Lj+1 =Lnew + jLj

j + 1.

I Progressive (stop and go) rendering is convenient for several reasons:I No need to start over.I Result can be stored and refined later if need be.I Convergence can be inspected during progressive updates.

Page 4: 02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate rays from the camera through pixel positions. 2. Trace the rays and evaluate the

Monte Carlo integration

I The rendering equation:

Lo(x , ~ω) = Le(x , ~ω) +

∫2π

fr (x , ~ω′, ~ω)Li (x , ~ω′) cos θ dω′ .

I The Monte Carlo estimator:

LN(x , ~ω) = Le(x , ~ω) +1

N

N∑j=1

fr (x , ~ω′j , ~ω)Li (x , ~ω′

j) cos θ

pdf(~ω′j)

with cos θ = ~ω′j · ~n, where ~n is the surface normal at x .

Page 5: 02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate rays from the camera through pixel positions. 2. Trace the rays and evaluate the

Splitting the evaluation

I Distinguishing between:I Direct illumination Ldirect.

I Light reaching a surface directly from the source.

I Indirect illumination Lindirect.I Light reaching a surface after at least one bounce.

I The rendering equation is then

L = Le + Ldirect + Lindirect .

I Le is emission.I Ldirect is sampling of lights.I Lindirect is sampling of the BRDF excluding lights.

Page 6: 02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate rays from the camera through pixel positions. 2. Trace the rays and evaluate the

Path tracing diffuse objectsI The diffuse BRDF: fr = ρd/π .

I Computing direct illumination:I Sample positions uniformly on light sources.I Estimator for Ldirect is

Ldirect,N =ρd(x)

π

1

N

N∑j=1

Le(x`,j ,−~ω′j )V (x , x`,j)

~n`,j · (−~ω′j )

‖x`,j − x‖2A` (~ω′

j · ~n ) .

I Computing indirect illumination:I Set Le = 0 .I Sample directions using cosine-weighted hemisphere: pdf(~ω′

j ) = cos θ/π .I Estimator for Lindirect is

Lindirect,N = ρd(x)1

N

N∑j=1

V (~ω′j )Li (x , ~ω

′j ) .

Page 7: 02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate rays from the camera through pixel positions. 2. Trace the rays and evaluate the

Example

I 100 samples per pixel.

I Time: c. 3 minutes and 39seconds.

Page 8: 02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate rays from the camera through pixel positions. 2. Trace the rays and evaluate the

Example

I 100 samples per pixel.

I Split into 5 samples at firstdiffuse surface.

I Time: c. 8 minutes and 41seconds.

Page 9: 02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate rays from the camera through pixel positions. 2. Trace the rays and evaluate the

Example

I 100 samples per pixel.

I Split into 5 samples at firstdiffuse surface.

I Russian roulette for remainingbounces.

I Time: c. 43 minutes.

Page 10: 02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate rays from the camera through pixel positions. 2. Trace the rays and evaluate the

Splitting vs. Russian roulette for diffuse objectsI Splitting is very expensive. Russian roulette is very noisy.

I A compromise: Final gathering.

I Final gathering: Trace from the eye. Split at the first diffuse surface encountered. Russianroulette afterwards.

I Russian roulette: Either diffuse reflection or absorption.

I What is the probability? The simplest idea is the average:

probability of diffuse reflection =ρd,R + ρd,G + ρd,B

3.

I Could we importance sample this probability? Do some colours have more importance thanothers?

I The eye is more sensitive to some colours compared to others.

I This is estimated by luminance (photometric radiance).

I The luminance of an RGB colour is a weighted average of R, G, and B. The weights depend onthe RGB colour space used.

I Luminance according to the NTSC (1953) colour space:

Y = 0.2989R + 0.5866G + 0.1145B .

Page 11: 02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate rays from the camera through pixel positions. 2. Trace the rays and evaluate the

Path tracing specular objects

I See slides on Reflection and Transmission.

Page 12: 02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate rays from the camera through pixel positions. 2. Trace the rays and evaluate the

Example

I 288 samples per pixel.

I Split into 5 samples at firstdiffuse surface.

I Split in 2 at first 2 specularsurfaces.

I Russian roulette for remainingbounces.

I Time: c. 2 hours.

Page 13: 02941 Physically Based Rendering Path Tracing...Progressive unidirectional path tracing 1. Generate rays from the camera through pixel positions. 2. Trace the rays and evaluate the

Exercises

I Implement path tracing for diffuse objects.

I Render the Cornell box with blocks.

I Render the Cornell box with specular spheres.

I Explain light paths leading to secondary caustics.

I Extended light transport notation:L − LightE − EyeD − Diffuse surfaceS − Specular surface (Sr – reflection, St – transmission)∗ − 0 or more interactions+ − 1 or more interactions? − 0 or 1 interaction| − either the path on the left or the right side

All possible paths: L(D|S)∗ECaustics: LS+DS∗EPrimary caustics: L(Sr |StSt)DE | LStD(St?)E