Access skinned mesh vertices

Hi,

I want to access the mesh of a skinned mesh - not the shared mesh, but the actually deformed one.

In my particular case I need to get and change the vertex positions and vertex colors, but I can think of some situations where this would be nice to do:

  • snapshotting a mesh to use it for something else (e.g. as new MeshCollider mesh)
  • adding morphs after meshes are skinned

Is skinning done on software or on hardware? If Unity uses hardware skinning, I assume I cannot acccess the vertices as they are only deformed by the graphics card. Then the only way would probably be to write my own software skinning algorithm (and I don't want to do that).

But I read that Unity since 2.5 uses "multithreaded mesh skinning" , and that would mean it is done software-side and is somehow accessible. But how?

I know this is an old question, but I was looking to do something similar and found a good script on the Forum. This code is working for me, although my current mesh and bone setup is fairly simple.

Have a look here:

http://forum.unity3d.com/threads/14378-Raycast-without-colliders

Yes, skinning is performed on the CPU (and multiple skinned meshes are transformed on separate threads to exploit multicore CPUs). However, right now there's no API to access post-skinned meshes.

Would your "extra modifications" be possible to do in a vertex shader? This would not solve "I want to create colliders" problem, but some types of deformations should be possible to do in a shader.