Implementing a material system
Chapter 6 provided an overview of the PBR shading model and included all the necessary GLSL shaders for rendering a single 3D object with multiple textures. In this chapter, we focus on how to organize scene rendering with multiple objects, each having different materials and properties. Our scene material system uses the same GLTFMaterialDataGPU
structure from shared/UtilsGLTF.h
and is compatible with our glTF 2.0 rendering code. However, to simplify the understanding of the code flow, we will focus on the scene representation and won’t delve into parsing all the material properties again.
Getting ready
In the previous chapters, we focused on rendering individual objects and applying a PBR shading model to them. In the recipe Using data-oriented design for a scene graph, we learned the overall structure for organizing a scene and used opaque integers as material handles. Here, we will define a data structure for storing material parameters...