Skeletons and bounding boxes

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
Hrenli
Halfling
Posts: 73
Joined: Tue Jun 14, 2016 12:26 pm
x 15

Skeletons and bounding boxes

Post by Hrenli » Fri Aug 16, 2019 4:07 pm

I've run into a small issue with bounding boxes of animated items in 2.1. In short, the problem seems to be in the fact that Ogre (at least by default in 2.1) doesn't update bounding boxes of skeletally animated meshes/items. It is reproducible just by running ImportAnimationsShareSkeletonInstance sample for example, if you move the camera away so binding pose of the head mesh is out of the screen:

Image

Looking through the forums I found the discussion of that exact problem quite some time ago (viewtopic.php?f=2&t=79312) which ended up in a PR (https://bitbucket.org/sinbad/ogre/pull- ... boxes/diff) which was supposed to solve it.

But either I am blind or that functionality did not make it into 2.1. In my exact case I think I can easily solve it by just making AABBs bigger to cover enough space for all possible skeletal transformations. But is it how it is supposed to be done or there is a better way? :)
0 x

xissburg
Halfling
Posts: 70
Joined: Sun Feb 21, 2010 4:58 pm
x 14

Re: Skeletons and bounding boxes

Post by xissburg » Fri Aug 16, 2019 4:54 pm

I have also noticed that problem. If you move the root bone of an object for example the bounding box stays where the scene node is and thus the object gets frustum culled as you move the camera. The PR you mentioned is in Ogre v1 so I'm not sure that made its way into v2.
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4066
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 228
Contact:

Re: Skeletons and bounding boxes

Post by dark_sylinc » Sat Sep 14, 2019 10:59 pm

Hi!

I can't remember what happened with the PR in v1 skeletons in 2.1+
I do know v2 skeletons do not have this feature.

The way the PR fixed it was rather simple, but works: Think of it as attaching a couple spheres to a few important bones (e.g. the ones that will move a lot, like hands, feet and head in a human body); then compute the AABB that contains all of these spheres (after the spheres have been transformed).

But instead of attaching an actual sphere, just retrieve the derived position of the bone and that becomes the center of the sphere.
Because this technique is not exact, it is up to the user to ensure the radius is large enough.

Should be easy enough to code.
1 x

Post Reply