Ambient occlusion: done!

I’ve programmed the routine to compute a texture storing the ambient occlusion of a given mesh. The result is as expected: great! (see the screenshots).

The computing process can take a while, had to throw a lot of rays per texel to get an accurate result. 512 is a good number. So for a 256*256 texture, you have at least 33 million rays thrown. When I say at least, it’s because if a given texel is shared by two faces of the mesh (across the edge), the double are thrown.

Thanks to the opcode library, it doesn’t take forever…
I’ll certainly add an option to filter the produced picture (useful when the ray count is low).


The mesh (courtesy of Bruno Dosso) is 12592 triangles and 6424 vertices.

Computed on a Athlon XP 2800+. You can see the render time in the texture’s window caption.

Basic rendering, no diffuse texture, no ambient occlusion texture.

Diffuse Texture, without Ambient Occlusion


256*256 occlusion map, 16bits, 1024 rays per texel.

Same as left, with a diffuse texture.

The computed Ambient Occlusion Texture, done in 2min27sec.

Leave a Reply