Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

SDyer

Bounding Sphere Too Big

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

For some of my meshes, D3DXComputeBoundingSphere returns a sphere that is grossly too big and not centered correctly. Sometimes it comes out ok - on some simple cube meshes, for example. The meshes were created in MilkShape3D and exported to .x format. I actually create a sphere mesh based on the bounding sphere center/radius data, so I can see them. Has anyone encountered this problem before?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Haven''t seen this. Is your mesh centered around the origin? It may be that it has to be (that''s usually a good idea, anyway).

Share this post


Link to post
Share on other sites
The meshes are not all centered around the origin. Is there a reason they must be? Is it standard practice?

In Milkshape, I don''t think there''s a way, when you''re done with a model, to tell it to center the whole thing around the origin.

Share this post


Link to post
Share on other sites
Hmm... just eneble the axes in milkshape, and move it to the center. If it''s not centered, the bounding sphere may be and make the radius extend from the origin to your model. I hope that makes sense.

-~-The Cow of Darkness-~-

Share this post


Link to post
Share on other sites
I''ve done some experimenting since I first posted.

1) I created a sphere in Milkshape and tested it both centered and uncentered. The bounding sphere came out fine each time. The sphere is about 80x80, and D3DXComputeBoundingSphere returns a radius of about 41 - a good fit.

2) I then added a small cylinder at the top of the sphere - about 5 or 10% of the total height (the model looked a bit like a christmas ornament). The bounding sphere for this model, whether centered or not, was much bigger than it needed to be. This model is about 80x90 - only slightly bigger, but D3DXComputeBoundingSphere now gives a radius of 65.

What gives?

Share this post


Link to post
Share on other sites
the radius is getting bigger simply becuz the model is getting larger...if u have a sphere with some radius...its bounding sphere will be nice...but add a stick to this sphere and the radius of the bounding sphere must be big enough to completely encircle the entire object...for some objects that are narrow or long in one direction it is better to use bounding boxes

Share this post


Link to post
Share on other sites
Yes, the sphere should get bigger. But the problem is that it is getting too big, and it is not centered properly.

I''m wondering if there is something wrong with the .x file exporter from Milkshape or something. Perhaps some stray vertex or normal or something is throwing the bounding sphere calculations off. I don''t know. It''s making me mad.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
if your models are static the whole game why dont'' you just calculate the boudnign sphere in milkshape when u make the model? make a sphere and then delete it after you write down its properties

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
SDyer, i had the same problem. the sphere was always ~10% larger than what i thought it should be. and even the sphere center was incorrect. there are different types of bounding spheres so maybe the one they calculate is different than the one i''m used to. what i ended up doing was creating a bounding sphere based upon the min/max returned from the bounding box function, which i''ve never had a problem with.

Share this post


Link to post
Share on other sites
Can''t you calculate your own sphere? It''s quite easy. First you find the center of the mesh by finding the min/max values for x/y/z then halving each. Then you find the vertex that is farthest away from that point, and the distance from the center to that point should be your radius. Right? Am I missing something?

Share this post


Link to post
Share on other sites

  • 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!