150 likes | 311 Views
Indire c t Diffuse and Glossy Illumination on the GPU. István Lazányi László Szirmay-Kalos TU Budapest. Environment mapping. for ideal reflections. [Blinn & Newel, 1976]. Environment map = Fast approximation of environmental effects. Environment mapping. for ideal reflections. (original).
E N D
Indirect Diffuse and Glossy Illumination on the GPU István LazányiLászló Szirmay-KalosTU Budapest
Environment mapping for ideal reflections [Blinn & Newel, 1976] Environment map = Fast approximation of environmental effects
Environment mapping for ideal reflections (original) If the environment is very (or infinitely) far… skybox (enlarged)
Environment mapping for ideal reflections If the environment is "close"… re-render environment map from the new reference point performance ?!
Environment mapping for ideal reflections Note: (classic) environment mapping cannot deal with "large" objects storing depth information in the environment map ray-traced [Approximate Ray-Tracing…, Eurographics 2005]
Offline convolution: preconvolved diffuse/specular map Environment mapping for diffuse & glossy reflections - classical Ideal reflection vs. indirect illumination: many sampling raysare necessary! Adding cosine-weighted contributions: = convolution
Environment mapping for diffuse & glossy reflections – our proposal • Take an environment map • (with depth info. in the alpha channel) 2. Evaluate the convolution integral on the fly where Δωi (i=1..N) corresponds to the texels of the environment mapωi = ? from a point x
Environment mapping for diffuse & glossy reflections – our proposal For the reference point: solid angles Δωican easily be calculated (no information is necessary about the environment! )
Environment mapping for diffuse & glossy reflections – our proposal For an arbitrary point x: to calculate solid angle Δωi distance r’ is known but cosθ’ is unknown Instead of storing orientation information about the environment, assume that the movement is small cosine value is approx. the same as in the reference point
How about the bunny …? ? Environment mapping for diffuse & glossy reflections – our proposal Thus, localization means multiplying solid angle with a factor for each texel precalculation of the convolution integral is not possible
Environment mapping for diffuse & glossy reflections – our proposal To allow real-time calculation the environment map is downsampled by averaging neighboring texels. (e.g. 128 x 128 4 x 4) ≈ clustering the texels of the environment into larger area lights
Results(Diffuse bunny) classical our proposal (75FPS @ 2x2, 20FPS @ 4x4)
Results(Glossy bunny, s=10) classical our proposal
Implementation //Illumination formula for N,V,L L = L / |L|; float a = kd * max(dot(N,L),0) (or texture lookup) float4 Lin = texCUBE(LREnvMap, I); float r = texCUBE(LREnvMap, I).a; float3 L = r * I – pos ; float r’ = length(L); float dw = dw_texel * r2 / r’2 return Lin * a * dw;