Computer Graphics - Volume Rendering - Pascal Grittmann Philipp Slusallek Using pictures from: Monte Carlo Methods for Physically Based Volume Rendering ; SIGGRAPH 2018 Course; Jan Novák, Iliyan Georgiev, Johannes Hanika, Jaroslav Křivánek , Wojciech Jarosz
Overview • So far: • Light interactions with surfaces • Assume vacuum in and around objects • This lecture: • Participating media • How to represent volumetric data • How to compute volumetric lighting effects • How to implement a very basic volume renderer 06.12.2018 CG - Volume Rendering - Pascal Grittmann 2
Fundamentals 06.12.2018 CG - Volume Rendering - Pascal Grittmann 8
Volumetric Effects • Light interacts not only with surfaces but everywhere inside! • Volumes scatter, emit, or absorb light http://coclouds.com http://wikipedia.org http://commons.wikimedia.org 06.12.2018 CG - Volume Rendering - Pascal Grittmann 9
Approximation: Model Particle Density • Modeling individual particles of a volume is, of course, not practical • Instead, represent statistically using the average density • (Same idea as, e.g., microfacet BSDFs) 06.12.2018 CG - Volume Rendering - Pascal Grittmann 10
Volume Representation • Many possibilities (particles, voxel octrees, procedural, … ) • A common approach: Scene objects can “contain” a volume 06.12.2018 CG - Volume Rendering - Pascal Grittmann 11
Volume Representation • Homogeneous: • Constant density • Constant absorption, scattering, emission, • Constant phase function (later) • Heterogeneous: • Coefficients and/or phase function vary across the volume • Can be represented using 3D textures • (e.g., voxel grid, procedural) http://wikipedia.org 06.12.2018 CG - Volume Rendering - Pascal Grittmann 12
Representation Example: OpenVDB [K. Museth, 2013] • Open source library • Manages volume data • Discretized, sparse, hierarchical grid 06.12.2018 CG - Volume Rendering - Pascal Grittmann 13
Data Acquisition Examples • Real-world measurements via tomography • Simulation, e.g., • Fluids, • Fire and smoke, • Fog https://docs.blender.org 06.12.2018 CG - Volume Rendering - Pascal Grittmann 14
Simulating Volumes Mathematical Formulation of Volumetric Light Transport 06.12.2018 CG - Volume Rendering - Pascal Grittmann 15
So far: Assume Vacuum • Compute 𝑀 𝑝 (𝑦, 𝜕 𝑝 ) using the rendering equation 𝑦 06.12.2018 CG - Volume Rendering - Pascal Grittmann 16
Volume Absorbs and Scatters Light • Compute 𝑀 𝑝 (𝑦, 𝜕 𝑝 ) using the rendering equation • Only a fraction 𝑈 𝑏, 𝑐 𝑀 𝑝 𝑦, 𝜕 𝑝 arrives at the eye 𝑐 𝑏 𝑦 06.12.2018 CG - Volume Rendering - Pascal Grittmann 17
Volume Emits Light • Compute 𝑀 𝑝 (𝑦, 𝜕 𝑝 ) using the rendering equation • Only a fraction 𝑈 𝑏, 𝑐 𝑀 𝑝 𝑦, 𝜕 𝑝 arrives at the eye • Every point 𝑨 between 𝑏 and 𝑐 might emit light 𝑐 𝑏 𝑦 𝑨 06.12.2018 CG - Volume Rendering - Pascal Grittmann 18
Volume Scatters Light • Compute 𝑀 𝑝 (𝑦, 𝜕 𝑝 ) using the rendering equation • Only a fraction 𝑈 𝑏, 𝑐 𝑀 𝑝 𝑦, 𝜕 𝑝 arrives at the eye • Every point 𝑨 between 𝑏 and 𝑐 might emit light • Every point 𝑨 might be illuminated through the volume 𝑐 𝑏 𝑦 𝑨 06.12.2018 CG - Volume Rendering - Pascal Grittmann 19
𝑐 𝑏 𝑦 𝑀 𝑗 = ? 𝑀 0 𝑦 Attenuation http://commons.wikimedia.org Computing Absorption and Out-Scattering 06.12.2018 CG - Volume Rendering - Pascal Grittmann 20
Attenuation = Absorption + Out-Scattering • Every point in the volume might absorb light or scatter it in other directions • Modeled by absorption and scattering densities: 𝜈 𝑏 𝑨 and 𝜈 𝑡 𝑨 • Might depend on position, direction, time, wavelength, … • For simplicity: we assume only positional dependence 𝑐 𝑏 𝑦 𝑨 06.12.2018 CG - Volume Rendering - Pascal Grittmann 21
Computing Absorption – Intuition • Consider a small segment Δ𝑨 • Along that segment, radiance is reduced from 𝑀 to 𝑀 ′ • 𝑀 ′ = 𝑀 − 𝜈 𝑏 𝑀 Δ𝑨 • Where 𝜈 𝑏 is the percentage of radiance that is absorbed (per unit distance) 𝑀 𝑀 ′ 𝑐 𝑏 Δ𝑨 06.12.2018 CG - Volume Rendering - Pascal Grittmann 22
Computing Absorption – Intuition • Consider a small segment Δ𝑨 • Along that segment, radiance is reduced from 𝑀 to 𝑀 ′ • 𝑀 ′ = 𝑀 − 𝜈 𝑏 𝑀 Δ𝑨 • Where 𝜈 𝑏 is the percentage of radiance that is absorbed (per unit distance) 𝑀 𝑀 ′ 𝑐 𝑏 Δ𝑨 So the absorbed radiance is: Δ𝑀 = 𝑀 ′ − 𝑀 = −𝜈 𝑏 𝑀 Δ𝑨 06.12.2018 CG - Volume Rendering - Pascal Grittmann 23
Computing Absorption – Exponential Decay • Δ𝑀 = −𝜈 𝑏 𝑀 Δ𝑨 • For infinitely small Δ𝑨 , this becomes • 𝑒𝑀 = −𝜈 𝑏 𝑀 𝑒𝑨 • A differential equation that models exponential decay! 𝑏 𝜈 𝑏 𝑢 𝑒𝑢 • Solution: 𝑀 𝑏 = 𝑀 𝑝 𝑦 𝑓 − 𝑐 𝑀 𝑐 = 𝑀 𝑝 𝑦 𝑀 𝑏 𝑀 𝑀 ′ 𝑐 𝑏 Δ𝑨 𝑦 06.12.2018 CG - Volume Rendering - Pascal Grittmann 24
Computing Out-Scattering • Same as absorption, only different factor! • 𝜈 𝑡 𝑨 : percentage of light scattered at point 𝑨 𝑏 𝜈 𝑡 𝑢 𝑒𝑢 • 𝑀 𝑏 = 𝑀 𝑝 𝑦 𝑓 − 𝑐 𝑐 𝑏 𝑦 𝑨 06.12.2018 CG - Volume Rendering - Pascal Grittmann 25
Computing Attenuation • Fraction of light that is neither absorbed nor out-scattered • 𝜈 𝑢 = 𝜈 𝑏 + 𝜈 𝑡 𝑏 (𝜈 𝑏 𝑢 +𝜈 𝑡 𝑢 ) 𝑒𝑢 • 𝑀 𝑏 = 𝑀 𝑝 𝑦 𝑓 − 𝑐 𝑏 𝜈 𝑢 𝑢 𝑒𝑢 • Attenuation: 𝑈 𝑏, 𝑐 = 𝑓 − 𝑐 𝑐 𝑏 𝑦 𝑨 06.12.2018 CG - Volume Rendering - Pascal Grittmann 26
Computing Attenuation – Homogeneous • Simple case: constant density / attenuation • 𝜈 𝑢 𝑨 = 𝜈 𝑢 ∀𝑨 𝑏 𝜈 𝑢 𝑢 𝑒𝑢 = 𝑓 −(𝑏−𝑐)𝜈 𝑢 • 𝑈 𝑏, 𝑐 = 𝑓 − 𝑐 𝑐 𝑏 𝑦 𝑨 06.12.2018 CG - Volume Rendering - Pascal Grittmann 27
Estimating Attenuation • We need to solve another integral: 𝑏 𝜈 𝑢 𝑢 𝑒𝑢 • 𝑈 𝑏, 𝑐 = 𝑓 − 𝑐 • Many solutions, e.g., Monte Carlo integration (next semester) • Simple solution: Quadrature 06.12.2018 CG - Volume Rendering - Pascal Grittmann 28
Estimating Attenuation – Ray Marching • We need to solve another integral: 𝑏 𝜈 𝑢 𝑢 𝑒𝑢 • 𝑈 𝑏, 𝑐 = 𝑓 − 𝑐 • Simple solution: Quadrature • Ray marching: evaluate at discrete positions (fixed stepsize Δ𝑨 ) 𝑏 𝜈 𝑢 𝑢 𝑒𝑢 ≈ σ 𝑗 𝜈 𝑢 (𝑨 𝑗 ) Δ𝑨 • 𝑐 Δ𝑨 Δ𝑨 Δ𝑨 Δ𝑨 𝑐 𝑏 𝑦 𝑨 1 𝑨 2 𝑨 3 06.12.2018 CG - Volume Rendering - Pascal Grittmann 29
𝑏 𝑐 𝑨 Emission Explosions! http://wikipedia.org 06.12.2018 CG - Volume Rendering - Pascal Grittmann 30
Every Point Might Emit Light • Assume 𝑨 emits 𝑀 𝑓 𝑨 towards 𝑏 • Some of that light might be absorbed or out-scattered: It is attenuated • 𝑀 𝑏 = 𝑀 𝑓 𝑨 𝑈 𝑨, 𝑏 𝑐 𝑏 𝑨 06.12.2018 CG - Volume Rendering - Pascal Grittmann 31
Every Point Might Emit Light • Assume 𝑨 emits 𝑀 𝑓 𝑨 towards 𝑏 • Some of that light might be absorbed or out-scattered: It is attenuated • 𝑀 𝑏 = 𝑀 𝑓 𝑨 𝑈 𝑨, 𝑏 • Happens at every point along the ray! 𝑐 𝑀 𝑓 𝑨 𝑈 𝑨, 𝑏 𝑒𝑨 • 𝑀 𝑏 = 𝑐 𝑏 𝑏 𝑨 • Another integral … 06.12.2018 CG - Volume Rendering - Pascal Grittmann 32
Ray Marching for Emission • Same as before: integrate via quadrature 𝑐 𝑀 𝑓 𝑨 𝑈 𝑨, 𝑏 𝑒𝑨 ≈ σ 𝑗 𝑀 𝑓 𝑨 𝑗 𝑈 𝑨 𝑗 , 𝑏 Δ𝑨 • 𝑏 • Attenuation 𝑈 𝑨 𝑗 , 𝑏 estimated as before Δ𝑨 Δ𝑨 Δ𝑨 Δ𝑨 𝑐 𝑏 𝑦 𝑨 1 𝑨 2 𝑨 3 06.12.2018 CG - Volume Rendering - Pascal Grittmann 33
Ray Marching for Emission • Same as before: integrate via quadrature 𝑐 𝑀 𝑓 𝑨 𝑈 𝑨, 𝑏 𝑒𝑨 ≈ σ 𝑗 𝑀 𝑓 𝑨 𝑗 𝑈 𝑨 𝑗 , 𝑏 Δ𝑨 • 𝑏 • Attenuation 𝑈 𝑨 𝑗 , 𝑏 estimated as before • Attenuation can be incrementally updated: • 𝑈 𝑨 𝑗 , 𝑏 = 𝑈 𝑨 𝑗−1 , 𝑏 𝑈 𝑨 𝑗 , 𝑨 𝑗−1 • (because it is an exponential function) Δ𝑨 Δ𝑨 Δ𝑨 Δ𝑨 𝑐 𝑏 𝑦 𝑨 1 𝑨 2 𝑨 3 06.12.2018 CG - Volume Rendering - Pascal Grittmann 34
𝑐 𝑏 𝑨 In-Scattering Accounting for Reflections Inside the Volume 06.12.2018 CG - Volume Rendering - Pascal Grittmann 35
Direct Illumination • Account for the (attenuated) direct illumination at every point 𝑨 • Similar to the rendering equation: • 𝑀 𝑝 𝑨, 𝜕 𝑝 = Ω 𝑀 𝑗 𝑦, 𝜕 𝑗 𝑔 𝑞 𝜕 𝑗 , 𝜕 𝑝 𝑒𝜕 𝑗 • Integration over the whole sphere Ω • The phase function 𝑔 𝑞 takes on the role of the BSDF 𝜕 𝑗 𝑐 𝑏 𝜕 𝑝 𝑨 06.12.2018 CG - Volume Rendering - Pascal Grittmann 36
Recommend
More recommend