glTF Refraction and Opaque Material Transitions

This article provides an overview of how glTF 2.0 physically based rendering (PBR) materials transition between transparent refraction and opaque baseline approximations. It covers the interaction between the core metallic-roughness model, the role of material transmission and volume extensions, the mathematical blending used to interpolate optical properties, and the fallback strategies renderers deploy when full refraction is unavailable.

The Core Baseline: Metallic-Roughness PBR

In the standard glTF 2.0 specification, materials rely on the core PBR metallic-roughness workflow. Under this model, surfaces are treated as opaque boundaries where light is either reflected specularly at the surface or scattered internally as diffuse reflection.

Standard transparency in core glTF is handled strictly through alpha coverage (OPAQUE, MASK, or BLEND). Alpha blending only modulates surface visibility by linearly interpolating the fragment color with the background. It does not account for the bending of light, internal scattering, or thickness, meaning it cannot simulate real-world refraction.

The Refraction Extensions

To model genuine optical refraction, glTF introduces modular extensions on top of the baseline material:

  • KHR_materials_transmission: Introduces a transmissionFactor (and optional transmission texture) that determines the fraction of light passing through the surface rather than scattering diffusely.
  • KHR_materials_ior: Sets the Index of Refraction (defaulting to 1.5), dictating Fresnel reflectance and the angular bending of transmitted rays.
  • KHR_materials_volume: Supplies thickness and absorption parameters, enabling ray-attenuation inside the object using the Beer-Lambert law.

The Mathematical Transition from Opaque to Refractive

The transition from an opaque baseline to a refractive state is governed by the transmissionFactor (\(T \in [0.0, 1.0]\)):

  1. Diffuse Reflection vs. Specular Transmission: The specular reflection at the outer surface remains governed by the material's roughness, metallic, and IOR parameters. The transmission factor specifically scales down the standard diffuse component: \[\text{Diffuse}_{\text{final}} = \text{Diffuse}_{\text{baseline}} \times (1.0 - T)\]
  2. Refracted Background Integration: The transmitted portion (\(T\)) samples the scene behind the object via a rendered background texture (often captured in a screen-space color buffer). If the surface has roughness, the background is sampled from blurred mip levels to simulate rough refraction (frosted glass).
  3. Preservation of Highlights: Because transmission only replaces the diffuse layer, surface highlights (specular reflections) remain fully visible, allowing smooth transitions where an object retains its physical surface presence even at \(T = 1.0\).

Fallback to Opaque Baseline Approximations

Real-time rendering engines must balance performance against visual fidelity, especially on mobile or low-power hardware that cannot afford a screen-space refraction pass or ray tracing. When full refractive pipelines are disabled, transitions degrade gracefully through several approximation stages:

  • Rasterized Screen-Space Copy: High-end real-time renderers render opaque objects first, copy the frame buffer into a texture, and sample it with ray-offset UV coordinates during the transparent pass to fake refraction.
  • Alpha Blending Fallback: If screen-space refraction buffers are unsupported, engines often convert the transmissionFactor directly into an inverse alpha value: \[\text{Alpha} \approx 1.0 - T\] This replaces light-bending with simple transparency, maintaining visibility transitions while losing light distortion.
  • Opaque Baseline Clamp: When transparency sorting or multiple render passes are entirely unviable, the engine ignores the transmission extension altogether. The material drops directly back to its glTF core baseline, rendering as a standard opaque dielectric using its base color and specular roughness settings.