APOCALYX is a...

free Game Engine based on OpenGL (MAIL) (SITE) (FORUM) (BLOG)

Sunday, July 13, 2008

Shadow Volumes

Latest improvements in Mushroom's Ride: finally the shadow volumes applied to static meshes are rendered correctly, as you can see in the screenshot (one of the fairies is partially covered by the shadow of the cube).

However the performances are not the best yet, in fact the shadow volumes are applied on a per-triangle basis. This means that for each triangle enlighted by the sun, other three triangles are rendered on the stencil buffer, triangles that extend to infinite, so become particularly large at certain angles.
A better way to implement the technique is to find the outline of the shadow, given by the edges in common between two triangles, one enlighted and one shadowed. In this case the number of faces is reduced a lot. It's not difficult to apply the technique on static meshes, but is more difficult when applied to different animated model formats. Since APOCALYX does not implement his own format, but supports a lot of them, it's necessary to write specific code for each one. Implementing one shadow volume per triangle is simpler, but performances degrade rapidly when the models are not low-poly.

No comments: