Shadow Volumes

Shadow Volumes

Re: Shadow Volumes Posted by omegaslayer on Thu Feb 24th 2011 at 5:46am
omegaslayer
2481 posts
Posted 2011-02-24 5:46am
2481 posts 595 snarkmarks Registered: Jan 16th 2004 Occupation: Sr. DevOPS Engineer Location: Seattle, WA
Hello fellas,

I have a question to propose to you (maybe even this is the wrong community - but this place has always surprised me), but do any of you have experience with shadow volume techniques for making shadows. Its not the concept that I dont get, its finding the edges to extrude to create the volume. I mean I guess I could check against every edge in a mesh, but when meshes are 500+ polygons, that could be a problem. Anyone have any special technique they can think of?

PS: in openGL is preferable, but directX I could handle.
Re: Shadow Volumes Posted by Crono on Thu Feb 24th 2011 at 9:11am
Crono
6628 posts
Posted 2011-02-24 9:11am
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
You have to write it in a shader language. So you could use Cg (nvidia's shader language, runs on nvidia and AMD cards) or GLSL (Open GL standard shader language) The only shader language tied to an API is HLSL, which is Microsoft's shader language.

You're going to have to learn a little bit about making profiles and such ... but yeah, it's not really possible to do at a OGL level, you have to do it in a shader ... or in GPU ASM.

You can look at these places for some help:
http://developer.nvidia.com/object/doc_shadows.html
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch11.html
http://www.gamedev.net/topic/553524-glsl-simple-shadow-volume/

It looks like all their examples are on cards that are no older than the GF8 (or equivalent) generation. Since they're using a geometry shader.

Shadow volumes aren't exactly simple to implement.

As far as I know, shadow maps are far easier to implement (but don't look as nice) ... there are also plenty of documented hybrid algorithms that use shadow volume techniques to get the shadow edges, but then use shadow maps techniques to fill them in. Turns out something far more efficient. http://people.csail.mit.edu/ericchan/papers/smapSV/

Anyway, it's complicated stuff.

(As for specifically, how you get the edges of all the objects ... that's what the stencil buffer is for)
Blame it on Microsoft, God does.