The Role of alphaCutoff in glTF Alpha Masking

In the glTF 2.0 specification, the alphaCutoff property defines the exact threshold used to determine whether a fragment is rendered or completely discarded when a material uses the MASK alpha mode. This article explains how alphaCutoff functions within 3D rendering pipelines, why it is essential for rendering cutout surfaces like foliage and fences, and how it avoids common transparency sorting artifacts while maintaining depth-buffer compatibility.

The Mechanics of Alpha Masking

glTF materials support three primary alpha modes: OPAQUE, BLEND, and MASK. While BLEND allows for smooth, semi-transparent transitions and OPAQUE ignores transparency entirely, MASK provides a binary pass/fail approach to surface visibility.

The alphaCutoff property acts as the evaluation threshold for this binary decision:

  • If the evaluated alpha value of the base color is greater than or equal to alphaCutoff, the fragment is treated as fully opaque (alpha is set to 1.0).
  • If the alpha value is strictly less than alphaCutoff, the fragment is discarded from rendering entirely.

By default, the glTF specification sets alphaCutoff to 0.5 if not explicitly declared in the material definition.

Depth Testing and Sorting Advantages

The primary functional benefit of using alphaCutoff over traditional alpha blending is compatibility with the depth buffer (Z-buffer). Transparent objects using BLEND mode generally cannot write to the depth buffer without causing rendering anomalies, requiring game engines and WebGL viewers to sort meshes from back to front every frame.

Because MASK mode strictly discards fragments, surviving fragments write directly to the depth buffer just like opaque geometry. This eliminates sorting artifacts, reduces CPU overhead for transparency sorting, and ensures that geometric clipping behaves predictably from any camera angle.

Integration with Modern Rendering Pipelines

Fragment discarding via alphaCutoff enables masked assets to integrate smoothly with standard deferred and forward rendering techniques:

  • Shadow Mapping: Shadow passes can execute depth-only pre-passes that sample the alpha texture and discard fragments below the cutoff, creating accurate, sharp silhouette shadows for complex geometry.
  • Depth-Dependent Effects: Effects such as Screen Space Ambient Occlusion (SSAO), Depth of Field (DoF), and temporal antialiasing rely heavily on an accurate depth map, which masked materials populate reliably.

Common Use Cases

alphaCutoff is optimized for geometry requiring fine, perforated detail where full volumetric transparency is unnecessary. Common applications include:

  • Foliage, tree leaves, and grass blades.
  • Chain-link fences, wire mesh, and grates.
  • Fringes on clothing and hair cards in real-time character models.
  • Decals with sharp, distinct boundaries.