Sign in to follow this  

Circular problem mounting meshes on skeletons

Recommended Posts

Gumgo    968
Culling out rigged meshes doesn't seem that difficult - just construct a bounding box for the mesh that encloses all animations that might occur, and don't draw the mesh if the bounding box isn't in the viewport (or use some other culling method). But mounted objects seem more difficult because they shouldn't be included as part of the same bounding box of the mesh that is attached to the skeleton (because they are completely different objects). Take, for example, a character holding a sword and riding a horse. To find how to transform all these objects, you'd find the transformation of the character by computing the matrices of the animation of the horse, then find the transformation of the sword by computing the matrices of the animation of the character. Since these are technically 3 separate objects, they should have their own bounding boxes. The sword (for example) should only be drawn if its bounding box is on the screen because it is expensive to multiply all the matrices required to find its transformation. However, in order to find its transformation to determine whether the bounding box is on the screen, the animation's matrices must be computed (or at least, the ones on the "direct path" to the sword)! Currently I don't have mounting implemented. What I do right now is I store animation instructions for each skeleton (eg. apply run animation, apply sword thrust animation). When I sort objects for rendering, I clump all meshes rigged to one skeleton together. This way, I can calculate the skeleton pose once for each skeleton when rendering, but if none of them are on the screen, I can just skip that skeleton. This makes it so I don't have to store a local copy of the current pose along with each skeleton object, but it also means I compute the skeleton at render time, right before it needs to be drawn, so I don't have access to the matrices. What other techniques are commonly used, and how is the mounting problem solved/approached? Thanks.

Share this post

Link to post
Share on other sites
karwosts    840
Are you sure you really need such fine grained culling? How often is it that you need to render a sword, but that the person who is holding it is completely off the screen?

I'm not sure if there are any "common techniques" for dealing with this, as I can't imagine it is that big of a performance issue. A couple ideas quickly come to mind though:

1) Have a second frustum that is some percentage larger than the viewport. Compute the matrices for everything in this window, and then test all of the rotated objects against your real frustum.

2) Enlarge the bounding box for the "base" units so that they are large enough to encompass anything that would be mounted on it.

3) Just enlarge your culling window by a small percentage.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this