Adding morph targets support
In the previous recipe, we loaded the morph target data from glTF. Now, let’s use that data to create a demo application and render morphing meshes.
Getting ready
Be sure to read the previous recipe, Loading glTF morph targets data, to review all the necessary data structures for morph targets.
The source code for this recipe is located in Chapter09/03_Morphing.
How to do it…
To display the results rendered on the screen, we need to enable support for mesh morph targets in our glTF animation player and incorporate this functionality into our compute shader.
- Let’s begin with the rendering code in the
renderGLTF()function. Here’s the complete setup for our compute pass, which was mentioned earlier in the recipe Doing skeletal animations in compute shaders.if (gltf.animated) { buf.cmdUpdateBuffer(gltf.matricesBuffer, 0, gltf.matrices.size() * sizeof(mat4), gltf.matrices...