Bending by joints
So as i wrote in my last post (http://jonas.svegland.se/how-to-curve-meshes-by-a-shader) I currently exploring how to bend meshes by a spline, i.e. Beziér curve. I was struggling with getting the control points of the Bezér into the correct space to offset the vertices.
It’s not optimal to do these calculations in a vertex shader and with also having problems with spaces I changed approach.
One way to animate a mesh is to do it by rigging and skinning a mesh. Rigging a mesh is when you build the “skeleton”/bones a the mesh and skinning is when you assign different vertices to the corresponding bones.
This approach can be used in my current situation. I asked one of the artist at Station to rigg and skin a mesh for me. I then built this solution in which if offset every bone from start to end with the corresponding calculated Beziér value from start to end. This makes the skin (surface of the mesh) follow the bones.
The draw back of this approach is that hardware instanced skinned meshes isn’t currently supported in Unity 3D which is needed for the current project. There are some ways to make it work, but right now I need to focus on some other parts of the project at Station.
Here you can read more about solutions to hardware instance skinned meshes: https://blogs.unity3d.com/2018/04/16/animation-instancing-instancing-for-skinnedmeshrenderer
Here’s the current result
Resultatet och problemet med instanciering