glTF PBR Data in Deferred Rendering G-Buffers
Deferred rendering decouples scene geometry processing from lighting calculations by rasterizing surface characteristics into a collection of screen-space textures known as the Geometry Buffer (G-buffer). When ingesting assets defined by the standard glTF 2.0 Physically Based Rendering (PBR) metallic-roughness workflow, the geometry pass extracts specific optical and microfacet properties—including base color, perturbed normals, perceptual roughness, metalness, ambient occlusion, and emissive color. These material attributes are decomposed, transformed, and packed into optimal render target channels so that lighting shaders can evaluate standard bidirectional reflectance distribution functions (BRDF) later in the pipeline.
Base Color (Albedo)
In the standard glTF PBR specification, base color defines the
diffuse reflectivity for dielectric surfaces and the specular color
reflectance (\(F_0\)) for metallic
surfaces. The G-buffer pipeline extracts this by sampling the
baseColorTexture (typically stored in sRGB space) and
multiplying it by the linear baseColorFactor RGBA vector.
In the G-buffer, the resulting linearized RGB values are stored as the
surface albedo. The alpha channel of the base color is either used
during rasterization for alpha testing/discarding (via
alphaMode and alphaCutoff) or packed into an
available G-buffer channel to store subsurface scattering masks,
material flags, or transmission factors.
Surface Normals
Geometric detail beyond vertex geometry is provided via glTF's
normalTexture. The deferred pass extracts tangent-space
normal vectors from this two- or three-component texture, applies the
asset's normal scale factor, and transforms the vector into view space
or world space using the vertex Normal-Tangent-Bitangent (TBN) frame.
The resulting unit vector is then stored in the G-buffer. Because full
32-bit floating-point normal vectors consume significant memory
bandwidth, engines frequently compress the extracted normal data using
octahedral encoding or spherical coordinates, storing the vector in two
16-bit float channels (RG16F) or a packed 10-bit format (RGB10A2).
Roughness and Metallic Properties
The core glTF PBR model packs microfacet roughness and metallic
properties into a single linear texture, the
metallicRoughnessTexture. The G-buffer extraction step
samples this texture and applies the corresponding material
multipliers:
- Roughness: Extracted from the green channel and
multiplied by
roughnessFactor. This scalar represents perceptual roughness, which lighting passes convert to the microfacet distribution parameter \(\alpha\) (\(\alpha = \text{roughness}^2\)) for models such as GGX. - Metalness: Extracted from the blue channel and
multiplied by
metallicFactor. This scalar interpolates between dielectric behavior (low reflectance at normal incidence, non-colored specular highlights) and metallic behavior (high reflectance, specular color derived from the base color).
Because both parameters are single-channel values ranging from \(0.0\) to \(1.0\), they are typically packed alongside other scalar values into standard 8-bit unorm render targets.
Ambient Occlusion (Cavity Data)
glTF assets optionally provide a pre-baked ambient occlusion map via
the red channel of the occlusionTexture. Scaled by the
material's occlusionStrength, this value represents
localized accessibility and shadowing from ambient light. When writing
to the G-buffer, this scalar is sampled and packed into a spare 8-bit
channel—often sharing a multi-render target (MRT) with roughness and
metallic data—to be consumed during the indirect/ambient lighting
pass.
Emissive Attributes
The self-illumination characteristics of a glTF material are governed
by emissiveTexture (stored in sRGB) and
emissiveFactor (a linear RGB vector), often scaled further
by the KHR_materials_emissive_strength extension for
high-dynamic-range (HDR) effects. Depending on the engine's deferred
architecture, emissive data is handled in one of two ways:
- Direct Accumulation: Emissive energy bypasses the G-buffer entirely and is written directly to the HDR scene-color accumulation buffer during the geometry pass.
- G-Buffer Storage: Emissive RGB values are written to a dedicated high-precision render target (e.g., RGBA16F) within the G-buffer array, allowing deferred post-processing passes like screen-space bloom or temporal anti-aliasing to process the surface before lighting integration.
Typical G-Buffer Layout for glTF PBR
To balance memory bandwidth and sampling performance, a standard three-target (MRT) G-buffer layout maps glTF PBR data as follows:
- RT0 (RGBA8): Base Color (RGB) + Ambient Occlusion (A)
- RT1 (RGBA8 or RGBA16F): Encoded Normal (\(X, Y\)) + Roughness (B) + Metalness (A)
- RT2 (RGBA16F): Emissive Color (RGB) + Material Flags / Coverage (A)
- Depth-Stencil: Hardware depth buffer (used to reconstruct world/view position analytically rather than storing explicit coordinates).