View Full Version : Shadow Volumes?
06-09-2010, 08:03 AM
I'm trying to implement shadows using this technique but one thing I'm having trouble finding is how to create a shadow volume. I use glutSolidSphere to create my spheres and I want to use them to cast shadows.
Is there a way to get all the polygons in model space that I created with glutSolidSphere and calculate shadow volumes for each?
06-09-2010, 12:15 PM
Not that I know of. glutSolid* calls are kind of like magic boxes where you feed the params in and get the calls back out. You need to build your sphere by hand.
One possible option, which may work (not sure) is since you're just using spheres is to just extrude a cone based on the sphere center, radius, and the point light and not look for the real border. If you use a high-enough resolution of sphere and high-enough resolution cone extrusion, you can probably get away with it.
06-10-2010, 05:09 AM
I'm trying to implement shadows using this technique but one thing I'm having trouble finding is how to create a shadow volume.
Yeah, as strattonbrazil said, it's not easy to use black box draw functions for shadow volume extrusion.
If you do CPU-side shadow volume extrusion, you need be able to extract what's termed the object's "silhouette" edges in light space so that you can extrude these edges to form the sides of the shadow volume. If you don't have the geometry, kinda hard to get the silhouette edges.
If you do GPU-side shadow volume extrusion, it doesn't quite solve your problem either because you still need access to the original mesh. With this, you insert a degenerate quad for each edge in your water-tight mesh, and then you do "light facing" tests on the GPU to determine which degenerate edges to extrude to form the shadow volume sides.
In either case, you can't really start with a "black-box" mesh-draw method because you either need to pick through the edges or make some modifications to the geometry that's sent down to generate that shadow volume.
But maybe someone else has another technique to offer...
06-10-2010, 01:38 PM
I think I'm going to try the idea of extruding a cone as I'm only working with spheres. I obviously know the size of each sphere as well as it's centre and the position of the light source. The examples I've seen of shadow volumes usually use some sort of quad as a shadow volume from every face so will it work with a cone from the silhouette?
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.