Precomputed Radiance Transfer using our engine

November 9, 2008
Normal OpenGL lighting
Rendering with simple ambient occlusion
Precomputed Radiance Transfer

I implemented a demo of Precomputed Radiance Transfer using our engine.

In a few words, this is a technique to make very cool self-shadowing by soft shadows under dynamic lighting. (Actually it's possible to go much further, see the papers about PRT linked from my README). You can see the screenshots on the right: 1st shows normal OpenGL lighting (without PRT), 2nd shows the simple ambient occlusion per-vertex (this is, in some sense, a special case of PRT), and the 3rd screenshot shows PRT technique in all it's glory.

The full source code is available, naturally. Simple instructions:

$ svn checkout http://svn.code.sf.net/p/castle-engine/code/trunk/castle_game_engine/
$ cd castle_game_engine/examples/radiance_transfer
$ ./radiance_transfer_compile.sh
$ ./radiance_transfer models/chinchilla_with_prt.wrl.gz

(Update in 2013: Usually, instead of using these commands, you should just go and download the latest Castle Game Engine release and compile / run the radiance_transfer example there.)

Inside that directory there are also other models ready to test with PRT. There's also precompute_radiance_transfer to process any 3D model (readable by my engine — VRML, X3D, 3DS, Wavefront, Collada...) into a VRML model that can be displayed using radiance_transfer with PRT effects. There's also show_sh program to view 25 first spherical harmonics (this will be useful if you'll want to understand how PRT works :) ).