In a previous post I described the problems associated with mesh simplification with a multi-textured mesh and how this wasn’t proving to be a good solution to simplifying distant objects.
I came across this excellent library today MIConvexHull which has some excellent and fast c# routines for finding the convex hull of a 3D shape, also with useful libraries for triangulation of point clouds.
Hulls as Shadow Casters
My intention initially was to use a Hull of any mesh during the shadow drawing phase of my scene. To recap – when you draw a shadow casting object you actually have to render your entire scene twice, once to store the distance from the light source of each pixel in the scene, then again with the actual objects, but calculating the difference in distance from the camera by using the previously stored bitmap. Its complex, but for the purposes of this post its enough to re-iterate that this means each shadow casting object needs to be rendered twice for each scene.
Without being able to simplify my meshes I wanted to use the Hull of my objects (typically trees and houses) during the shadow casting draw phase to cut down on the cost of drawing their shadows. If I could draw just a solid Hull shape, this would be good enough for tree and building shadows.
This picture shows the hulls artificially rendered over the top of the meshes to show the effect I was after. The shadows are a bit vague in this shot, but they are there,
Here again, but for houses.
Above; expensive shadows generated from full meshes
Above; cheap shadows generated from hull meshes, showing the hulls as well.
A nice speed boost to my shadow rendering code.