Ambient occlusion proof of concept demo in libigl

Alec Jacobson

October 08, 2013

weblog/

The libigl "extra" for the Embree ray tracing library made it super easy to whip up an ambient occlusion demo. Check out the example in the libigl source under libigl/examples/ambient-occlusion (version ≥0.3.3).

beast ambient occlusion in libigl

The demo just shoots rays in random directions in the hemisphere of each mesh vertex and aggregates a hit ratio. Then it colors the mesh with these values per-vertex using GL_COLOR_MATERIAL. The program shoots a few more rays per point every draw frame (except when the users dragging the camera around).

There are plenty of ways to be fancier about ambient occlusion, but this demonstrates the basic idea.