Extracting skinnedmesh posed mesh in r159

I have a skinned mesh as a gltf and I am updating skeleton bones after I import. I add this to the scene and it renders the mesh correctly in the pose I set.

I need to do post processing on the mesh, but when I do this step on the skinned mesh, it uses the skeleton transforms on the mesh, which I do not want. I’d like to “bake” the skinned mesh to a mesh.

I see there are several discussions/PRs, etc related to this, most leading to a few basic implementations for raycasting, etc or leading to comments related to performance. I need to do this baking once, not per frame, so performance is not a concern for me.

How do I go about baking the skinned mesh pose to a mesh?

I think my first issue is that I am trying to get information about the transformations before everything is pushed to the GPU, i.e. before I render. After rendering a frame I do see that the skeleton.boneMatrices array has useful values.

You can use the method getVertexPosition() on your skinned mesh which will give you the position of the vertex for the given index. The implementation will honor the current animation state (morph + skinning) so it would be ideal if you want to bake an animated state.

2 Likes

yes, that’s what I was missing. Thanks!