cs 6958 lecture 16 pathtracing review materials
play

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,


  1. CS 6958 LECTURE 16 PATHTRACING REVIEW, MATERIALS March 3, 2014

  2. Recall 2  can split illumination into direct and indirect indirect direct

  3. Recall 3  surfaces respond to this illumination indirect direct

  4. Recall 4  in reality, both direct and indirect light comes from many directions direct indirect

  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

  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

  7. Recall – path tracing 7  Step 1. shoot ray from eye  ray attenuation = (1, 1, 1) primary ray

  8. Recall – path tracing 8  Step 2. accumulate direct contributions  keep track of material response per light shadow ray

  9. Recall – path tracing 9  Step 3. scale ray attenuation by material  estimate indirect illumination by shooting a ray next bounce

  10. Recall – path tracing 10  Step 4. for new hit point, repeat

  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);

  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

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

  14. Dielectric material 14  Ex: glass, water, diamond, etc  I ncoming energy is split into R eflected and T ransmitted  angular dependence based on indices of refraction – S nell’s law N I R T

  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 = 𝑤 1 = 𝑜 2 sin 𝜄 2 𝑤 2 𝑜 1 Source: Wikipedia, http://en.wikipedia.org/wiki/Snell%27s_law

  16. Snell’s Law 16  Total internal reflection  gives diamonds their shine 𝜄 𝑑 = sin −1 𝑜 2 = sin −1 𝑜 2  occurs beyond critical angle sin 𝜄 2 𝑜 1 𝑜 1 Source: Wikipedia, http://en.wikipedia.org/wiki/Snell%27s_law

  17. Examples of coefficients 17 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 Source: Mitusba 0.5 documentation, https://www.mitsuba-renderer.org/docs.html

  18. Fresnel Coefficients 18  power is reduced based on reflected and transmitted angles Source: Wikipedia, http://en.wikipedia.org/wiki/Fresnel_equations

  19. Fresnel Coefficients 19  power is reduced based on reflected and transmitted angles  use Schlick's approximation (reflected amount) 1 − cos 𝜄 5 𝑆 𝜄 = 𝑆 0 + 1 − 𝑆 0 2 𝑜 1 − 𝑜 2 𝑆 0 = 𝑜 1 + 𝑜 2 cos 𝜄 = 𝐼 ∙ 𝑊 𝐼 – half vector between incident light and view direction 𝑊  transmitted is then 𝑈 𝜄 = 1 − 𝑆 𝜄 Source: Wikipedia, http://en.wikipedia.org/wiki/Fresnel_equations

  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, … ); }

  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, … ); See supplemental slides for } else { derivation of reflected and // kr = R(theta) using Schlick’s approximation transmitted rays using Snell’s Law // kt = 1 - kr result += kr*traceRay( rray, depth + 1, … ); Ray tray = transmit_ray( ray, … ); result += kt*traceRay( tray, depth + 1, … ); }

  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 ); }

  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; }

  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

  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

  26. End 26

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend