+ All Categories
Home > Documents > Pre-computed Radiance Transfer

Pre-computed Radiance Transfer

Date post: 05-Jan-2016
Category:
Upload: sef
View: 32 times
Download: 0 times
Share this document with a friend
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
Popular Tags:
35
Pre-computed Radiance Transfer Allen Chen
Transcript
Page 1: Pre-computed Radiance Transfer

Pre-computed Radiance Transfer

Allen Chen

Page 2: Pre-computed Radiance Transfer

Outlines

• Traditional GI solutions and problems• Spherical harmonics• Pre-computed radiance transfer• Per-pixel PRT implementation• Performance analysis

Page 3: Pre-computed Radiance Transfer

Global Illumination

• Ray tracing• Radiosity• Precomputed radiance transfer

Page 4: Pre-computed 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

Page 5: Pre-computed Radiance Transfer

Ray Tracing

• Physically accurate lighting model• Hard shadows and mirror-like reflections• Much slower compared to other algorithms

Page 6: Pre-computed Radiance Transfer

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

Page 7: Pre-computed Radiance Transfer

Radiosity

• Soft shadows and diffuse inter-reflections• Preprocessing the geometries is required• Large computational and storage costs

Page 8: Pre-computed Radiance Transfer

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

Page 9: Pre-computed Radiance Transfer

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

Page 10: Pre-computed Radiance Transfer

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

Page 11: Pre-computed Radiance Transfer

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 )()(

Page 12: Pre-computed Radiance Transfer

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

Page 13: Pre-computed Radiance Transfer

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

Page 14: Pre-computed Radiance Transfer
Page 15: Pre-computed Radiance Transfer

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

Page 16: Pre-computed Radiance Transfer

Diffuse Shadowed Per-vertex Transfer

Wireframe mode

Page 17: Pre-computed Radiance Transfer

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

Page 18: Pre-computed Radiance Transfer

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

Page 19: Pre-computed Radiance Transfer

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

Page 20: Pre-computed Radiance Transfer

Visualize a floating point coefficient textureOnly the values in red channel are displayed

Page 21: Pre-computed Radiance Transfer

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;

}

Page 22: Pre-computed Radiance Transfer

Rendering ArtifactNotice the black border of the box

Page 23: Pre-computed Radiance Transfer

Rendering Artifact

• Current sample value is the average value of its neighbor pixels

• Fill the neighbor pixels if they are illegal

Page 24: Pre-computed Radiance Transfer

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

Page 25: Pre-computed Radiance Transfer

Shading Quality

• Ray = 256, Texture Size = 256x256x4, Band = 4

Page 26: Pre-computed Radiance Transfer

Shading Quality

• Ray = 625, Texture Size = 256x256x4, Band = 4

Page 27: Pre-computed Radiance Transfer

Shading Quality

• Ray = 625, Texture Size = 256x256x8, Band = 5

Page 28: Pre-computed Radiance Transfer

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)

Page 29: Pre-computed Radiance Transfer

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

Page 30: Pre-computed Radiance Transfer
Page 31: Pre-computed Radiance Transfer

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

Page 32: Pre-computed Radiance Transfer

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

Page 33: Pre-computed Radiance Transfer

Diffuse Shadowed Transfer

Page 34: Pre-computed Radiance Transfer

Diffuse Indirect Transfer

Page 35: Pre-computed Radiance Transfer

Q & A


Recommended