# Tightest sphere around a view frustum

This topic is 3663 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 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 on other sites
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 on other sites
Quote:
 Original post by osmanbSample 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}.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5
khawk
11

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633677
• Total Posts
3013282
×