Jump to content
  • Advertisement
Sign in to follow this  
Coluna

Testing for zPass - ray-cube intersection problem

This topic is 4811 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 there; To select a shadow volume technique, i do a ray test (camera position->light position) against the mesh AABB...if the ray intersects, so i use zFail...but due to the near plane is not at 0, i have some artifacts when the light is "almost" behind the mesh, so the near plane is cut by the shadow volume...how do i correct this? Thanks

Share this post


Link to post
Share on other sites
Advertisement
A good question.

I would guess that calculating the exact cases for which the volume intersects the near plane is not an efficient solution.

Instead, you could check for the obvious cases where the shadow volume definately can't intersect the clip plane. For example, you could give every moderately complex object a bounding volume, and then for each object calculate the distance of the volume from the near plane, and the distance of the light. If the light's closer, then you can use the depth pass method. Otherwise, use depth fail.

EDIT: And you can then extend this to cull entire volumes if they're behind the camera.

You'll have to experiment to see what works best in your case, though. I guess it depends on the geometry of the scene and the target hardware.

Share this post


Link to post
Share on other sites
I don't think there's any straightforward way to correct it except to construct a square cone with its base on the near plane and its tip at the light source. Using the separating axis method this requires at most 32 axes to be tested (but it's early out) if you're testing against an AABB. Not sure how expensive that'd work out in practice but it's certainly accurate.

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!