rendering path tracing i
play

Rendering: Path Tracing I Bernhard Kerbl Research Division of - PowerPoint PPT Presentation

Rendering: Path Tracing I Bernhard Kerbl Research Division of Computer Graphics Institute of Visual Computing & Human-Centered Technology TU Wien, Austria Todays Goal Add the last missing piece, the BSDF (simple version) Finally, we


  1. Rendering: Path Tracing I Bernhard Kerbl Research Division of Computer Graphics Institute of Visual Computing & Human-Centered Technology TU Wien, Austria

  2. Today’s Goal Add the last missing piece, the BSDF (simple version) Finally, we will generate some great-looking images by putting together all the things we learned: Light Physics Monte Carlo Integration The Rendering Equation The Path Tracing Algorithm We will also check out ways to make the procedure fast and stable Rendering – Path Tracing I 2

  3. Today’s Roadmap Diffuse Rendering Equation Recap Path Tracing BSDF (aka, the missing part) Next Event Russian Roulette What is indirect illumination? Estimation How do multiple bounces work? What is a path? Can we add other effects too? Specular Path Tracing v2.0 Rendering – Path Tracing I 3

  4. Today’s Roadmap Diffuse Rendering Equation Recap Path Tracing BSDF (aka, the missing part) Next Event Russian Roulette What is indirect illumination? Estimation How do multiple bounces work? What is a path? Can we add other effects too? Specular Path Tracing v2.0 Rendering – Path Tracing I 4

  5. The Missing Part of the Rendering Equation Bidirectional Scattering Distribution Function (BSDF) Describes the light transport properties of the material So far, we avoided this term or replaced it with constant factors Can model reflections, refractions, volumetric scattering… Rendering – Path Tracing I 5

  6. Bidirectional Reflectance Distribution Function (BRDF) Considers only the reflection of incoming light onto a surface The BRDF is a limited instance of the full BSDF (e.g., no transparency) Good for starting out, complex materials need full BSDF More on that in another lecture A BRDF function 𝑔 𝑠 (𝑦, 𝜕 𝑗 → 𝜕 𝑝 ) with input directions 𝜕 𝑗 , 𝜕 𝑝 uses convention: 𝜕 𝑗 and 𝜕 𝑝 are assumed to point away from 𝑦 How much irradiance from 𝜕 𝑗 is reflected as radiance to 𝜕 𝑝 at 𝑦 ? Rendering – Path Tracing I 6

  7. Bidirectional Reflectance Distribution Function (BRDF) “How much irradiance from 𝜕 𝑗 is reflected as radiance to 𝜕 𝑝 at 𝑦 ?” 𝑒𝑀 𝑗 (𝑦, 𝜕 𝑝 ) 𝑒𝑀 𝑗 (𝑦, 𝜕 𝑝 ) 𝑔 𝑠 𝑦, 𝜕 𝑗 → 𝜕 𝑝 = 𝑒𝐹 𝑗 (𝑦, 𝜕 𝑗 ) = 𝑀 𝑗 𝑦, 𝜕 𝑗 cos 𝜄 𝜕 𝑗 𝑒𝜕 𝑗 Helmholtz reciprocity : 𝑔 𝑠 𝑦, 𝜕 𝑗 → 𝜕 𝑝 = 𝑔 𝑠 (𝑦, 𝜕 𝑝 → 𝜕 𝑗 ) Conserves energy : ׬ Ω 𝑔 𝑠 𝑦, 𝜕 → 𝑤 cos 𝜄 𝑒𝜕 ≤ 1 ∀ 𝑤 Rendering – Path Tracing I 7

  8. Condition for Energy Conservation Why must the BRDF 𝑔 Ω 𝑔 𝑠 𝑦, 𝜕 → 𝑤 cos 𝜄 (𝜕) 𝑒𝜕 ≤ 1 ? 𝑠 fulfill ׬ Intuitive interpretation with reciprocity : Shine a laser light along −𝑤 onto 𝑦 . We must have ׬ Ω 𝑔 𝑠 𝑦, 𝑤 → 𝜕 cos 𝜄 (𝜕) 𝑒𝜕 ≤ 1 𝑤 If we find a direction 𝑤 for which this is not true, it means we would reflect more light than is coming in (furnace test!) 𝑦 Rendering – Path Tracing I 8

  9. Condition for Energy Conservation Why must the BRDF 𝑔 Ω 𝑔 𝑠 𝑦, 𝜕 → 𝑤 cos 𝜄 (𝜕) 𝑒𝜕 ≤ 1 ? 𝑠 fulfill ׬ Intuitive interpretation with reciprocity : Shine a laser light along −𝑤 onto 𝑦 . We must have ׬ Ω 𝑔 𝑠 𝑦, 𝑤 → 𝜕 cos 𝜄 (𝜕) 𝑒𝜕 ≤ 1 𝑤 If we find a direction 𝑤 for which this is not true, it means we would reflect more light than is coming in (furnace test!) 𝑦 Rendering – Path Tracing I 9

  10. BRDF Types We usually distinguish three basic BRDF types Perfectly diffuse (light is scattered equally in/from all directions) Perfectly specular (light is reflected in/from exactly one direction) Glossy (mixture of the other two, stronger reflectance around 𝑠 𝑤 ) 𝑜 𝑜 𝑜 𝑤 𝑤 𝑠 𝑤 𝑠 𝑤 𝑤 𝑦 𝑦 𝑦 Diffuse Specular Glossy Rendering – Path Tracing I 10

  11. BRDF Types We usually distinguish three basic BRDF types Perfectly diffuse (light is scattered equally in/from all directions) Perfectly specular (light is reflected in/from exactly one direction) Glossy (mixture of the other two, stronger reflectance around 𝑠 𝑤 ) Diffuse Rendering – Path Tracing I 11

  12. Sampling the BRDF Before, we considered the BRDF value and sampling of 𝜕 separately For implementation, it makes a lot of sense to combine them 𝑔 𝑠 (𝑦, 𝜕 → 𝑤) depends only on 𝑦 , 𝑤 and next ray direction 𝜕 Rendering equation: we can’t predict 𝑀 𝑗 , but 𝑔 𝑠 𝑦, 𝜕 → 𝑤 and cos 𝜄 Our renderings will converge faster if the distribution of 𝜕 actually matches the shape of 𝑔 𝑠 𝑦, 𝜕 → 𝑤 cos 𝜄 ( importance sampling !) If we put the BRDF in charge of choosing our 𝜕 , we can make it sample a distribution that directly matches 𝑔 𝑠 𝑦, 𝜕 → 𝑤 cos 𝜄 This actually makes things cleaner in code Rendering – Path Tracing I 12

  13. How to Handle Diffuse BRDFs Diffuse materials reflect same amount of light in/from all directions 𝜌 ∀ 𝑤, 𝜕 ∠ 𝑜 < 𝜌 𝜍 𝑜 𝑔 𝑠 𝑦, 𝜕 → 𝑤 = 2 𝜍 = amount of reflected light 𝑤 𝜕 2 𝜍 ≤ 1 in 𝑠, 𝑕, 𝑐 𝜕 1 𝜕 3 𝑦 𝜍 cos 𝜄 𝑠 𝑦, 𝜕 → 𝑤 cos 𝜄 → use 𝑞 𝜕 ∝ Importance sampling 𝑔 𝜌 Making it a valid PDF leads to 𝑞 𝜕 = cos 𝜄 𝜌 From previous exercise: it’s cosine -weighted hemisphere sampling! Rendering – Path Tracing I 13

  14. How to Implement Diffuse BRDFs Method sample( 𝑤 ) : generate a cosine-weighted sample 𝜌 𝜍 Method evaluate( 𝑏, 𝑐 ) : if 𝑏, 𝑐 ∠ 𝑜 < 2 , return 𝑔 𝑠 𝑦, 𝑐 → 𝑏 = 𝜌 Method pdf( 𝜕 ) : return the proper 𝑞(𝜕) for the passed sample Combine them into unit that takes care of handling diffuse materials Use terms as before. Abstracts the importance sampling away! Rendering – Path Tracing I 14

  15. Today’s Roadmap Diffuse Rendering Equation Recap Path Tracing BSDF (aka, the missing part) Next Event Russian Roulette What is indirect illumination? Estimation How do multiple bounces work? What is a path? Can we add other effects too? Specular Path Tracing v2.0 Rendering – Path Tracing I 15

  16. Things get interesting if we look at indirect illumination Adam Celarek 16 source: own work

  17. Indirect Illumination Difficult in real-time graphics – comes naturally in path tracing! Rendering – Path Tracing I 17

  18. Recursive Rendering Equation, Recap Material, modelled Light from by the BRDF direction ω Solid angle Light going in Light emitted from x direction v in direction v Rendering – Path Tracing I 18

  19. Recursive Rendering Equation, Recap Material, modelled Evaluate light from by the BRDF direction ω recursively Solid angle Light going in Light emitted from x direction v in direction v Rendering – Path Tracing I 19

  20. Recursive Rendering Equation, Recap To get the next bounce, we just evaluate this function recursively Rendering – Path Tracing I 20

  21. Implementing the Rendering Equation Li(Scene scene, Ray ray, int depth) { Color emitted = 0; if (!findIntersection(scene, ray)) return 0; Intersection its = getIntersection(scene, ray); // Take care of emittance if (isLightSource(its)) emitted = getRadiance(its); Recursion limit if(depth >= maxDepth ) return emitted; // BRDF should decide on the next ray // (It has to, e.g. for specular reflections) BRDF brdf = getBRDF(its); Ray wo = BRDFsample(brdf, -ray); Diffuse BRDF float pdf = BRDFpdf(brdf, wo); Color brdfValue = BRDFevaluate(brdf, -ray, wo); // Call recursively for indirect lighting Recursion Color indirect = Li(scene, wo, depth + 1); return emitted + brdfValue * indirect * cosTheta(its, wo) / pdf; } Rendering – Path Tracing I 21

  22. One Bounce Li(Scene scene, Ray ray, int depth) { Color emitted = 0; if (!findIntersection(scene, ray)) return 0; Intersection its = getIntersection(scene, ray); // Take care of emittance if (isLightSource(its)) emitted = getRadiance(its); if(depth >= 1 ) return emitted; // BRDF should decide on the next ray // (It has to, e.g. for specular reflections) BRDF brdf = getBRDF(its); Ray wo = BRDFsample(brdf, -ray); float pdf = BRDFpdf(brdf, wo); Color brdfValue = BRDFevaluate(brdf, -ray, wo); // Call recursively for indirect lighting Color indirect = Li(scene, wo, depth + 1); return emitted + brdfValue * indirect * cosTheta(its, wo) / pdf; } Rendering – Path Tracing I 22

  23. Two Bounces Li(Scene scene, Ray ray, int depth) { Color emitted = 0; if (!findIntersection(scene, ray)) return 0; Intersection its = getIntersection(scene, ray); // Take care of emittance if (isLightSource(its)) emitted = getRadiance(its); if(depth >= 2 ) return emitted; // BRDF should decide on the next ray // (It has to, e.g. for specular reflections) BRDF brdf = getBRDF(its); Ray wo = BRDFsample(brdf, -ray); float pdf = BRDFpdf(brdf, wo); Color brdfValue = BRDFevaluate(brdf, -ray, wo); // Call recursively for indirect lighting Color indirect = Li(scene, wo, depth + 1); return emitted + brdfValue * indirect * cosTheta(its, wo) / pdf; } Rendering – Path Tracing I 23

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