SOME THEORY BEHIND REAL-TIME RENDERING Jaroslav Křivánek Charles University in Prague
Off-line realistic rendering (not yet in rea-time)
Ray tracing 3
4
Image created by Bertrand Benoit Rendered in Corona Renderer 5
Image created by Jeff Patton Rendered in Corona Renderer 6
ŠKODA Rapid Catalogue 7
8
Image created by Weta Digital 20 th Century Fox 9
Image created by Weta Digital 20 th Century Fox 10
vimeo >> The Great Gatsby 11 VFX
vimeo >> The Great Gatsby 12 VFX
Global illumination
Global illumination Color bleeding Image credit: Michael Bunnell 14 14
Global illumination Caustics 15
Global illumination in games 16
Basic light transport theory
Image generation Pixel value = average radiance reflected from surfaces visible through the pixel Generating an image involves (some sort of) light transport simulation Radiance L (x, ω) 18 18
Radiance Radiometric quantity measuring amount of light energy along a ray Denoted L (x, ω) x position ω direction ω Units [W / m 2 sr ] Essential properties of radiance Proportional to perceived brightness xxxxx Constant along a ray xxxxxx x 19
Light reflection x 20 20
Light reflection BRDF Bi-directional Reflectance Distribution Function Obr. Wojciech Matusik 21 21
BRDF Formal definition Bidirectional Reflectance Distribution Function outgoing n L i (ω i ) L r (ω o ) dω i reflected θ o θ i incoming f r ( ω ω ) i o = L i dlr ( ωo) ( ω ) cosθ dω i i i [sr 1 ] 22
Surface appearance and the BRDF Appearance BRDF lobe (for four different viewing directions) Souce: Ngan et al. Experimental analysis of BRDF models, http://people.csail.mit.edu/addy/research/brdf/ 23
Surface appearance and the BRDF Appearance BRDF lobe (for four different viewing directions) Souce: Ngan et al. Experimental analysis of BRDF models, http://people.csail.mit.edu/addy/research/brdf/ 24
Surface appearance and the BRDF Appearance BRDF lobe (for four different viewing directions) Souce: Ngan et al. Experimental analysis of BRDF models, http://people.csail.mit.edu/addy/research/brdf/ 25
Surface appearance and the BRDF Appearance BRDF lobe (for four different viewing directions) Souce: Ngan et al. Experimental analysis of BRDF models, http://people.csail.mit.edu/addy/research/brdf/ 26
Reflection equation Total reflected radiance: integrate contributions of incident radiance, weighted by the BRDF, over the hemisphere L r ( x, ω ) o = L H ( x) i ( x, ω ) i f r ( x, ω ω ) cosθ dω i o i i upper hemisphere over x n L i (x, ω i ) L r (x, ω o ) θ o θ i dω i CG III (NPGR010) - J. Křivánek 2015
But where does the incident radiance come from? Other surfaces in the scene! Rendering Equation x L(r(x,ω i ), ω i ) 28 ω i ω o L i (x,ω i ) 28 + = ) ( i i o i i i o o e o o d cos ), ( ) ),, (r( ), ( ), ( x x x x x H f r L L L ω θ ω ω ω ω ω ω
Recursive calculation of rendering equation To calculate L(x, ω o ) I need to calculate L(r(x, ω ), ω ) for all directions ω around the point x. For the calculation of each L(r(x, ω ), ω ) I need to do the same thing recursively At each step, apply Monte Carlo integration to sample the hemisphere etc. r( r(x,ω ), ω ) ω o x ω ω r(x, ω ) 29
Monte Carlo integration General approach to numerical evaluation of integrals f(x) Integral: Monte Carlo estimate of I: p(x) x 1 0 x 5 x 3 x 4 x 2 x 6 1 Correct on average : 30
Slide credit: Iwan Kawrakov 31
Rendering equation Operator form L = L e + T L L = L e + T L L: Equilibrium radiance L e : Emitted radiance T: Transport & scattering operator 32
Progressive approximation Each application of T corresponds to one step of reflection & light propagation L + TL + 2 + 3 + e e e e = L T L T L... emission direct illumination OpenGL shading one-bounce indirect illumination two-bounce indirect illumination 33
Progressive approximation L e T L e T T Le T T T Le L e L + 2 3 e T L e L e + TLe + T L L e e +... +T Le 34
Idea: Distributed ray tracing (Cook 84) 35
Path tracing 36
Path tracing, Naive getli (x, ω): y = traceray(x, ω) return Le(y, ω) + Lr (y, ω) // emitted radiance // reflected radiance Lr(y, ω): ω = genuniformrandomdir( n(y) ) return getli (y, ω ) * brdf(y, ω, ω ) * dot(ω, n(y)) * 2π 37
Path tracing, Naive getli (x, ω): y = traceray(x, ω) return Le(y, ω) + Lr (y, ω) // emitted radiance // reflected radiance Lr(y, ω): ω = genuniformrandomdir( n(y) ) return getli (y, ω ) * brdf(y, ω, ω ) * dot(ω, n(y)) * 2π 38
Practical formulas for light transport P. Dutré: Global Illumination Compendium, http://people.cs.kuleuven.be/~philip.dutre/gi/ 39
ROBUST GI CALCULATION
Path sampling techniques Path tracing Light tracing Bidirectional path tracing 41
All possible bidirectional techniques vertex on a light sub-path vertex on en eye subpath 42
All possible bidirectional techniques vertex on a light sub-path vertex on en eye subpath no single techniques importance samples all the terms VPLs 43
Bidirectional path tracing Use all of the above sampling techniques Combine using Multiple Importance Sampling 44
BPT Implementation 45
Results Images: Eric Veach BPT, 25 samples per pixel PT, 56 samples per pixel 46
Insufficient path sampling techniques Reference solution Bidirectional path tracing 47
Insufficient path sampling techniques In BPT, Specular-Diffuse-Specular paths sampled with zero (or very small) probability specular S diffuse D 48
PHOTON MAPPING (DENSITY ESTIMATION)
Photon mapping (Density estimation) 1. Many fwd walks + store collisions ( photon map ) 2. Radiance estimate: (Kernel) density estimation 50
Photon mapping 1. Photon tracing Photon emission Particle tracing Storage in the photon map 2. Rendering with photon map Like path tracing Photon map query instead of recursion 51
Photon mapping SDS paths H.W.Jensen Wojciech Jarosz 52
Our work: Vertex Connection and Merging BPT + PM combination
54 Bidirectional path tracing (30 min)
55 Photon mapping (Density estimation) (30 min)
56 Vertex connection and merging (30 min)
THANK YOU! Questions? [cgg.mff.cuni.cz/~jaroslav]