CGG   Radiosity in JaGrLib    Gallery

General radiosity has got a good support in JaGrLib, but it's composite from system of many interfaces and modules. That's the reason why was created this user manual.

Basic components

Scene representation

Radiosity belongs to the finite element methods so the input geometry of scene must be composite from the primitives such as triangles, quadrilaterals or convex polygons. All these elements are stored in B-rep (boundary representation) which is described by interface Brep. Concrete implementation of interface Brep is class VEFDS (vertices, edges, faces, divisions and solids). General mode supports even simple polygons as faces. There are two ways how can be gained geometry.

First way is to simply load some file which describes everything what we need (vertices, faces, color - reflectance). JaGrLib supports OBJ files by module OBJFileFormat. However, there is still one problem. Usual OBJ files aren't designate for rendering by radiosity method so they haven't got such attribute as emission. After the loading there are no light sources (element with some unshoot energy). Remains only one option, user have to this set attribute manually, but this could be a big problem in the complex scenes.

Second possibility is procedural generating of some scene. For example the famous Cornell box could be generated by module CornellBox. This approach has got several advantages:

Of course there is only few scenes, which can be generated by this way.

System of linear equations

General system of linear equations is represented by interface SLEData. In addition, there is exist some expansion - interface SLEDataStore which bears a support of set* functions. Implementation of SLE for radiosity purpose is module RadiosityEquations. This module isn't actually saving SLE, instead it serves as a encasement of data for the solver.

Most of images are colored so the SLE system in the library has to support multiple SLEs. This support is realized by simple switching (variable mode establish actual color mode).

Form factors

General interface for representation of form factor is RadiosityBasisFunctions. It was designed only for constant basis functions.

There is only one single module, which is implementing interface RadiosityBasisFunctions - MonteCarloFF. It is obvious that this module using Monte Carlo methods for form factor computation.

Intersection between Brep scene and ray is provided by interface Solid. The simplest way is to use plain module, which doesn't use some specialized geometric search data structures. Absence of this acceleration cause that computation could be really slow (especially for scenes with more than couple of elements). Perhaps each radiosity application in JaGrLib use some geometric search data structure (GSDS), which is connected to the module, which handling intersection. Example of GSDS in JaGrLib is UniformGrid.

Still, there is exist one other accelerating technique - caching, which can also offer expressive acceleration as well as usage of GSDS. Final acceler. results depends on the circumstances (e.g. how many iterations/steps does solving, which method is used, ..). This technique also consume a lot of computing memory, therefore it's need to be prepared for the possibility, that could be cached only part of the matrix (SLE) and the rest will have to be computed again. That is the reason why there are used two caches (but only one can work in the same time). First cache cache the whole SLE so it's used only if there is enough memory (strictly speaking, enough rows to cache). Instead the second option is to use row cache, which is intended for complex scenes with huge SLE. In this case, there are cached only the most occured rows. However, there is one case, which is pretty common, and in which should be cached the whole SLE matrix (at least in the ideal case). By this I mean colored images, which needs three SLE matrices with same form factors. Without caching, the time of computation will approximately increase three times in compare with the case with single color.


All SLE solvers works on-the-fly so the memory requirements are minimal. Common description of solver is get by interface SLESolver. There are several implementation of the interface SLESolver:

All these modules (except SuperShootGather) supports over-relaxation technique, which can rapidly increase the speed of convergence. In addition, module SLEProgressive can use so called ambient term, which can increase final image quality in some parts of the scene.

The accuracy of solution is measured by maximal residual.


The main module, which takes control of the whole illumination computation, is Radiosity which implements interface GlobalIllumination.

Modul Radiosity sets some important variables, which affect solving of the SLE. Also it has got big influence to the rendering.

Global illumination worker

Radiosity application has got theirs own worker - GlobalIlluminationWorker. This modul sets some very important things:

[Image/video gallery]  [JaGrLib HOWTO]  [JaGrLib home-page]  [CGG at MFF UK]

Valid XHTML 1.1 Copyright (C) 2007-2009 J.Pelikán, last change: $Date: 2013-11-22 23:47:16 +0100 (Fri, 22 Nov 2013) $
Send comments/requests to