Generating LODs using MeshOptimizer
Earlier in this chapter, in the Implementing a geometry conversion tool recipe, we talked about preprocessing a mesh so that we can store it in a runtime efficient data format. One important part of the preprocessing pipeline is optimizing geometry and generating simplified meshes for real-time discrete LOD algorithms that we might want to use later. Let's learn how to generate simplified meshes using the MeshOptimizer library.
Getting ready
It is recommended that you revisit the Introducing MeshOptimizer recipe from Chapter 2, Using Essential Libraries. The complete source code for this recipe can be found in Chapter5/MeshConvert
.
How to do it...
We are going to add a processLODs()
function to our MeshConverter tool so that we can generate all of the necessary LOD meshes for a specified set of indices and vertices. Let's go through this function step by step to learn how to do it:
- The LOD meshes are represented as a...