Skip to main content
gamedev.net
🔒 Locked

Shadow Volumes

Started by Maitrek Jul 5, 2000 at 12:15 AM 4 replies 500+ views
Original Post
Maitrek
Maitrek
Erg - more shadow problems. Whilst using a dual pass z-buffer method may be an excellent idea for software, and has so many variations and optimisations possible, I am struggling to find a fast method of doing shadow volumes for hardware. It''s quite easy to simply test if a polygon is inside a shadow volume (generated by taking a pyramid shape and projecting it from the light source so that it fits the edges of the polygon casting shadows) and then clip the regions that are in shadow. This seems like it can hardly be done effectively in hardware so are there any other extremely solid methods of doing it - or should I stick with shadow volumes before I tear my hair out?
Ingenu
Ingenu
Check out nvidia dev site.
They have a nice article and demo about projected textures shadows.

You render the scene from le light POV, then use the ZBuffer as a texture.
Project the texture to any object behind the one generating it.

(Basically this is somethign like that.)

I''m still looking for a good and efficient way to do real time shadows...

Any idea ?

-* So many things to do, so few time to spend *-
-* So many things to do, so little time to spend. *-
Shinkage
Shinkage
The other method I''ve seen to do real-time shadows using hardware acceleration is the one that comes as a sample with the DirectX SDK. Involves using the stencil buffer to mask off shadowed areas.
Eric
Eric
If you''re interested in using a stencil-buff, check out this article:

Real-time Shadow Casting Using Shadow Volumes

It''s basically the same idea used in the SDK''s shadow-volume example, but it''s more efficient. I implemented it a coupla'' weeks ago for my game and it worked fine, but then I decided to go a different route (the texture method Ingenu described). This was because, to get a stencil-buff, you need a 32-bit z-buffer, which means you almost always need 32-bit color, and overall that nearly halved my frame-rate compared to 16-bit color & z-buffer. Also, VooDoo3''s are still pretty common and they don''t support stencil-buffs. Still, it was very easy to implement and it looked great.
Maitrek
Maitrek
Hrm - so Ingenu - you are saying that they are allowing u to do dual pass z-buffer shadows with certain hardware (more or less) now?
Does the stencil buffer work in the hardware device or not - or is it a software emulated thing? DX isn''t exactly my forte let alone stencil buffers.
Ingenu
Ingenu
In fact you have to setup multiple matrices to render the world from the light POV.
Copy the ZBuffer in memory.
Change the matrices and rerender the world from the camera POV.
Use the preceding texture to render projected shadows.

2 passes and much T I think.
Well I''ve not tried to implement it since I think it''s not good to do much T.

Stencil is in hardware.
It''s very fast.
You have some basic stencil setups you use to achieve the effects you have in mind.
Check OpenGL.org, there must be some things about that.


-* So many things to do, so little time to spend. *-
-* So many things to do, so little time to spend. *-

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.