Energy Conservation in glTF PBR Materials

This article provides an overview of how the glTF 2.0 file format achieves physical plausibility by enforcing energy conservation between diffuse and specular light reflections. It details the underlying mathematical formulations of the core metallic-roughness model, the role of the Fresnel reflectance factor, and how light energy is dynamically partitioned to ensure a surface never reflects more light than it receives.

The Core Principle of Energy Conservation

In physically based rendering (PBR), the law of conservation of energy states that the total light reflected and absorbed by a surface cannot exceed the total amount of incident light. Light striking an opaque interface is partitioned into two primary components:

  1. Specular Reflection: Light reflected directly off the micro-surface interface.
  2. Diffuse Reflection: Light that refracts into the material, scatters internally, and re-emerges across various angles (or is absorbed as heat).

To obey physics, glTF dictates that any light reflected specularly cannot also contribute to diffuse reflection.

Metalness Workflow and Base Color Derivation

glTF primarily relies on the metallic-roughness workflow. In this model, surfaces are defined by a baseColorFactor (and texture) alongside a metallicFactor.

Before applying lighting, glTF derives the base reflectance at normal incidence (\(F_0\)) and the diffuse color (\(c_{\text{diff}}\)) based on the metalness value:

  • Dielectrics (non-metals): Most dielectric materials reflect roughly 4% (\(0.04\)) of light at normal incidence. The remaining light penetrates the surface, meaning the diffuse color retains nearly all of the base color.
  • Conductors (metals): Metals have no internal scattering (diffuse component is effectively black), and their \(F_0\) specular reflectance takes on the tint of the base color.

The mathematical derivation in glTF is calculated as follows:

\[F_0 = \text{lerp}(0.04, \text{baseColor}, \text{metallic})\]

\[c_{\text{diff}} = \text{baseColor} \times (1.0 - 0.04) \times (1.0 - \text{metallic})\]

If metallic is \(1.0\), \(c_{\text{diff}}\) evaluates to zero, naturally eliminating diffuse energy for pure conductors.

Directional Energy Balancing via Fresnel

While \(F_0\) determines specular reflection when viewing a surface straight on, reflection increases toward 100% (\(1.0\)) at grazing angles. glTF uses the Schlick approximation of the Fresnel equation to calculate the viewing-angle-dependent reflectance \(F\):

\[F = F_0 + (1.0 - F_0)(1.0 - \langle v, h \rangle)^5\]

Where \(v\) is the view vector and \(h\) is the half-vector between the view and light directions.

To conserve energy at all angles, glTF scales the diffuse component by the inverse of the Fresnel term:

\[\text{Factor}_{\text{diffuse}} = 1.0 - F\]

Because \(F\) represents the exact fraction of light reflected specularly at that specific angle, multiplying the diffuse reflection by \((1.0 - F)\) guarantees that the remaining light available for diffuse scattering decreases as specular reflection increases.

The Combined glTF BRDF Formulation

glTF combines the microfacet specular BRDF and the Lambertian diffuse BRDF into a single evaluation:

\[f(l, v) = (1.0 - F) \frac{c_{\text{diff}}}{\pi} + f_{\text{specular}}(l, v)\]

Where:

  • \(f_{\text{specular}}(l, v) = \frac{D \cdot V \cdot F}{4 (\langle n, l \rangle)(\langle n, v \rangle)}\)
  • \(D\) is the GGX/Trowbridge-Reitz normal distribution function.
  • \(V\) is the height-correlated Smith shadowing-masking visibility function.
  • \(\frac{c_{\text{diff}}}{\pi}\) represents standard Lambertian diffuse reflectance.

By scaling the Lambertian term directly by \((1.0 - F)\), the sum of the outgoing specular and diffuse radiance remains mathematically bounded by the incoming irradiance.

Multi-Layer Energy Conservation in glTF Extensions

Advanced glTF extensions follow a layered energy-conservation hierarchy:

  • Clearcoat (KHR_materials_clearcoat): The clearcoat layer sits on top of the base material. The light reflected by the clearcoat Fresnel term (\(F_c\)) reduces the total energy that penetrates to the base layer by multiplying incoming base light by \((1.0 - F_c)\).
  • Specular (KHR_materials_specular): Allows explicit modification of \(F_0\) and specular color for dielectrics, automatically adjusting the remaining diffuse energy via an updated \((1.0 - F)\) term.
  • Transmission (KHR_materials_transmission): Any light not reflected specularly or scattered diffusely is made available for transmission through the volume, scaling transmitted light by \((1.0 - \text{diffuse} - \text{specular})\).