Precomputed radiance transfer

Advanced Global Illumination Project

Petr Minarik, Jiri Formanek


We want to render demo scenes using spherical harmonics (SH) for transfer and lighting functions approximation. Our main objective is to use several different transfer functions. The most advance of them is one with diffuse reflections, soft shadows and also interreflections (see images below).

Our main tasks are:

1) Precomputation of lighting - we want to use several types of lights (clear sky, overcast, cloudy model etc.)
2) Precomputed radiance transfer (PRT) for given geometry (diffuse, diffuse with shadows, with shadows and interreflections)
3) Putting it together to render stunning images in real-time!!!

Here are some examples which we want to reach:

We are solving main problems together and subtasks individually.

Jiri is interested in spherical harmonics algorithms, so he is working on implementation of basic SH functions and computing and precomputing algorithms for SH. Next he is implementing various lighting models to be used in the scene. He has written diffuse transfer function too.

Some example problems to be solved by Jiri
a) Computation of SH basis functions
b) Calculate various lighting models (spherical, cone, directional, overcast, clear sky) to SH space
c) Implementation of diffuse transfer function
d) Forcing hardware shaders to execute up to 4 order approximation of light equation (with color material)
e) Creating of demo scenes

Petr is working on the rendering framework where all alghoritms will be used. We decided to use Peter's 3D editor KWorld, where our project is implemented as a plugin. Using of PRT requires to implement some special advancements of current algorithms, ie. it is needed to handle special precomputed data, PRT simulator, special render loop etc.

Some example problems to be solved by Petr
a) Stable, fast and useful rendering environment
b) Caching of precomputed data
c) KDTree optimized PRT computation
d) Implementation of diffuse shadowed transfer function
e) Implementation of diffuse shadowed transfer function

Optional tasks: adding specular reflectance which depends on camera


You can download binaries of KWorld editor with plugins for SH and PRT, KWSphericalHarmonics library and some sample scenes here (2.3 MB).

The source code of particular packages is below:

KWSphericalHarmonics library (25 kB)
SH Object plugin for SH basis testing (3 kB)
PRT plugin for simulation (21 kB)

Our results

1) SH basis functions visualization

The very important part of our project was to generate SH basis function. To ensure that functions are computed correctly, we wrote plug-in which visualizes function of an arbitrary order. Basis functions are showed like unit sphere where each vertex represents one sample. The value of the SH function is then distance from the center of the sphere. The negative values are showed in red and positive ones in green.

2) Ray intersection using KD-tree segmentation

It should be used to fast find of intersections and intersected faces. Although this algorithm was much faster than common ones, the implementation from DirectX libraries was even faster.

3) Diffuse transfer function without shadowing

The simplest way to lit object is to precompute diffuse transfer function. The result seems to be very similar to common dot product model, but there is a big advantage in exploitation of non-point lights.

The pattern

Our scene lit with directional light

The precomputation of such scene lasts several seconds then user can move the camera or change lighting in real-time. If any object is transformed, its coefficients have to be computed again.

4) Diffuse transfer function with shadowing

This model assumes ability to cast rays in direction of samples. If the ray hits the object, the contribution from this direction is not considered.

The pattern

Our scene lit with directional light

The precomputation lasts about 30 seconds in this case. Then user can move the camera or change lights in the scene. If any object is transformed, its and surrounding objects' coefficients have to be computed again.

5) Diffuse transfer function with interreflections

The most advanced case use the previous one as a starting point. The second pass works with ray casting again, but in this case we want to a point of intersection with its barycentric coordinates. The interpolated SH coefficients are then added to current vertex. The color bleeding can be seen on the cup and on the walls as well.

The pattern

Our scene lit with directional light

Note: Demos on these pages require Windows system with installed DirectX 9.0c (Redistributable for developers August 2005). KWorld requires .NET Framework 2.0.

References: Our main source of knowledge is papers which deal with spherical harmonics for lighting. Here are some of them:

1. Robin Green:
"Spherical Harmonic Lighting: The Gritty Details"

2. Peter-Pike Sloan, Jan Kautz, John Snyder:
"Precomputed Radiance Transfer for Real-Time Rendering in Dynamic, Low-Frequency Lighting Environments"

3. A. W. Kristensen, T. Akenine-Moller, H. W. Jenses:
"Precomputed Local Radiance Transfer for Real-Time Lighting Design"

4. Stanislav Darula, Richard Kittler:

5. Peter-Pike Sloan, Jan Kautz, and John Snyder:
Precomputed radiance transfer for real-time rendering in dynamic, low-frequency lighting environments. ACM Transactions on Graphics, 21(3):527536, 2002.

6. Ren Ng, Ravi Ramamoorthi, and Pat Hanrahan:
All-Frequency Shadows Using Non-linear Wavelet Lighting Approximation. ACM Transactions on Graphics, 22(3):376381, 2003.

7. Peter-Pike Sloan _ Ben Luna . John Snyder:
Local, Deformable Precomputed Radiance Transfer


Last updated 22.12. 2005