Hey , I am pretty new to three.js so if its trivial sorry.
I am having a morph target mesh which converts from a sphere to a suzanne which I control using the dat.gui by changing the morphInfluence values
The code for that is :
Morph target animation is a form of vertex displacement and normally performed in the vertex shader. If you want to generate a new geometry, you have to implement the GPU code in JavaScript in order to correctly displace vertices according to the defined morph targets and its influence values.
Fortunately, you don’t have to write this code from scratch. You can basically use the code from Mesh.raycast() that performs the displacement for raycasting:
Based on this code, you can generate a new position attribute that you can use to create the geometry for your shape.
Note that this will be slow for larger meshes — both baking the mesh, and then the physics engine will probably need to compute a convex hull for each ‘frame’ in the animation. You likely need to precompute all this before rendering.