INFOMAGR – Advanced Graphics Jacco Bikker - November 2016 - February 2017 Lecture 6 - “Light Transport” Welcome! 𝑱 𝒚, 𝒚 ′ = 𝒉(𝒚, 𝒚 ′ ) 𝝑 𝒚, 𝒚 ′ + 𝝇 𝒚, 𝒚 ′ , 𝒚 ′′ 𝑱 𝒚 ′ , 𝒚 ′′ 𝒆𝒚′′ 𝑻
Today’s Agenda: Introduction The Rendering Equation Light Transport
Advanced Graphics – Light Transport 3 Introduction Whitted
Advanced Graphics – Light Transport 4 Introduction Whitted
Advanced Graphics – Light Transport 5 Introduction Whitted Missing: Area lights Glossy reflections Caustics Diffuse interreflections Diffraction Polarization Phosphorescence Temporal effects Motion blur Depth of field Anti-aliasing
Advanced Graphics – Light Transport 6 Introduction Anti-aliasing Adding anti-aliasing to a Whitted-style ray tracer: Send multiple primary rays through each pixel, and average their result. Problem: How do we aim those rays? What if all rays return the same color?
Advanced Graphics – Light Transport 7 Introduction Anti-aliasing – Sampling Patterns Adding anti-aliasing to a Whitted-style ray tracer: Send multiple primary rays through each pixel, and average their result. Problem: How do we aim those rays? What if all rays return the same color?
Advanced Graphics – Light Transport 8 Introduction Anti-aliasing – Sampling Patterns
Advanced Graphics – Light Transport 9 Introduction Anti-aliasing – Sampling Patterns
Advanced Graphics – Light Transport 10 Introduction Anti-aliasing – Sampling Patterns Adding anti-aliasing to a Whitted-style ray tracer: Send multiple primary rays through each pixel, and average their result. Problem: How do we aim those rays? What if all rays return the same color?
Advanced Graphics – Light Transport 11 Introduction Whitted Missing: Area lights Glossy reflections Caustics Diffuse interreflections Diffraction Polarization Phosphorescence Temporal effects Motion blur Depth of field Anti-aliasing
Advanced Graphics – Light Transport 12 Introduction Distribution Ray Tracing* Soft shadows *: Distributed Ray Tracing, Cook et al., 1984
Advanced Graphics – Light Transport 13 Introduction Distribution Ray Tracing* Glossy reflections *: Distributed Ray Tracing, Cook et al., 1984
Advanced Graphics – Light Transport 14 Introduction Distribution Ray Tracing* ? *: Distributed Ray Tracing, Cook et al., 1984
Advanced Graphics – Light Transport 15 Introduction Distribution Ray Tracing* *: Distributed Ray Tracing, Cook et al., 1984
Advanced Graphics – Light Transport 16 Introduction Distribution Ray Tracing Whitted-style ray tracing is a point sampling algorithm: We may miss small features We cannot sample areas Area sampling: Anti-aliasing: one pixel Soft shadows: one area light source Glossy reflection: directions in a cone Diffuse reflection: directions on the hemisphere
Advanced Graphics – Light Transport 17 Introduction Area Lights Visibility of an area light source: 𝑊 𝐵 = 𝑊 𝑦, ꙍ 𝑗 𝑒ꙍ 𝑗 𝐵 Analytical solution case 1: 𝑊 𝐵 = 𝐵 𝑚𝑗ℎ𝑢 − 𝐵 𝑚𝑗ℎ𝑢⋂𝑡𝑞ℎ𝑓𝑠𝑓 Analytical solution case 2: 𝑊 𝐵 = ?
Advanced Graphics – Light Transport 18 Introduction Approximating Integrals An integral can be approximated as a Riemann sum: 𝑂 𝑂 𝐶 𝑊 𝐵 = 𝑔(𝑦) 𝑒𝑦 ≈ 𝑔 𝑢 𝑗 𝛦 𝑗 , where 𝛦 𝑗 = 𝐶 − 𝐵 Image from Wikipedia 𝐵 𝑗=1 𝑗=1 Note that the intervals do not need to be uniform, as long as we sample the full interval. If the intervals are uniform, then 𝑂 𝑂 𝑂 𝑔 𝑢 𝑗 = 𝐶 − 𝐵 𝑔 𝑢 𝑗 𝛦 𝑗 = 𝛦 𝑗 𝑔 𝑢 𝑗 . 𝑂 𝑗=1 𝑗=1 𝑗=1 Regardless of uniformity, restrictions apply to 𝑂 when sampling multi-dimensional functions (ideally, 𝑂 = 𝑁 𝑒 ). Also note that aliasing may occur if the intervals are uniform.
Advanced Graphics – Light Transport 19 Introduction Monte Carlo Integration Alternatively, we can approximate an integral by taking random samples: 𝑂 𝐶 𝑔(𝑦) 𝑒𝑦 ≈ 𝐶 − 𝐵 𝑊 𝐵 = 𝑔 x 𝑗 Image from Wikipedia 𝑂 𝐵 𝑗=1 Here, x 1 . . x 𝑂 ∈ [𝐵, 𝐶] . As 𝑂 approaches infinity, 𝑊 𝐵 approaches the expected value of 𝑔 . Unlike in Riemann sums, we can use arbitrary 𝑂 for Monte Carlo integration, regardless of dimension.
Advanced Graphics – Light Transport 20 Introduction Monte Carlo Integration of Area Light Visibility To estimate the visibility of an area light source, we take 𝑂 random point samples. In this case, 5 out of 6 samples are unoccluded: 𝑊 ≈ 1 6 1 + 1 + 1 + 0 + 1 + 1 = 5 6 In terms of Monte Carlo integration: 𝑂 𝒯 2 𝑊(𝑞) 𝑒𝑞 ≈ 1 𝑊 = 𝑂 𝑊 𝑞 𝑗=1 With a small number of samples, the variance in the estimate shows up as noise in the image.
Advanced Graphics – Light Transport 21 Introduction Monte Carlo Integration of Area Light Visibility We can also use Monte Carlo to estimate the contribution of multiple lights: 1. Take the average of N samples from each light source; 2. Sum the averages. 2 𝐹 𝑦 ← = 𝑀 𝑗 𝑊(𝑦 ↔ 𝑚 𝑗 ) 𝑗=1 𝑦
Advanced Graphics – Light Transport 22 Introduction Monte Carlo Integration of Area Light Visibility Alternatively, we can just take 𝑂 samples, and pick a random light source for each sample. 𝑂 𝐹 𝑦 ← = 2 𝑂 𝑀 𝑟 𝑊 𝑞 , 𝑟 ∈ {1,2} 𝑟 𝑗=1 𝑂 𝑀 𝑟 𝑊 𝑞 = 1 𝑟 𝑂 0.5 𝑗=1 𝑦
Advanced Graphics – Light Transport 23 Introduction Monte Carlo Integration of Area Light Visibility We obtain a better estimate with fewer samples if we do not treat each light equally. In the previous example, each light had a 50% probability of being sampled. We can use an arbitrary probability, by dividing the sample by this probability. 𝑂 𝑀 𝑟 𝑊 𝑞 𝐹 𝑦 ← = 1 𝑟 𝑂 , 𝜍 𝑟 = 1, 𝜍 𝑟 > 0 𝜍 𝑟 𝑗=1 𝑦
Advanced Graphics – Light Transport 24 Introduction Distribution Ray Tracing Key concept of distribution ray tracing: We estimate integrals using Monte Carlo integration. Integrals in rendering: Area of a pixel Lens area (aperture) Frame time Light source area Cones for glossy reflections Wavelengths …
Advanced Graphics – Light Transport 25 Introduction Open Issues Remaining issues: Energy distribution in the ray tree / efficiency Diffuse interreflections
Today’s Agenda: Introduction The Rendering Equation Light Transport
Advanced Graphics – Light Transport 27 Rendering Equation Whitted, Cook & Beyond Missing in Whitted: Cook: Area lights Area lights Glossy reflections Glossy reflections Caustics × Caustics Diffuse interreflections × Diffuse interreflections Diffraction × Diffraction Polarization × Polarization Phosphorescence × Phosphorescence Temporal effects × Temporal effects Motion blur Motion blur Depth of field Depth of field Anti-aliasing Anti-aliasing
Advanced Graphics – Light Transport 28 Rendering Equation Whitted, Cook & Beyond Cook’s solution to rendering: Sample the many-dimensional integral using Monte Carlo integration. … 𝐵 𝑞𝑗𝑦𝑓𝑚 𝐵 𝑚𝑓𝑜𝑡 𝑈 𝑔𝑠𝑏𝑛𝑓 𝛻 𝑚𝑝𝑡𝑡𝑧 𝐵 𝑚𝑗ℎ𝑢 Ray optics are still used for specular reflections and refractions: The ray tree is not eliminated. (In fact: for each light, one or more shadow rays are produced)
Advanced Graphics – Light Transport 29 Rendering Equation God’s Algorithm 1 room 1 bulb 100 watts 10 20 photons per second Photon behavior: Travel in straight lines Get absorbed, or change direction: Bounce (random / deterministic) Get transmitted Leave into the void Get detected
Advanced Graphics – Light Transport 30 Light Transport
Advanced Graphics – Light Transport 31 Rendering Equation God’s Algorithm - Mathematically A photon may arrive at a sensor after travelling in a straight line from a light source to the sensor: 𝑀 𝑡 ← 𝑦 = 𝑀 𝐹 (𝑡 ← 𝑦) Or, it may be reflected by a surface towards the sensor: 𝑠 𝑡 ← 𝑦 ← 𝑦 ′ 𝑀 𝑦 ← 𝑦 ′ 𝐻 𝑦 ↔ 𝑦 ′ 𝑒𝐵(𝑦 ′ ) 𝑀 𝑡 ← 𝑦 = 𝑔 𝐵 Those are the options. Adding direct and indirect illumination together: 𝑠 𝑡 ← 𝑦 ← 𝑦′ 𝑀 𝑦 ← 𝑦′ 𝐻 𝑦 ↔ 𝑦 ′ 𝑒𝐵(𝑦 ′ ) 𝑀 𝑡 ← 𝑦 = 𝑀 𝐹 𝑡 ← 𝑦 + 𝑔 𝐵
Advanced Graphics – Light Transport 32 Rendering Equation God’s Algorithm - Mathematically 𝑠 𝑡 ← 𝑦 ← 𝑦′ 𝑀 𝑦 ← 𝑦′ 𝐻 𝑦 ↔ 𝑦 ′ 𝑒𝐵(𝑦 ′ ) 𝑀 𝑡 ← 𝑦 = 𝑀 𝐹 𝑡 ← 𝑦 + 𝑔 𝐵 Geometry factor Indirect Reflection Hemisphere Emission
Recommend
More recommend