Moving Animation Calculations from CPU to GPU
Welcome to Chapter 2! In the previous chapter, we explored the steps to load and animate a 3D model by using Open Assimp Import Library, or Assimp for short. The resulting application can render a large number of model instances. But, depending on your processor type and speed, the computational part for the model matrices becomes dominant quite fast. As a consequence, we are no longer able to reach 60 frames per second in the application.
In this chapter, we move the matrix calculations to compute shaders, running entirely on the GPU. We start with a short history of methods to do computations that are independent of the main code of the application, and the growth of parallelism in CPUs and GPUs. Next, we examine the current state of the matrix calculations. Then, we create a plan for what we should move to a compute shader, and how this relocation could be accomplished. As the last step, we check the results of the relocation and...