CS 6958 LECTURE 16 PATHTRACING REVIEW, MATERIALS March 3, 2014 - - PowerPoint PPT Presentation

cs 6958 lecture 16 pathtracing review materials
SMART_READER_LITE
LIVE PREVIEW

CS 6958 LECTURE 16 PATHTRACING REVIEW, MATERIALS March 3, 2014 - - PowerPoint PPT Presentation

CS 6958 LECTURE 16 PATHTRACING REVIEW, MATERIALS March 3, 2014 Recall 2 can split illumination into direct and indirect indirect direct Recall 3 surfaces respond to this illumination indirect direct Recall 4 in reality,


slide-1
SLIDE 1

CS 6958 LECTURE 16 PATHTRACING REVIEW, MATERIALS

March 3, 2014

slide-2
SLIDE 2

Recall

2

 can split illumination into direct and indirect

direct indirect

slide-3
SLIDE 3

Recall

3

 surfaces respond to this illumination

direct indirect

slide-4
SLIDE 4

Recall

4

 in reality, both direct and indirect light comes

from many directions

direct indirect

slide-5
SLIDE 5

Recall

5

 … and surface response can vary drastically

based on material!

smooth diffuse

Source: Mitusba 0.5 documentation, https://www.mitsuba-renderer.org/docs.html

slide-6
SLIDE 6

Recall

6

 … and surface response can vary drastically

based on material!

smooth diffuse smooth dielectric smooth conducting scattering rough diffuse rough dielectric rough conducting

Source: Mitusba 0.5 documentation, https://www.mitsuba-renderer.org/docs.html

slide-7
SLIDE 7

Recall – path tracing

7

 Step 1. shoot ray from eye

 ray attenuation = (1, 1, 1) primary ray

slide-8
SLIDE 8

Recall – path tracing

8

 Step 2. accumulate direct contributions

 keep track of material response per light shadow ray

slide-9
SLIDE 9

Recall – path tracing

9

 Step 3. scale ray attenuation by material

 estimate indirect illumination by shooting a ray next bounce

slide-10
SLIDE 10

Recall – path tracing

10

 Step 4. for new hit point, repeat

slide-11
SLIDE 11

Path tracing algorithm

11

... for(number_samples) attenuation = Color(1.f, 1.f, 1.f); ray = generateNewRay( ... ); while(depth < max_depth) { HitRecord hit; bvh.intersect(hit, ray); result += shade(…) * attenuation;// box filter attenuation *= mat_color; ray = hemiRay(…); depth++ } result /= number_samples; // box filter // tone map! image.set(pixel, result);

slide-12
SLIDE 12

Path tracing considerations

12

 shoot many rays per pixel

 samples pixel area = anti-aliasing  (effectively) samples material, (area) lights,

indirect illumination = less noise in image

 stopping

 max depth reached (5-6 good, scene-dependent)  when attenuation below threshold

 must be careful about brightest light value  selecting new shooting direction

 based on material

slide-13
SLIDE 13

Lambertian material

 𝑀𝑆𝑓𝑔𝑚𝑓𝑑𝑢𝑓𝑒 = 𝐷𝑀𝑗𝑕ℎ𝑢 ∙ 𝐷𝑛𝑏𝑢𝑓𝑠𝑗𝑏𝑚 ∙ cos 𝜄  cos 𝜄 = 𝑂 ∙ 𝑀, after normalization

13

N L

slide-14
SLIDE 14

Dielectric material

 Ex: glass, water, diamond, etc  Incoming energy is split into Reflected and

Transmitted

 angular dependence based on indices of

refraction – Snell’s law

14

N R I T

slide-15
SLIDE 15

Snell’s Law

15

 speed of light is different in

different media

 light is an EM wave, different

component will have different speed

 result: the light bends at the

interface

sin 𝜄1 sin 𝜄2 = 𝑤1 𝑤2 = 𝑜2 𝑜1

Source: Wikipedia, http://en.wikipedia.org/wiki/Snell%27s_law

slide-16
SLIDE 16

Snell’s Law

16

 Total internal reflection

 gives diamonds their shine  occurs beyond critical angle

Source: Wikipedia, http://en.wikipedia.org/wiki/Snell%27s_law

𝜄𝑑 = sin−1 𝑜2 𝑜1 sin 𝜄2 = sin−1 𝑜2 𝑜1

slide-17
SLIDE 17

Examples of coefficients

Material Index of refraction Vacuum 1.0 Water 1.3330 Acetone 1.36 Ethanol 1.361 Silicone Oil 1.52045 Water Ice 1.31 Fused Quartz 1.458 Pyrex 1.470 Acrylic Glass 1.49 Amber 1.55 Diamond 2.419

17 Source: Mitusba 0.5 documentation, https://www.mitsuba-renderer.org/docs.html

slide-18
SLIDE 18

Fresnel Coefficients

18

 power is reduced based on reflected and

transmitted angles

Source: Wikipedia, http://en.wikipedia.org/wiki/Fresnel_equations

slide-19
SLIDE 19

Fresnel Coefficients

19

 power is reduced based on reflected and

transmitted angles

 use Schlick's approximation (reflected amount)  transmitted is then 𝑈 𝜄 = 1 − 𝑆 𝜄

Source: Wikipedia, http://en.wikipedia.org/wiki/Fresnel_equations

𝑆 𝜄 = 𝑆0 + 1 − 𝑆0 1 − cos 𝜄 5 𝑆0 = 𝑜1 − 𝑜2 𝑜1 + 𝑜2

2

cos 𝜄 = 𝐼 ∙ 𝑊 𝐼 – half vector between incident light and view direction 𝑊

slide-20
SLIDE 20

Dielectric Pseudocode

20

result = normal lambertian (or other) shading Ray rray = reflect_ray( ray, … ); if( tir(ray) ) { // kr = 1, kt = 0 result += traceRay( rray, depth + 1, … ); } else { // kr = R(theta) using Schlick’s approximation // kt = 1 - kr result += kr*traceRay( rray, depth + 1, … ); Ray tray = transmit_ray( ray, … ); result += kt*traceRay( tray, depth + 1, … ); }

slide-21
SLIDE 21

Dielectric Pseudocode

21

result = normal lambertian (or other) shading Ray rray = reflect_ray( ray, … ); if( tir(ray) ) { // kr = 1, kt = 0 result += traceRay( rray, depth + 1, … ); } else { // kr = R(theta) using Schlick’s approximation // kt = 1 - kr result += kr*traceRay( rray, depth + 1, … ); Ray tray = transmit_ray( ray, … ); result += kt*traceRay( tray, depth + 1, … ); }

See supplemental slides for derivation of reflected and transmitted rays using Snell’s Law

slide-22
SLIDE 22

Dielectric Pseudocode

22

bool tir( const Ray& ray ) { float cosTheta = -ray.direction() * normal; float eta; if( cosTheta > 0 ) { // ior_* - index of refraction, aka n eta = ior_from / ior_to; } else { eta = ior_to / ior_from; } return ( (1.f - (1.f - cosTheta*cosTheta) / (eta*eta)) < 0.f ); }

slide-23
SLIDE 23

Dielectric Pseudocode

23

bool transmit_ray( const Ray& ray, … ) { // compute eta and cosTheta the same as in tir // if cosTheta < 0: flip normal, eta, cosTheta tmp = 1.f - (1.f - cosTheta1*cosTheta1)/(eta*eta); cosTheta2 = sqrt(tmp); Ray tray( hit_point, ray.direction() / (cosTheta2 - cosTheta1/eta)*normal; return tray; }

slide-24
SLIDE 24

Dielectric Notes

24

 there are more efficient ways of doing it than

the above pseudocode

 should probably use a stack of indices

 nested refraction  eye starts within media

 directions of the normal matter!

Source: Wikipedia, http://en.wikipedia.org/wiki/Snell%27s_law

slide-25
SLIDE 25

Famous Material Models

25

 surfaces:

 Lambertian  Cook-Torrence  Anisotropic Ward  Other microfacet Distributions

 Ashikhmin-Shirley, 2000  Walter et. al, 2007

Source: Wikipedia, http://en.wikipedia.org/wiki/Fresnel_equations

slide-26
SLIDE 26

End

26