Practical sessions
You may try out the following exercises to get a deeper insight into rendering multiple instances of glTF models:
- Enable the dynamic addition of new instances. While the addition of a new instance to the
std::vector
array is easy, the buffer sizes require more attention. You need to check for a sufficient size and re-create or adjust the GPU buffers. - Add more than one model per instance on the screen when using GPU-instanced rendering. You could calculate the joint matrices and dual quaternions normally but add multiple
GltfInstance
models with the same buffer data while altering the world position and rotation values. This addition would create a much larger crowd with the same amount of CPU load. Think of thousands or tens of thousands of models jumping on the screen. Due to the spacing between the models sharing the animation clip and animation replay speed, the crowd will still look random. - Medium difficulty: Add both the non-instanced and instanced...