KHR_materials_ior: Index of Refraction in glTF
The KHR_materials_ior extension allows developers and 3D
artists to define a custom Index of Refraction (IOR) for materials in
glTF 2.0. By overriding the default fixed IOR value used in core glTF
physically based rendering (PBR), this extension enables the accurate
simulation of light bending and surface reflectivity across a wide range
of real-world substances, including water, specialty glass, plastics,
and gemstones.
The Limitation of Core glTF 2.0
In standard glTF 2.0, all dielectric materials are locked to a fixed Index of Refraction of 1.5. This assumption yields a base normal reflectance (\(F_0\)) of approximately 4%, which is suitable for standard plastics, wood, and stone. However, this hardcoded approach fails to accurately represent materials that deviate significantly from this baseline, such as water (IOR 1.33), ice (IOR 1.31), or diamond (IOR 2.42).
The Role of KHR_materials_ior
The KHR_materials_ior extension solves this limitation
by introducing a single floating-point parameter: ior.
This property serves two primary functions in rendering engines:
Calculating Dielectric Reflectance (\(F_0\)):
The extension uses the standard Fresnel equations to derive normal incidence reflectance directly from the specified IOR: \[F_0 = \left(\frac{\text{ior} - 1}{\text{ior} + 1}\right)^2\] By changing the IOR, engines automatically adjust the intensity of dielectric reflections without requiring manual texture tweaking or unnatural color alterations.Controlling Light Bending (Refraction):
When used alongside optical transmission extensions,KHR_materials_iordetermines the degree to which light rays bend as they enter and exit an object, adhering to Snell’s Law.
Interaction with Other glTF Extensions
KHR_materials_ior is rarely used in isolation for
advanced materials; it functions as a core building block alongside
other PBR extensions:
KHR_materials_transmission: Controls the percentage of light that passes through the surface rather than being reflected or absorbed. The IOR dictates how sharply this transmitted light refracts.KHR_materials_volume: Adds thickness and absorption properties beneath the surface. The IOR dictates the path and internal reflection behaviors of rays traveling through the volume.KHR_materials_specular: Modulates the strength and tint of dielectric reflections. When both are used, the specular parameters scale the baseline \(F_0\) value derived from the IOR.
glTF Implementation
The extension is declared at the material level within the glTF JSON structure:
{
"materials": [
{
"name": "WaterMaterial",
"extensions": {
"KHR_materials_ior": {
"ior": 1.33
}
}
}
]
}The ior value must be a number greater than or equal to
1.0. A value of 1.0 represents a vacuum or air, effectively eliminating
dielectric surface reflections and refraction.
Common Real-World Reference Values
- Air / Vacuum: 1.0
- Water: 1.33
- Standard Glass: 1.5
- Polycarbonate: 1.58
- Sapphire: 1.77
- Diamond: 2.42
By adjusting this single property via KHR_materials_ior,
glTF renders achieve optical and physical fidelity across various
real-time 3D viewers and rendering engines.