I’m facing an issue when trying to export a morphed mesh. I am applying morph target influences to a mesh and it updates correctly in the scene. However, when I export the mesh using STLExport.CreateSTL, the resulting STL file only contains the base mesh, not the updated mesh after morphing.
Here’s a brief overview of what I’m doing:
Loading a mesh.
Applying morph target influences to the mesh.
Exporting the mesh using STLExport.CreateSTL.
Despite the mesh appearing correctly morphed in the scene, the exported STL file does not reflect these changes and only includes the base mesh.
It makes sense for the morph to no be applied to the STL since morph deformation is something that is applied in the shaders and do not change the actual vertex data in the CPU.
To have the morph changes applied to your mesh you mush first update the CPU vertex with the modified vertex. I have updated you example showing how to do that. In this case I’m applying the change to the same mesh, but you could also use the position data to create a new one:
Thanks for the solution. I checked the playground link and understand the approach.
However, I’m using an older version of Babylon.js where the mesh.getPositionData() method is not available. How can I achieve the updated vertex positions after applying the morph targets and skeleton in this older version?