glTF Alpha Modes: OPAQUE, MASK, and BLEND Explained

In the glTF 2.0 specification, a material's transparency behavior is governed by the alphaMode property, which dictates how source alpha values are interpreted during rendering. This article provides an overview of the three standard alpha modes supported by glTF—OPAQUE, MASK, and BLEND—explaining their operational logic, performance characteristics, and common visual use cases.

The Role of alphaMode in glTF

In glTF materials, transparency is primarily driven by the alpha channel of the baseColorFactor and the baseColorTexture. By default, if the alphaMode property is not explicitly defined in the material definition, the runtime must default to OPAQUE. When configuring transparency, developers choose between OPAQUE, MASK, and BLEND depending on whether the object requires total opacity, sharp cutouts, or smooth translucency.

1. OPAQUE Mode

The OPAQUE mode forces the material to render as completely solid, regardless of any alpha values present in the texture or color factors.

  • Rendering Behavior: The renderer completely ignores the alpha channel. The final fragment output has an alpha value of 1.0.
  • Depth Handling: Depth writes (glDepthMask(true)) and depth tests remain fully enabled.
  • Performance: This is the most computationally efficient mode. It requires no sorting, prevents fill-rate waste, and allows graphics APIs to utilize early-Z rejection to skip hidden fragments.
  • Use Cases: Standard solid geometry such as concrete, metals, skin, and stone.

2. MASK Mode

The MASK mode introduces binary transparency, often referred to as "alpha testing" or "cutout" transparency. A pixel is either 100% visible or completely discarded.

  • Rendering Behavior: The engine samples the alpha value from the base color and compares it against the alphaCutoff property (a float value ranging from 0.0 to 1.0, defaulting to 0.5 in glTF).
    • If \(\text{Alpha} \ge \text{alphaCutoff}\), the fragment is rendered as fully opaque with an alpha of 1.0.
    • If \(\text{Alpha} < \text{alphaCutoff}\), the fragment is discarded entirely using graphics pipeline operations like discard in GLSL or clip() in HLSL.
  • Depth Handling: Because fragments are either present or discarded, surviving pixels write directly to the depth buffer. Sorting objects from back-to-front is not required.
  • Performance: Eliminates the need for mesh-level depth sorting, but discarding fragments in fragment shaders can disable early-Z optimizations on some GPU architectures.
  • Use Cases: Foliage, chain-link fences, wire mesh, hair cards, and textiles with perforated patterns.

3. BLEND Mode

The BLEND mode enables continuous, translucent blending, allowing objects behind the surface to remain partially visible.

  • Rendering Behavior: The renderer blends the fragment's color with the background color already in the framebuffer using standard linear interpolation:

\[\text{Final Color} = (\text{Source Color} \times \text{Source Alpha}) + (\text{Destination Color} \times (1 - \text{Source Alpha}))\]

  • Depth Handling: To prevent transparent surfaces from occluding objects behind them, depth writing is typically disabled for surfaces using BLEND, while depth testing remains enabled.
  • Drawbacks and Sorting: Because depth writing is disabled, the rendering engine must sort transparent primitives from back-to-front relative to the camera position. Concave meshes, intersecting transparent surfaces, and self-overlapping geometry can produce sorting artifacts and visual z-fighting.
  • Use Cases: Glass, tinted plastic, water, smoke, fire, and holographic UI elements.