How KHR_materials_dispersion Works in glTF

The KHR_materials_dispersion extension introduces realistic optical dispersion to the glTF ecosystem, enabling real-time 3D engines to simulate the wavelength-dependent refraction of light—commonly recognized as chromatic aberration or prismatic color separation. By building upon glTF's existing transmission, volume, and index of refraction (IOR) extensions, this extension allows transmissive surfaces such as glass, water, crystals, and gemstones to break white light into its spectral components, creating physically accurate rainbow fringing at refracted boundaries.

The Physics of Optical Dispersion

In physical optics, the refractive index of a transparent medium is not constant; it varies based on the wavelength of the light passing through it. Shorter wavelengths (such as blue and violet light) bend more sharply than longer wavelengths (such as red light). When white light enters an angled transmissive boundary, this differential bending causes the constituent colors to separate, producing a visible spectrum known as chromatic dispersion.

Integration with the glTF PBR Pipeline

The KHR_materials_dispersion extension works as an add-on to the core glTF PBR model and requires two prerequisite extensions:

  • KHR_materials_transmission, which governs how much light passes directly through the material.
  • KHR_materials_ior, which establishes the baseline index of refraction (\(n_d\), typically measured at the yellow helium d-line, 587.6 nm).
  • KHR_materials_volume, which provides thickness to the geometry, allowing the rays to travel through a physical medium where dispersion can manifest.

The Dispersion Parameter

The extension introduces a single floating-point property: dispersion. In the glTF specification, this value is defined using the optical relationship:

\[\text{dispersion} = \frac{n_d - 1}{V_d} = n_F - n_C\]

Here, \(V_d\) represents the material's Abbe number, which quantifies the medium's chromatic dispersion, while \(n_F\) and \(n_C\) represent the refractive indices at the blue hydrogen F-line (486.1 nm) and red hydrogen C-line (656.3 nm), respectively.

A dispersion value of 0.0 (the default) indicates zero spectral separation, meaning all wavelengths refract at the exact same base IOR. Higher values increase the refractive spread between red and blue light, producing stronger prismatic distortion.

How Renderers Simulate the Effect

Renderers implement KHR_materials_dispersion using either spectral path tracing or trichromatic approximation:

  1. Spectral Sampling (Offline & High-End Path Tracers): Rays are assigned continuous wavelengths. When a ray hits an interface, its specific refractive index is calculated using Cauchy's transmission equation or Sellmeier approximations derived from the material's base IOR and dispersion value.

  2. Trichromatic Split (Real-Time Renderers): For real-time engines, continuous spectral rendering is computationally prohibitive. Instead, the renderer derives three distinct refractive indices for the standard Red, Green, and Blue color channels:

    • \(IOR_{\text{green}} = IOR_{\text{base}}\)
    • \(IOR_{\text{red}} = IOR_{\text{base}} - \frac{\text{dispersion}}{2}\)
    • \(IOR_{\text{blue}} = IOR_{\text{base}} + \frac{\text{dispersion}}{2}\)

The shader traces or samples the transmission environment three separate times—once for each color channel—using each channel's respective IOR. The results are recombined additively, generating the characteristic red-green-blue separation along interior caustics and edges viewed through thick, transmissive volumes.