Handout 22

Radiosity*


Introduction

The radiosity method is a partial solution to the global illumination problem, aimed at solving interreflections between diffuse surfaces within a closed environment. The method does not address the problems with diffuse-specular, specular-diffuse or specular-specular interreflections. The original graphics of the spectral space rendering from Cornell University using a true radiosity algorithm is here.

Overview of the radiosity method

A central concept of the radiosity method is patches, which are rectangular areas that emit and receive radiosity from other patches, thus simulating light interaction.
The environment's geometry is divided into patches. Patches, which are not light sources, initially have zero intensity, while patches that are light-sources is set to an initial amount of energy, depending on the intensity of the light-source.

The goal is to calculate the amount of radiation each patch receives from the environment, as this is an estimate of the diffuse light intensity. This is done iteratively, by calculating radiosity at all patches until the maximal energy amount radiated is under a certain threshold. Termination is assured by the fact, that an amount of the received radiated energy is absorbed at each interaction.

The radiative interaction between patches has to take several things into account: distance, angle and the areas of the patches, and furthermore any intervening patches also effect the solution. These problems are adressed by Form Factors. Form Factors describes the fraction of radiation that leaves a patch and arrives at any other patch.

The radiosity method produces a view-independent solution, as the calculated radiosity intensities are only affected by geometry and the positions of light sources.

A screenshot from the implementation, notice the color bleeding on the boxes.

Rendered cornell box theme


Some assumptions about Patches

Patches are rectangular areas, which are assumed to have the same radiosity over all their area. Also, patchs are assumed to be a perfectly diffuse Lambertian surfaces (Lambertian = perfectly flat), so no subsurface scattering of the light takes place (perfect diffuse = reflects incomming radiosity equal in all directions).

The patches are constructed based on the scene's geometry. The accuracy of the solution is largely influcenced by the granularity of the patches, more patches yield a better solution, but also increases the calculation time. Solutions for adaptive subdivision of patches exists. These algorithms subdivide patches into smaller patches in areas where the radiosity changes drastically, for example in shadow boundaries. This gives a comparably better solution with less performance impact, compared to just settting the granularity of the whole scene higher.

In the examplehere triangles were used as patches, despite their definition as rectangular:

Rendered scene

The radiosity of a patch is the total amount of energy leaving the patch, which is equal to the sum of received radiation and the radiation emitted.

Form Factors

The Form Factor Fij of two areas (patches) Ai and Aj is the fraction of radiation leaving Ai that reaches Aj:

$ F_{ij} = \frac{Radative\ energy\ reaching\ A_{j}\ from\ A_{i}}
{Total\ radiative\ energy\ leaving\ A_{i}\ in\ all\ directions}$
The Form Factor is calculated from radiation interaction between infinitesmal surfaces, yielding the equation:

$ F_{ij} = \frac{1}{A_{i}} \int_{A_{i}} \int_{A_{j}}
\frac{\cos\phi_{i}\cos\phi_{j}}{\pi r^2 } dA_{j}dA_{i}$

Additional detail on form factors is here.

A double integral is rather difficult to calculate analytically for generic geometry, and therefore another approach to solving the above equation is nescessary. A solution is to use a hemicube.

Usage of the hemicube in Form Factor determination

The hemicube Form Factor is an efficient but approximative solution to Form Factor determination. The justification of the hemicube is easiest seen from the below picture

Patch A, B and C have the same area
Patchs A and B has the same area when projected to the hemisphere (both project to area C). The double integral above is an integration over a hemisphere. Finding the area on a sphere is more difficult than just simply finding the area of a quad, hence the use of a hemicube

The hemicube is placed centered on the patch, oriented so that the top of the hemicube is orthogonal to the patch's normal vector, see below.

Position of the hemicube on patch
The hemicubes five faces are divided into small elements, termed "pixels". To determine Form Factors between two patches Pi and Pj, first all patches are projected onto the hemicube.
Projection onto hemicube
Then the Form Factor is calculated by summing the areas of all the pixels patch Pj has hit. The Form Factor Fij is equal to this area. The projection also solves the problem with intervening patches elegantly (assuming the use of a Z-buffer):

Intervening patch
The area of each pixel, termed "delta form factor" is calculated this way:

Delta Form Factor
For the top of the hemicube:

$ \Delta F_{q} = \frac{\cos \phi_{i} \cos \phi_{j}}{\pi r^{2}} \Delta A$
For the sides:

$ \Delta F_{q} = \frac{z}{\pi{(y^{2}+z^{2}+1)}^{2}} \Delta A$
The calculation of Form Factors is done for each patch in turn. Notice that the calculation of Form Factors only depends on the geometry/the patches, so changes in light sources color and position (to another patch) will not demand a new calculation of Form Factors (but a new solution of the radiosity matrix will have to be calculated, see below).

Implementation note: An easy way to test the calculated Form Factors is, that the sum of all the Form Factors at a given patch must equal one:

$ \sum_{k=1}^{n} F_{ik} = 1 \qquad for\ i = 1\ to\ n $
The Radiosity algorithm

To recap, the radiosity Bi of a patch Pi is the sum of emitted radiosity and the radiosity received from other patches:

$ B_{i}dA_{i} = E_{i}dA_{i} + \rho_{i} \int_{j} B_{j}dA_{j}F_{dA_{j}dA_{i}}$
Discretizing this yields

$ B_{i}A_{i} = E_{i}A_{i} + \rho_{i} \sum_{j=1}^{n} B_{j}F_{ji}A_{j}$
Since

$ F_{ij}A_{i} = F_{ji}A_{j} \iff F_{ij} = F_{ji} \frac{A_{j}}{A_{i}}$
gives us the basic radiosity relationship

$ B_{i} = E_{i} + \rho_{i} \sum_{j=1}^{n}B_{j}F_{ij}$
which can be expressed in a matrix as:

\begin{displaymath}
\par\left[
\begin{array}{cccc}
1-\rho_{1}F_{11} & -\rho_{1}...
..._{1} \\
E_{2} \\
\vdots \\
E_{n} \\
\end{array}\right]
\par\end{displaymath}

A solution of the matrix has to be done for each wavelength - in the case of RGB this means for red, green and blue values. The solution is reached by solving the matrix iteratively until the maximal radiation interchanged by two patches is below a certain threshold. Since Ρ is less than one (which means that the patch absorbs some of the radiation), the total amount of radiation is decreased each iteration, ensuring termination of the iteration.

Radiosity vs. Ray Tracing

Implementations

LightScale Arnold radvis Rayfront


* sources include here, here, here, here.