Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Making shadow volumes and making them fast!

This topic is 5885 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

Making good looking real time shadow volumes are not an easy task, but when you have to do them fast it almost becomes impossible! So if you would like to present the optimizations you thought about building shadow volumes, it could be vrey helpful. In my engine, I build a shadow volume for each triangle in the scene (8 triangles to make one volume) and it''s pretty slow. Thus I''m trying to find a way to draw less triangles, but I haven''t found yet. If you have any idea?

Share this post

Link to post
Share on other sites
+ If you have static geometry and static lights, you can precompute your shadow volumes. You can stick bounding boxes around the near/far capping tris for each volume, and test to see if they are visible quickly. If they''re not visible, then you dont need to draw ''em (the capping tris that is).

+ You only need to extrude silhouette triangles for the shadow volume (in most cases..), so I''d setup some functions like
However, there aren''t really any good shortcuts for these functions (that I know of), so shadow volumes tend to be quite slow. (Drawing them is pretty slow anyway..)

+ If you are using OGL and attenuated light sources (like DoomIII), you can use glScissor() to contain rendering to just the area where the shadow is needed (i.e. the area effected by the light source). I expect you can set up a similar thing with D3D using alpha/clip planes/more stencil ops - haven''t really thought about it..

Other things i''d think about is not having self-shadowing on animating/dynamic objects. They''re cool when they are still, but when they (or the light) move, you get a nsty popping effect as the silhouette shifts across triangles. Also, no self shadowing means you can use a lower quality version of the mesh, which again speeds up shadow volume computation.

To be honest, I''ve only really started fidling with shadow volumes, but I may go back to using projected shadows since they''re just a damn sight faster and easier.(if not a "true" lighting solution).

Hope that gave you some ideas,

Share this post

Link to post
Share on other sites
If you are using DirectX, look at nVidia''s or ATI''s samples that involve using vertex shaders to extrude the volumes. I think there are OpenGL equivalents, but I''m not positive.

Also, (forgive the sales pitch - I try to only do so when it directly answers the question), I cover three different shadow methods in Real Time Rendering Tricks and Techniques in DirectX. The shadow volume technique is basically the same as the aforementioned samples, but I tried to provide more explanation than the sample code gives you. You might want to take a look at that.

The shader methods are quite fast. The require the objects to be rendered a couple of different times, but you can speed that up even more by creating optimized (less triangles) versions of the mesh to be used when you create the volumes.

Share this post

Link to post
Share on other sites
I think computing the possible silhouette is the next enhancement I will made.

Then we could compute an octree or a bsp for the shadow volumes...

Ah, shadow volume is so powerful but need so many optimizations to run fast enough.

I wonder if using stencil shadow volume along an older method could improve the framerate while not looking too ugly.

Share this post

Link to post
Share on other sites

  • 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!