350 likes | 590 Views
Pre-computed Radiance Transfer. Allen Chen. Outlines. Traditional GI solutions and problems Spherical harmonics Pre-computed radiance transfer Per-pixel PRT implementation Performance analysis. Global Illumination. Ray tracing Radiosity Precomputed radiance transfer. Ray Tracing.
E N D
Pre-computed Radiance Transfer Allen Chen
Outlines • Traditional GI solutions and problems • Spherical harmonics • Pre-computed radiance transfer • Per-pixel PRT implementation • Performance analysis
Global Illumination • Ray tracing • Radiosity • Precomputed radiance transfer
Ray Tracing • Cast ray from camera to pixel center • Generate shadow rays towards all light sources • Generate secondary rays until the ray leaves the scene
Ray Tracing • Physically accurate lighting model • Hard shadows and mirror-like reflections • Much slower compared to other algorithms
Radiosity • Transfer of radiant energy between surfaces • Radiosity equation describes the amount of energy emitting from a surface, can be used as final intensity of the light • Form factor describes the fraction of energy leaving one surface that reaches a second surface
Radiosity • Soft shadows and diffuse inter-reflections • Preprocessing the geometries is required • Large computational and storage costs
Recomputed Radiance Transfer • Render equation • Represent as a light source function and a pre-computable transfer function • Light source function describes the fraction of the incident light at point x from direction that has been emitted from a light source • Transfer function describes how light arriving at the point x is transformed into irradiance in direction
Recomputed Radiance Transfer • Depending on the light model used, T can be expressed as a spherical function • For view-independent light models, T can be approximated by SH coefficients • For view-dependent light models, T can be approximated by SH transfer matrix
Spherical Harmonics • Basis functions in spherical polar coordinates • Represented by associated Legendre polynomials • A total of l(l+1) polynomials in a l-th band series
Spherical Harmonics • Integrating the product of spherical function and basis functions generates coefficients • Combining scaled basis functions produces original function • Combining band-limited basis functions produces approximation of original function
Spherical Harmonics Properties • Integrating two band-limited functions is the same as calculating the dot product of their coefficients • Arbitrary rotation for the original function implies the same rotation for band-limited function
Transfer Functions • Lambert light model - BRDF as a const value • Diffuse unshadowed transfer function • Diffuse shadowed transfer function
Per-Vertex PRT • Pre-compute diffuse shadowed transfer function in offline tool • Cast rays in upper hemisphere of each vertex into the scene • Calculate geometry and visibility terms from each ray • Project the result onto SH basis and store coefficient as vertex component • Reconstruct rendering equation with light coefficient in application
Diffuse Shadowed Per-vertex Transfer Wireframe mode
Per-Vertex PRT • Pros • Easy to implement • No hardware limitation (gouraud shading) • Cons • Shading quality depends on mesh topology • Require re-computation if any position change on any of the models in the scene
Per-Pixel PRT • Similar idea with lightmap to store luminance information into texture • Require additional unwrapped UV for each affected models • Store pre-computed coefficientsto the texture • Use floating point volume texture since each pixel has n coefficients
Per-Pixel PRT • Can be slow as the calculation now is in pixel level • Mark legal pixel beforehand to reduce the calculation • Check whether the pixel located in any triangle in UVW space • Save 16 coefficients (4 bands) into RGBA16F Depth4 texture
Visualize a floating point coefficient texture Only the values in red channel are displayed
Rendering Artifact Notice the black border of the box
Rendering Artifact • Current sample value is the average value of its neighbor pixels • Fill the neighbor pixels if they are illegal
Shading Quality • Primary parameters affecting the shading quality • More ray count, more accurate integral result • More SH bands, better approximation of the transfer function • Larger texture size, more shading details • Increase any of these parameters result in more pre-computing and storage cost
Shading Quality • Ray = 256, Texture Size = 256x256x4, Band = 4
Shading Quality • Ray = 625, Texture Size = 256x256x4, Band = 4
Shading Quality • Ray = 625, Texture Size = 256x256x8, Band = 5
Integration with Normal Map • Half-life2 basis vectorsas normals in pre-computing step • Decouple pre-computing transfer function from pixel normal information • More data need to be stored (3 copies of coefficients per pixel)
Per-Pixel PRT • Pros • Decouple shading quality from model topology • More accurate result compared to PVPRT • Cons • Require floating point and volume texture format • Large storage(VRam) cost even without considering normalmap • VRam bandwidth can be the bottleneck easily
Future Work • Use bounding volume tree to accelerate pre-computing step • Further compress the texture data • Research transfer matrix to take BRDF into account • Diffuse indirect lighting
Diffuse Indirect Lighting • Accumulate the diffuse color from closest triangle of ray intersection in Monte Carlo sampling step • Store the coefficients and color information for each vertex or pixel • Color bleeding effect as commonly seen in radiosity