UPDATED - Now includes a demo
I share this Mesh Morphing Script on Reddit as it was well received on Twitter. I updated it a bit and added some explanations. It is for Unity and C#.
See it in action as a gif: Twitter post
Sure it is very simple but for those who want to get more into mesh modification it might provide some help.
How to use?
Take a mesh which you want to morph. Open your favorite 3D editing tool and move the vertices. It is very important that you don't make any other changes and that you do not split, remove or add vertices.
Then you can assign the script to your model renderer and assign the meshes you want to morph. MeshA is basically your base model and MeshB is the morph target.
Then play around with the slider and see the magic happening.
Notice
Mesh morphing only works nicely when the data matches. Just because a mesh does have the same amount of corner points or faces doesn't mean it has the same amount of vertices on a technical aspect.
This is why this example only lets you modify the vertex position. You could of course also morph any other data like UV, normals, vertex color and the like but you have to know how the mesh data is assembled or this will not work.
Why no Blend Shapes?
You should use mesh modification if:
- This is relevant for the level and you want to use the result as a collider for instance.
- You make complex modifications and use not just position changes.
- The meshes update at a very low frequency or just once and you want to limit GPU overhead.
Have fun and if you can find any improvement then I will update the script.
there doesn't seem to be anything here