• Advertisement
Sign in to follow this  

vertex skinning shader with collision detection

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

Hey, I've read a couple of articles on creating a vertex shader to animate a skinned mesh. But one question that hits me is: How can you do collision detection with these meshes? Do you have to do CD in the vertexshader? Cause you don't know the pose of the mesh in the program without applying bone matrices there too, right? Then what's the point using the vertex shader to do this? Maybe someone has a suggestion how to do it the optimal way [smile] Thanks /thehan

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Use special collision meshes/object that don't need to be transformed on the CPU.
What you could do is setup capsules and spheres and boxes, just like you would use physics primitives. Then simply apply the transformation matrix to each collision mesh.

For example you could use a Biped from 3D Studio Max as collision mesh. Then when you fire a bullet and want to check if this bullet hits the character, you can transform the ray of the bullet into space of each collision mesh, and perform ray/triangle tests there (or ray/sphere etc). You can transform the ray into space of the collision mesh using your transformation matrix.

That can also give you a nice hit system, where you can detect headshots etc :)

If you want a character not to be able to walk through walls, use something like a cylinder/capsule that you move with the character, and perform collision on that object with the world.

Alternatively you could provide a skinned collision mesh that is being deformed on the CPU. This would of course be a very low poly mesh.

Cheers,
- John

Share this post


Link to post
Share on other sites
I know the question's already been more or less answered, but I figured I'd point you to a similar thread of mine from a while back. The topic is slightly different (Frustum culling rather than Collision) but the same principles should apply. Also, for a good visual of the "hot-dog man" approach we talk about, you can look at how Unreal Engine 3 handles it's collision bounds. Screenshot

Good luck!

Share this post


Link to post
Share on other sites
Thanks, I really got the picture now [smile]. Sad the forum search is disabled [depressed].

Share this post


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

  • Advertisement