Jump to content
  • Advertisement
Sign in to follow this  
Chordogg

Confusion in generating shadow volumes

This topic is 4397 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I understand the process for generating a shadow volume. Find all the silhoutte edges of an "object" and extrude those. But what if the object you want to create a shadow volume for is a complete level in a game? Right now my levels are just polygon soups. How do I calculate a shadow volume for that? Or maybe I'm not thinking of this in the right way...Don't the objects have to be convex? Say there's a room...4 walls a ceiling and a floor. Then you have a box in the center suspended in the room and a light right above the box. The light should generate a shadow on the floor. But when the algorithm goes to search for silhoutte edges, it'll search for edges in the box in the room, and the edges in the room itself. That can't be correct can it? How do I make it so the level generates shadows onto itself. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
The object does not have to be convex, but the shadow volume you create has to be closed. In addition, it helps greatly if your mesh is an open manifold (i e, each edge is shared by at most two triangles).

To create shadow volumes for your level, I would suggest keeping an adjacency list parallel to your triangle index list. For each triangle, store the index of the triangles that neighbor that triangle along each edge. When generating silhouettes, you can use this information to do neighbor walks until you find a triangle that's facing away from the light, or that is outside of the light frustum. You then need the outside edges of these connected patches of triangles.

If you have triangle soup, you probably want to pre-process to generate this adjacency information (and weld very close verts to a coincident location).

Share this post


Link to post
Share on other sites
Sounds like a really good idea thanks! I think that would work really well for static lights that don't move so I can just precalculate the shadow volumes. I'm wondering how to make this run fast with lights that move. I like the neighbor walk idea, I'll have to try that out.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!