Jump to content
  • Advertisement
Sign in to follow this  
TheQuixotiC

Picking with Skinned Meshes

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

when I load an .x file with D3DXLoadMeshFromX,it can be picked,but when I use D3DXLoadMeshHierarchyFromX function,error occurs.How can I pick a skinned mesh? Can you give any sample code ? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Yes, you can pick a skinned mesh in the same general way you pick a non-skinned mesh. What kind of errors are you getting? What does the debug spew say? Where is your picking failing?

You can pick a skinned mesh in the same way you pick a non-skinned mesh. You do this by transforming your ray by the inverse of the skinning matrix for each subpart of your mesh.

neneboricua

Share this post


Link to post
Share on other sites
Quote:
Original post by neneboricua19
You can pick a skinned mesh in the same way you pick a non-skinned mesh. You do this by transforming your ray by the inverse of the skinning matrix for each subpart of your mesh.

Are you sure you would want to do that? A single polygon could usually be influenced by 12 matrices. But that's with 4 states per vertex. I don't think it's possible to create an inverse matrix for the ray that would compensate for such a radical change.

I use shader-skinning only, so I couldn't afford to scan vertices. What I did for my engine was create a dumby mesh for each bone. What I called a Mimic Mesh. The mimic parts were not skinned. They just fit around the skin parts as closely as possible. To check against each bone, you apply the inverse matrix of that bone to the ray. This way the mimic mesh never needs updated or animated. There are still accuracy errors around the blended areas.

Share this post


Link to post
Share on other sites
I used D3DXIntersect method for static (non animated) mesh,but for animated meshes,I could not use that method.
I created the sphere (using D3DXFrameCalculateBoundingSphere) to pick the animated skinned mesh.But the radius of sphere is so big,I can select the mesh from far away.Is there a better technique to pick the animated mesh?

Share this post


Link to post
Share on other sites
Quote:
Original post by Jiia
Quote:
Original post by neneboricua19
You can pick a skinned mesh in the same way you pick a non-skinned mesh. You do this by transforming your ray by the inverse of the skinning matrix for each subpart of your mesh.

Are you sure you would want to do that? A single polygon could usually be influenced by 12 matrices. But that's with 4 states per vertex. I don't think it's possible to create an inverse matrix for the ray that would compensate for such a radical change.

You can do it, but it's not the most efficient thing in the world at all. But the user was asking if it was possible. And since he didn't specify that a close approximation of of picking was good enough, I had to assume that he wanted to do exact picking.
Quote:
TheQuixotiC
I used D3DXIntersect method for static (non animated) mesh,but for animated meshes,I could not use that method.
I created the sphere (using D3DXFrameCalculateBoundingSphere) to pick the animated skinned mesh.But the radius of sphere is so big,I can select the mesh from far away.Is there a better technique to pick the animated mesh?

You could try to create a bounding volume around the major parts of your skinned mesh. For example, if the mesh is a human, you could have a bounding volume around the head, torso, arms, and legs. Then you could try to pick agains those by calculating the inverse matrix of the main joint in question. For example, for the arm, you could calculate the inverse matrix for the shoulder joint and use that to pick against the arm.

neneboricua

Share this post


Link to post
Share on other sites
Quote:
Original post by neneboricua19
Quote:
Original post by Jiia
Quote:
Original post by neneboricua19
You can pick a skinned mesh in the same way you pick a non-skinned mesh. You do this by transforming your ray by the inverse of the skinning matrix for each subpart of your mesh.

Are you sure you would want to do that? A single polygon could usually be influenced by 12 matrices. But that's with 4 states per vertex. I don't think it's possible to create an inverse matrix for the ray that would compensate for such a radical change.

You can do it, but it's not the most efficient thing in the world at all. But the user was asking if it was possible. And since he didn't specify that a close approximation of of picking was good enough, I had to assume that he wanted to do exact picking.

I really don't think it's possible. I would be interested in understanding how this can be done. I don't see how a single matrix can make the ray relative to polygons that are transformed by up to 4 matrices per vertex. If you have a polygon that is only influenced by a single bone, then the job is easy. Otherwise, the only option that comes to me is to calculate the world space of the polygon.

Share this post


Link to post
Share on other sites
Quote:
Original post by Jiia
Otherwise, the only option that comes to me is to calculate the world space of the polygon.

Yup. No one ever said it was efficient. But it can be done. :)

This where bounding volume hierarchy's *really* save your butt.

neneboricua

Share this post


Link to post
Share on other sites
Sign in to follow this  

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