Implementing the glTF 2.0 metallic-roughness shading model
This recipe will cover how to integrate physically based rendering (PBR) into your graphics pipeline. Since the topic of PBR rendering is vast, we focus on the minimalistic implementation just to guide you and get you started. In the book text right here, we focus on the metallic-roughness shading model and minimalistic C++ viewer implementation. In the following chapters we will create a more complex and feature-rich glTF viewer including advanced material extensions and geometry features.
Getting ready
It is recommended to revisit the recipe Introduction to glTF 2.0 Physically Based Material system before you proceed with this one. A lightweight introduction to the glTF 2.0 shading model can be found at https://github.com/KhronosGroup/glTF-Sample-Viewer/tree/glTF-WebGL-PBR.
The C++ source code for this recipe is in the Chapter06/04_MetallicRoughness
folder. The GLSL shader code responsible for PBR calculations...