Sign in to follow this  
TheQuixotiC

Picking on Animated Meshes

Recommended Posts

TheQuixotiC    142
How can I get the mesh from skinned mesh to use in D3DXIntersect method ? or How can I pick the model loaded with D3DXLoadMeshHierarchyFromX? If you have any sample about this,Please do not hesitate to write :) I need your help. Thanks in advance.

Share this post


Link to post
Share on other sites
Jiia    592
neneboricua19 seems to have some kind of advanced inverse ray system that works. The only way I know to correctly cast a ray into a skinned mesh is to pose the vertices in system memory and do it the normal way.

In my game, I use static meshes posed with the bones to do this and sphere collision. It's not totally accurate around seams, but it's extremely fast. With static meshes, you can definitely use the inverse ray technique.

Share this post


Link to post
Share on other sites
neneboricua19    634
What I was refferring to in that other thread was that if you want to do *exact* picking on a skinned mesh, you pretty much have to perform software skinning on the vertices. That is not very efficient. So a better way to do it would be to have a hierarchy of bounding volumes for the mesh.

Depending on what kind of mesh you're dealing with, you can choose the bounding volume to use. For a humanoid mesh, I think the best choice would be an Object Oriented Bounding Box. Each of the major parts of the mesh could have a bounding box on it: head, arms, legs, and torso. You perform your picking against these 6 bounding boxes instead of the whole mesh.

Since the mesh is skinned, you have to transform these bounding boxes by the matrices that effect the joints of each major body part. So for the head, you need create a matrix that is a combination of the skinning matrices that affect how the head moves around. This matrix is what transforms your bounding box into model space. Concatenate this matrix with the world space matrix for the mesh and then take the inverse of this new matrix. The resulting inverse matrix is what you use to transform your picking ray. You can then use this ray to perform an intersection test against your bounding box.

I can't really give you code to do this because it is not trivial. You may be using a different model format and it is up to you (or really your artist) to decide which vertices affect the major parts of the mesh so that you know which skinning matrices look at when transforming your bounding volume. I've never seen a tutorial or sample application that implements picking on skinned meshes because of the amount of work involved.

Perhaps there are more "hacky" ways of doing it that may be a bit less accuracte but simpler to implement.

neneboricua

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