Why glTF Decouples Ambient Occlusion from Direct Light
In the glTF 2.0 specification, ambient occlusion (AO) is explicitly applied only to indirect, ambient lighting rather than direct, punctual light sources like point, directional, or spot lights. This design decision stems from physically based rendering (PBR) principles: ambient occlusion approximates the blockage of diffuse, omnidirectional environmental light, whereas direct lights simulate explicit light rays governed by their own shadow-casting mechanisms. Decoupling the two prevents physical inaccuracies like "double-shadowing," ensures predictable cross-engine asset portability, and preserves standard PBR energy conservation.
The Physical Definition of Ambient Occlusion
Ambient occlusion is a precomputed or screen-space approximation of accessibility. It measures how much of the hemispherical sky or surrounding environment is visible from a given point on a surface.
Because it represents diffuse, indirect illumination arriving from broad angles:
- It accounts for light bounced off nearby surfaces that fails to reach narrow crevices, corners, and folds.
- It does not represent directional light rays arriving along a single, clear vector from an emitter.
Avoiding the "Double-Shadowing" Problem
Direct punctual lights (such as directional, point, and spot lights) use dedicated shadowing techniques, such as shadow maps or ray casting, to determine visibility between a light source and a fragment.
If ambient occlusion were multiplied across direct punctual lighting equations:
- Unnatural Darkening: A surface facing directly toward a bright spotlight would remain unnaturally dark simply because it sits inside a crevice or recessed groove, defying how direct light penetrates open geometry.
- Double Shadowing: An area already in shadow from a shadow map would have ambient occlusion applied on top of it, creating excessively dark, muddy patches that ruin the dynamic range of the scene.
By separating the terms, a direct light source can fully illuminate a recessed surface if a clear line of sight exists, while ambient environment light remains appropriately occluded.
The glTF Standard Lighting Formulation
The glTF PBR standard splits surface radiance into distinct direct and indirect terms:
\[\text{Total Radiance} = \sum \text{Direct Lighting} + (\text{Indirect Lighting} \times \text{Occlusion})\]
In this formulation:
- Direct Lighting: Calculated per punctual light using the standard microfacet BRDF (Bidirectional Reflectance Distribution Function), taking into account light intensity, falloff, surface roughness, metallic properties, and shadow mapping.
- Indirect Lighting: Derived from Image-Based
Lighting (IBL) or a uniform ambient light term. The glTF
occlusionTexturescales this term directly.
Applying the occlusion texture solely to indirect diffuse lighting reflects true photon behavior: direct photons either reach the surface or are blocked by an occluder, whereas indirect ambient photons represent an average accessibility factor.
Portability and Engine Consistency
A primary goal of the glTF format is to function as a reliable transmission standard across different 3D engines, frameworks, and digital content creation tools.
If the specification allowed ambient occlusion to bleed arbitrarily into direct light calculations, renders would vary wildly between engines depending on individual implementation details. Restricting occlusion to indirect light terms provides a mathematically strict baseline that ensures models appear identical across various engines like Three.js, Babylon.js, Unreal Engine, and Blender.