280 likes | 371 Views
Precomputation aided GI on the GPU. László Szirmay-Kalos. GI: light path generation . image. Virtual world. Path precomputation. Entry point. Exit point. Transfer factors: T ( y , i x, o ). Entry point y. Entry dir i. Exit dir o. Exit Point x.
E N D
Precomputation aided GI on the GPU László Szirmay-Kalos
GI: light path generation image Virtual world
Path precomputation Entry point Exit point
Transfer factors: T(y,i x,o) Entry point y Entry dir i Exit dir o Exit Point x
Having the Transfer factors L(x,o) = S Lin(y,wi) T(y,ix,o) dwidy • Directional lights or Image Based Lighting: • Linis independent of y • Diffuse surfaces: L(x,o) = Lin(wi) S T(y,ix,o) dydwi= = Lin(wi) Tenv(ix,o) dwi L(x) = S Lin(y) T(y,ix) dwidy
Problems • Exit points: • Vertices of a highly tessellated mesh • Points corresponding to texel centers • Entry points: • Vertices of a highly tessellated mesh • Sampled randomly • No problem if directional lights or environment lighting • Exit directions: • no problem if the scene is diffuse • T is a 4-variate (8-dimensional) function: • how to store? • Simplification: diffuse surfaces + environment lighting requires just 2 variate functions
Storing the Transfer factors • Finite element representation • Pros: compact, good for low frequency illumination • Cons: costly to update • Sampling + interpolation • Pros: easier to update, good for high frequency illumination • Cons: not as compact
Finite-element representation Tenv(ix) T x(i) = NTn bn()
How to computeTm • Find an adjoint basis function set: bn(w) b*m(w) dw = 1 if m=n, and 0 otherwise T x(i) = NTn bn()// multiply by b*m() T x()b*m(w)dw = NTnbn()b*m(w)dw = Tm Monte Carlo integration
Monte Carlo preprocess i L b*n(wi) p(i, y,path) 1 K Tn += y x Number of samples
Precomputed Radiance Transfer (Sloan02) • Transfer factors for directional illumination • Express directional illumination with adjoint basis functions • Thanks to orthogonality, the exit radiance is: • It requires N rgb transfer factors at each exit points Lin(w) N Ln b*n() L(x) = Lin(wi) Tenv(ix) dwi = NLnb*n(i)NTmbm(i)dwi =NLn Tn
Principal ComponentAnalysis • M is the mean of the dataset • Bs are the eigenvectors corresponding to the largest eigenvalues of the covariance matrix: (Tm-M)T (Tm-M)
PRT results 1 bounce preproc: 12 sec 5 bounce preproc: 172 sec Run time: 466 FPS
Sampling approach to precomputation aided GI • No finite-element representation • Entry-exit point samples are stored directly • Comparison to PRT: • It is easy to update • It does not assume low frequency environment map • Particularly good for point lights that can be close
Preprocessing: Entry points Random sampling
Preprocessing: Transfer from entry to exit points entry point with unit irradiance
Preprocessing: Reference point illumination unit irrad Virtual lights
Precomputed Radiance Map Item: (entry, exit, irrad) unit irrad irrad transfer
PRM: 4D array Exit point Texcoord: (u,v) Entry point: r, g, b PRM item
Implementation CPU GPU Entry point sampling and Photon tracing Exit point illumination computation PRMs in textures Preprocessing Shadow mapping: Direct illum + Entry point visibility Camera rendering: Direct illum + PRM weighting Image Real-time rendering
Tile in a single or few textures PRMs in textures: Tiling u u Exit point Exit point v v r, g, b r, g, b Etc. Pane of Entry point 1 Pane of Entry point 2
Entry point clustering u u Exit point Exit point r, g, b r, g, b v v Pane of Entry point 2 Pane of Entry point 1 Close and have similar normals
Resulting cluster u Exit point Pane of Entry point Cluster 1 r, g, b v
Results 4096 entry points 256 – 32 clusters: 128 – 4Mb texture memory Preproc: 5 minutes Rendering: 40 FPS
Results: Room with stairs 16K entries 32 clusters 4Mb per obj 50 FPS