Dynamic Ambient Occlusion, Shadow Fields demos in the engine sources

January 24, 2009
Chinchilla with Dynamic Ambient Occlusion Chinchilla elements used for Dynamic Ambient Occlusion
Peach with Dynamic Ambient Occlusion Shadow Fields screenshot 1
Shadow Fields screenshot 2 Shadow Fields screenshot 3

This week I implemented a demo of Dynamic Ambient Occlusion using our engine.

In related news, last month I also implemented a demo of Shadow Fields. (I forgot to brag about it earlier, so I'm doing it now :) ).

An extremely short summary: both techniques strive to make low-frequency soft shadows (in other words, the kind of shadows you usually see in the Real World) in dynamic 3D environment.

For now, they are just implemented as demos, and are not easily available for non-programmers. You have to actually get the source and compile some example programs to try out this stuff. (Although I think I'll make at least dynamic ambient occlusion available as an easy option inside view3dscene in the future.) The full source code, and example models, are available in SVN, naturally. Simple instructions:

$ svn checkout http://svn.code.sf.net/p/castle-engine/code/trunk/kambi_vrml_game_engine/

$ cd kambi_vrml_game_engine/examples/vrml/shadow_fields
$ ./shadow_fields_compile.sh
$ ./shadow_fields

$ cd ../dynamic_ambient_occlusion
$ ./dynamic_ambient_occlusion_compile.sh
$ ./dynamic_ambient_occlusion models/peach.wrl.gz

There are more sample models in the models subdirectories, and you can test both demos with your own models. Both techniques require highly-tesselated models to make shadows look nice. Shadow fields require preprocessing by included precompute_shadow_field program. Dynamic ambient occlusion doesn't require any preprocessing, but it requires really good GPU (it does ~thousands of texture fetches per pixel in GLSL fragment shader). You can find a lot of notes and links in the README files inside the source directories.

Have fun!