lecture 6 path tracing
play

Lecture 6 - Path Tracing Welcome! , = (, ) , - PowerPoint PPT Presentation

INFOMAGR Advanced Graphics Jacco Bikker - November 2019 - February 2020 Lecture 6 - Path Tracing Welcome! , = (, ) , + , , ,


  1. INFOMAGR – Advanced Graphics Jacco Bikker - November 2019 - February 2020 Lecture 6 - “Path Tracing” Welcome! 𝑱 𝒚, 𝒚 ′ = 𝒉(𝒚, 𝒚 ′ ) 𝝑 𝒚, 𝒚 ′ + න 𝝇 𝒚, 𝒚 ′ , 𝒚 ′′ 𝑱 𝒚 ′ , 𝒚 ′′ 𝒆𝒚′′ 𝑻

  2. Today’s Agenda: ▪ Introduction ▪ Path Tracing

  3. Advanced Graphics – Path Tracing 3 Introduction Previously in Advanced Graphics The Rendering Equation: 𝑀 𝑝 𝑦, 𝜕 𝑝 = 𝑀 𝐹 𝑦, 𝜕 𝑝 + න 𝑔 𝑠 𝑦, 𝜕 𝑝 , 𝜕 𝑗 𝑀 𝑗 𝑦, 𝜕 𝑗 cos 𝜄 𝑗 𝑒𝜕 𝑗 𝛻 …which models light transport as it happens in the real world, by summing: ▪ Direct illumination: 𝑀 𝐹 (𝑦, 𝜕 𝑝 ) ▪ Indirect illumination, or reflected light: ׬ 𝛻 𝑔 𝑠 𝑦, 𝜕 𝑝 , 𝜕 𝑗 𝑀 𝑗 𝑦, 𝜕 𝑗 cos 𝜄 𝑗 𝑒𝜕 𝑗 We used quantities flux 𝛸 (joules per second), radiance 𝑀 (flux per 𝑛 2 per sr) and irradiance 𝐹 (flux per 𝑛 2 ).

  4. Advanced Graphics – Path Tracing 4 Introduction Previously in Advanced Graphics Particle transport: As an alternative to discrete flux / radiance / irradiance, we can reason about light transport in terms of particle transport. ▪ Flux then becomes the number of emitted photons; ▪ Radiance the number of photons travelling through a unit area in a unit direction; ▪ Irradiance the number of photons arriving on a unit area. A BRDF tells us how many particles are absorbed, and how outgoing particles are distributed. The distribution depends on the incident and exitant direction.

  5. Advanced Graphics – Path Tracing 5 Introduction Previously in Advanced Graphics Probabilities: We can also reason about the behavior of a single photon. In that case, the BRDF tells us the probability of a photon being absorbed, or leaving in a certain direction.

  6. Advanced Graphics – Path Tracing 6 Introduction Previously in Advanced Graphics BRDFs:

  7. Advanced Graphics – Path Tracing 7 Introduction Light Transport 𝑠 𝑡 ← 𝑦 ← 𝑦′ 𝑀 𝑦 ← 𝑦′ 𝐻 𝑦 ↔ 𝑦 ′ 𝑒𝐵(𝑦 ′ ) 𝑀 𝑡 ← 𝑦 = 𝑀 𝐹 𝑡 ← 𝑦 + න 𝑔 𝐵 𝑀 𝑝 𝑦, 𝜕 𝑝 = 𝑀 𝐹 𝑦, 𝜕 𝑝 + න 𝑔 𝑠 𝑦, 𝜕 𝑝 , 𝜕 𝑗 𝑀 𝑗 𝑦, 𝜕 𝑗 cos 𝜄 𝑗 𝑒𝜕 𝑗 𝛻 Radiance Radiance Radiance Irradiance BRDF

  8. Advanced Graphics – Path Tracing 8 Introduction Bidirectional Reflectance Distribution Function BRDF: function describing the relation between radiance emitted in direction 𝜕 𝑝 and irradiance arriving from direction 𝜕 𝑗 : 𝑠 𝜕 𝑝 , 𝜕 𝑗 = 𝑀 𝑝 (𝜕 𝑝 ) 𝑀 𝑝 (𝜕 𝑝 ) = 𝑝𝑣𝑢𝑕𝑝𝑗𝑜𝑕 𝑠𝑏𝑒𝑗𝑏𝑜𝑑𝑓 𝑔 𝐹 𝑗 (𝜕 𝑗 ) = 𝑀 𝑗 𝜕 𝑗 cos θ 𝑗 𝑗𝑜𝑑𝑝𝑛𝑗𝑜𝑕 𝑗𝑠𝑠𝑏𝑒𝑗𝑏𝑜𝑑𝑓 Or, if spatially variant: 𝑠 𝑦, 𝜕 𝑝 , 𝜕 𝑗 = 𝑀 𝑝 (𝑦, 𝜕 𝑝 ) 𝑀 𝑝 (𝑦, 𝜕 𝑝 ) 𝑔 𝐹 𝑗 (𝑦, 𝜕 𝑗 ) = 𝑀 𝑗 𝑦, 𝜕 𝑗 cos θ 𝑗 Properties: ▪ Should be positive: 𝑔 𝑠 𝜕 𝑝 , 𝜕 𝑗 ≥ 0 ▪ Helmholtz reciprocity should be obeyed: 𝑔 𝑠 𝜕 𝑝 , 𝜕 𝑗 = 𝑔 𝑠 𝜕 𝑗 , 𝜕 𝑝 ▪ Energy should be conserved: ׬ 𝛻 𝑔 𝑠 𝜕 𝑝 , 𝜕 𝑗 cos 𝜄 𝑝 𝑒𝜕 𝑝 ≤ 1

  9. Advanced Graphics – Path Tracing 9 Introduction Bidirectional Reflectance Distribution Function The diffuse BRDF is: 𝑠 𝜕 𝑝 , 𝜕 𝑗 = 𝑏𝑚𝑐𝑓𝑒𝑝 𝑔 π So, for a total irradiance 𝐹 at surface point 𝑦 , the 𝝏 𝒋 𝑏𝑚𝑐𝑓𝑒𝑝 outgoing radiance 𝑀 𝑝 = 𝐹 𝑗 . Why the 𝜌 ? 𝒐 𝜌 Energy conservation: 𝐹 𝑝 ≤ 𝐹 𝑗 Suppose we have a directional light parallel to 𝑜 , with 𝑏𝑚𝑐𝑓𝑒𝑝 intensity 1. Then: 𝐹 𝑗 = 𝑀 𝑗 = 1. Suppose our BRDF = . 1 Then, for albedo = 1 we get: 𝐹 𝑝 = ׬ 𝛻 𝑀 𝑗 𝑔 𝑠 (𝜕 𝑝 , 𝜕 𝑗 ) cos 𝜕 𝑝 𝑒𝜕 𝑝 = ׬ 𝛻 cos 𝜕 𝑝 𝑒𝜕 𝑝 𝛻 cos 𝜕 𝑝 𝑒𝜕 𝑝 = 𝜌 ➔ 𝐹 𝑝 = 𝜌 𝐹 𝑗 . Now: ׬

  10. Advanced Graphics – Path Tracing 10 Introduction Bidirectional Reflectance Distribution Function Mirror / Perfect specular: Reflects light in a fixed direction. 𝝏 𝒑 𝝏 𝒋 𝒐 For a given incoming direction 𝜕 𝑗 , all light is emitted in a single infinitesimal set of directions. The specular BRDF is thus 𝑠 𝑦, 𝜕 𝑝 , 𝜕 𝑗 = ቊ∞, along reflected vector 𝑔 0, otherwise. This is not practical, and therefore we will handle the pure specular case (reflection and refraction) separately.

  11. Advanced Graphics – Path Tracing 11 Introduction Previously in Advanced Graphics Monte Carlo integration: Complex integrals can be approximated by replacing them by the expected value of a stochastic experiment. ▪ Soft shadows: randomly sample the area of a light source; ▪ Glossy reflections: randomly sample the directions in a cone; ▪ Depth of field: randomly sample the aperture; ▪ Motion blur: randomly sample frame time. In the case of the rendering equation, we are dealing with a recursive integral . Pat ath tr tracing: evaluating th this in integral us using a a ran andom walk .

  12. Today’s Agenda: ▪ Introduction ▪ Path Tracing

  13. Advanced Graphics – Path Tracing 13 Path Tracing Solving the Rendering Equation Let’s start with direct illumination: For a screen pixel, diffuse surface point 𝑞 with normal 𝑂 is directly visible. What is the radiance travelling via 𝑞 towards the eye? Answer: 𝑀 𝑝 𝑞, 𝜕 𝑝 = න 𝑔 𝑠 𝑞, 𝜕 𝑝 , 𝜕 𝑗 𝑀 𝑒 𝑞, 𝜕 𝑗 cos 𝜄 𝑗 𝑒𝜕 𝑗 𝛻 𝜕 𝑗 𝑂 𝜕 𝑝 p

  14. Advanced Graphics – Path Tracing 14 Path Tracing 𝑀 𝑝 𝑞, 𝜕 𝑝 = න 𝑔 𝑠 𝑞, 𝜕 𝑝 , 𝜕 𝑗 𝑀 𝑒 𝑞, 𝜕 𝑗 cos 𝜄 𝑗 𝑒𝜕 𝑗 𝛻 Solving the Rendering Equation = 𝑏𝑚𝑐𝑓𝑒𝑝 න 𝑀 𝑒 𝑞, 𝜕 𝑗 cos 𝜄 𝑗 𝑒𝜕 𝑗 𝜌 𝛻 Q: What about distance attenuation? Let’s start with direct illumination: A: A far-away light is found by fewer directions 𝜕 𝑗 : it’s solid ang angle on the hemisphere is smaller. For a screen pixel, diffuse surface point 𝑞 with normal 𝑂 is directly visible. What is the radiance travelling via 𝑞 towards the eye? Q: What about the diffuse surface? Answer: A: The BRDF is independent of 𝜕 𝑝 (it doesn’t appear in the equation), but as 𝜕 𝑗 approaches 𝑀 𝑝 𝑞, 𝜕 𝑝 = න 𝑔 𝑠 𝑞, 𝜕 𝑝 , 𝜕 𝑗 𝑀 𝑒 𝑞, 𝜕 𝑗 cos 𝜄 𝑗 𝑒𝜕 𝑗 the horizon, cos 𝜄 𝑗 approaches zero. 𝛻 𝜕 𝑗 𝑜 𝜕 𝑝 p

  15. Advanced Graphics – Path Tracing 15 Path Tracing Direct Illumination We can solve this integral using Monte-Carlo integration: ▪ Chose N random directions over the hemisphere for 𝑞 ▪ Find the first surface in each direction by tracing a ray ▪ Sum the luminance of the encountered surfaces ▪ Divide the sum by N and multiply by 2π 𝑂 𝑀 𝑝 𝑞, 𝜕 𝑝 ≈ 2𝜌 𝑂 ෍ 𝑔 𝑠 𝑞, 𝜕 𝑝 , 𝜕 𝑗 𝑀 𝑒 𝑞, 𝜕 𝑗 cos 𝜄 𝑗 𝑗=1 𝜕 𝑗 𝑜 𝜕 𝑝 p

  16. Advanced Graphics – Path Tracing 16 Path Tracing We integrate over the hemisphere, which Direct Illumination has an area of 2 𝜌 . 𝑂 Do not confuse this with the 1/ 𝜌 factor 𝑀 𝑝 𝑞, 𝜕 𝑝 ≈ 2𝜌 in the BRDF, which doesn’t compensate 𝑂 ෍ 𝑔 𝑠 𝑞, 𝜕 𝑝 , 𝜕 𝑗 𝑀 𝑒 𝑞, 𝜕 𝑗 cos 𝜄 for the surface of the hemisphere, but the 𝑗=1 integral of cos 𝜄 over the hemisphere ( 𝜌 ). Questions: ▪ Why do we multiply by 2𝜌 ? ▪ What is the radiance 𝑀 𝑒 (𝑞, 𝜕 𝑗 ) towards 𝑞 for e.g. a 100W light? ▪ What is the irradiance 𝐹 at 𝑞 from this light? 𝑀 is per sr; 𝑀 𝑒 (𝑞, 𝜕 𝑗 ) is proportional to the solid angle of the light as seen 𝜕 𝑗 from p , so: ~ (cos 𝜄 𝑝 𝐵 𝑀 𝑒 )/𝑠 2 . 𝑜 𝜕 𝑝 Note that the 100W flux is spread out over the area; irradiance is defined per 𝑛 2 . p

  17. Advanced Graphics – Path Tracing 17 Path Tracing Direct Illumination 𝑀 𝑝 𝑞, 𝜕 𝑝 = න 𝑔 𝑠 𝑞, 𝜕 𝑝 , 𝜕 𝑗 𝑀 𝑒 𝑞, 𝜕 𝑗 cos 𝜄 𝑗 𝑒𝜕 𝑗 𝛻 In many directions, we will not find light sources. We can improve our estimate by sampling the lights separately. 𝑚𝑗𝑕ℎ𝑢𝑡 𝑘 𝑞, 𝜕 𝑗 cos 𝜄 𝑗 𝑒𝜕 𝑗 𝑀 𝑝 𝑞, 𝜕 𝑗 = ෍ න 𝑔 𝑠 𝑞, 𝜕 𝑝 , 𝜕 𝑗 𝑀 𝑒 𝛻 𝑘=1 Obviously, sampling the entire hemisphere for each light is not necessary; we can sample the area of the light instead: 𝑚𝑗𝑕ℎ𝑢𝑡 𝑘 𝑞, 𝜕 𝑗 cos 𝜄 𝑗 𝑒𝜕 𝑗 𝑀 𝑝 𝑞, 𝜕 𝑗 = ෍ න 𝑔 𝑠 𝑞, 𝜕 𝑝 , 𝜕 𝑗 𝑀 𝑒 𝐵 𝑘=1

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