glTF Anisotropy: KHR_materials_anisotropy Guide

This article provides an overview of how glTF handles anisotropic reflections using the KHR_materials_anisotropy extension. It explains the principles of anisotropic reflection, breaks down the key parameters and texture mappings defined by the specification, and details how modern real-time renderers translate these values into directional specular highlights.

What Are Anisotropic Reflections?

Standard physically based rendering (PBR) assumes isotropic surfaces, where microscopic roughness is uniformly distributed in all directions, creating circular specular highlights. In contrast, anisotropic surfaces have directional microgeometry—such as parallel micro-grooves or fibers—which stretches highlights perpendicularly to the direction of the surface grooves. Real-world examples include brushed metals, vinyl records, hair, and woven fabrics like satin or carbon fiber.

The KHR_materials_anisotropy Extension

The KHR_materials_anisotropy extension expands the core glTF PBR Metallic-Roughness model by introducing directional roughness. Rather than defining an entirely new shading framework, it alters the specular distribution function (typically anisotropic GGX/Trowbridge-Reitz) by calculating separate roughness values along the surface's tangent and bitangent axes.

Key Extension Parameters

The extension introduces three primary properties inside the material's extension object:

  • anisotropyStrength: A float ranging from 0.0 (fully isotropic) to 1.0 (maximum elongation of highlights). It controls the difference in roughness between the primary tangent direction and the perpendicular bitangent direction.
  • anisotropyRotation: A float representing a rotation angle in radians, rotating the anisotropy direction counter-clockwise relative to the surface tangent space.
  • anisotropyTexture: A reference to a texture defining the direction and strength per pixel.

Direction and Strength Encoding

When using an anisotropyTexture, the properties are mapped across specific color channels:

  • Red (R) and Green (G) Channels: Encode the 2D direction vector in tangent space. The raw color values \([0, 1]\) are remapped to \([-1, 1]\) via the formula: \[\text{Direction} = 2 \times [R, G] - 1\] This vector represents the orientation of the microscopic grooves relative to the mesh tangents.
  • Blue (B) Channel: Multiplied by the base anisotropyStrength property to determine the final per-pixel anisotropy strength.

If no texture is provided, the model falls back to the constant values defined by anisotropyStrength and anisotropyRotation.

BRDF Modification and Roughness Calculations

Renderers implement this extension by adjusting the isotropic roughness parameter (\(\alpha\)) derived from the material's roughnessFactor and metallicRoughnessTexture.

Using the final strength parameter (\(s\)) and direction vector, the engine computes two distinct roughness parameters:

  • \(\alpha_t\) (tangent roughness)
  • \(\alpha_b\) (bitangent roughness)

A common derivation used in the glTF ecosystem defines the directional roughness values as: \[\alpha_t = \text{clamp}(\alpha \times (1 + s), 0.001, 1.0)\] \[\alpha_b = \text{clamp}(\alpha \times (1 - s), 0.001, 1.0)\]

These two roughness components are then supplied to an anisotropic GGX normal distribution function (NDF), which stretches the specular lobe across the surface according to the oriented tangent frame.

Mesh Requirements

For the extension to function correctly, target meshes must supply valid vertex tangents (TANGENT attribute). If tangents are not present in the geometry data, the rendering engine must procedurally generate a tangent frame using screen-space derivatives of the surface normals and texture coordinates (UVs) to orient the reflections properly.