Jump to content
  • Advertisement
Sign in to follow this  

shadow volumes question

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

Hi all, i got a working code for Depth pass and Depth fail algorithm , but what i wonder now , is to determine if a camera Eye point is in shadow in order to determine if i use the depth pass technique or the depth fail , are there anyone else who have implemented that ? How to fast and accurately determine if the eye is in the shadow volume of an object ? thanx in advance for your help...

Share this post

Link to post
Share on other sites
Simple answer:
You don't!

Long answer:
It would take a very long time determine that!
I know people that have tried using a BSP to find out, the problem is that the CPU doesn't calculate things in the exakt way as the GPU clipping is performed, thus if your method isn't fairly conservative you get some false answers (the answer on the CPU is correct, but since the GPU calculate and round things off differently they still doesn't agree).

The concept I use is to determine if the objects projected bounding volume (BV) intersects the near quad (NQ), the quad made up by the points you get from intersection the near plane and the side planes.
Please note that you could either project the BV along the light direction and range OR project the NQ in the opposite direction and range.

For directional lights you could expand your NQ towards the light (infinity), giving you a frustum (a volume of space defined by 5 planes), this is done once per frame (camera position).
Then you test your objects BVs against this frustum, if they intersect it the eyepoint is considered inside the volume.
For a quick and dirty test, just test each plane and if the BV is infront of the plane the object doesn't intersect.
This is a conservative method, i.e you get some false positives but it's very quick, at most 5 plane/BV tests per object. Using frame coherency (storing the plane order per object), you get about 1 plane/BV for objects that doesn't intersect (wich are the most common case) and 5 plane/BV for objects that does intersect.

For point-lights it's not as easy but the concept of either stretching the objects BV or the NQ in respect to the light and then do an overlap test is still valid.

My 2c

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!