Upload
sef
View
38
Download
0
Tags:
Embed Size (px)
DESCRIPTION
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. - PowerPoint PPT Presentation
Citation preview
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
jiA A
ji
iij dAdA
rAF
i j
2
coscos1
ijjiii FBEB
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
dsxxVxxGdxLddxRdxLdxL e )',()',(),'(),,(),(),(
dsddxTdxLdxLdxL e ),,(),'(),(),(
d
d
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
)',()',()',( xxVxxGxxT
)',()',(),,(),,( xxVxxGddxRddxT
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
)cos,sinsin,cos(sin),,( zyxs
]),0[,(
0
0
0
),(cos
),(cos)sin(2
),(cos)cos(2
00
lmRl
m
m
m
PK
PmK
PmK
y
ll
ml
ml
ml
ml
ml
)1( lliyB mli
Spherical Harmonics
• Integrating the product of sphericalfunction and basis functions generatescoefficients
• Combining scaled basis functions produces original function
• Combining band-limited basis functionsproduces approximation of original function
0
)(i
iiBcsf
n
iiiBcsf
0
~
)(
dxxBxfc nn )()(
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
2
0
~~
)()(n
iiisbadssbsa
))(()())(()(~~
sRfsgsRfsg
Transfer Functions
• Lambert light model - BRDF as a const value
• Diffuse unshadowed transfer function
• Diffuse shadowed transfer function
dsxxVxxGdxLx
xLxL elambert )',()',(),'(
)()()(
)',( xxGT DU
)',()',( xxVxxGT DS
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 coefficients to 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 inany triangle in UVW space
• Save 16 coefficients (4 bands) into RGBA16F Depth4 texture
Visualize a floating point coefficient textureOnly the values in red channel are displayed
PPPRT Pixel Shaderfloat4 main(VS_INPUT IN){
float4 color = float4(0, 0, 0, 0);float4 coeff[4];for(int i = 0; i < 4; i++){
// sample the coefficient from volume texturecoeff[i] = tex3D(shSampler, IN.shCoord[i]);
}// dot product with light coefficient to get final irradiancecolor += dot(coeff[0], lightCoeff0);color += dot(coeff[1], lightCoeff1);color += dot(coeff[2], lightCoeff2);color += dot(coeff[3], lightCoeff3);
return color;
}
Rendering ArtifactNotice 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 vectors as 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
Diffuse Shadowed Transfer
Diffuse Indirect Transfer
Q & A