Jump to content
  • Advertisement
Sign in to follow this  
Unfadable

Tightest sphere around a view frustum

This topic is 3608 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 would like to get the tightest bounding sphere around my view frustum. My naive implementation finds center point (view position + (view direction * (far plane - near plane) / 2.f) and gets the vector from the far plane corner to that point. It seems like there's a lot of wastage there, since the radius would shoots way beyond the near plane corner. Would the tightest sphere be constructed from a point that is equidistant from all corners? Thanks,

Share this post


Link to post
Share on other sites
Advertisement
Not necessarily. If the FOV is wide enough (it actually doesn't need to be that wide, our game's camera falls into this category), then the minimal bounding sphere won't touch the corners on the near plane. The simplest explanation of how to find the sphere is covered briefly in ShaderX6 article 'Stable Rendering of Cascaded Shadow Maps'. The basic idea is to pick four points that form a maximal cross-section (two opposite corners from the near plane, the corresponding corners from the far plane). Then find the minimal circle that encloses those four points in 2D, and finally extrude that into a sphere in 3D. Sample code for the minimal enclosing circle (in 2D) is much easier to find than the corresponding 3D problems.

Share this post


Link to post
Share on other sites
Quote:
Original post by osmanb
Sample code for the minimal enclosing circle (in 2D) is much easier to find than the corresponding 3D problems.


I have implementations for both at my Containment web page. For minimum circle in 2D, look at Wm4ContCircle2.{h,cpp}. For minimum sphere in 3D, look at Wm4ContSphere3.{h,cpp}.

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!