To finish this chapter with a cool demo, let's discuss how to animate characters or 3D models, in general.
If you remember, each vertex of a 3D model is computed to be projected on the screen by a vertex shader. In fact, the animated 3D models (such as a character) are also animated with the associated hierarchy of bones (the hierarchy is called Skeleton). Animated 3D models are also called Skinned Meshes. In 3D engines, the bones are invisible nodes that are animated (BABYLON.Animation
) to be sent to the vertex shader associated with the 3D model. In other words, the transformation of each bone is sent to the vertex shader and is applied to the associated vertices.
To go further in the theory, the vertex shader contains the following two additional buffers:
- The bones' matrices weights (Vector4, represents the intensity of the influence of each bone on the current vertex).
- The bones' matrices indices (Vector4, until four bone...