Implementing a material system
Chapter 6, Physically Based Rendering Using the glTF2 Shading Model, provided a description of the PBR shading model and presented all the required GLSL shaders for rendering a single 3D object using multiple textures. Here, we will show you how to organize scene rendering with multiple objects with different materials and properties. Our material system is compatible with the glTF2 material format and easily extensible for incorporating many existing glTF2 extensions.
Getting ready
The previous chapters dealt with rendering individual objects and applying a PBR model to lighten them. In the Using data-oriented design for a scene graph recipe, we learned the general structure for scene organization and used opaque integers as material handles. Here, we will define a structure for storing material parameters and show you how this structure can be used in GLSL shaders. The routine to convert material parameters from the ones loaded by Assimp will...