# 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.

## 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 on other sites
You don't!

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

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631781
• Total Posts
3002314
×