🎬 Color Science & ACES Architecture

3D LUT Mathematics: Tetrahedral vs Trilinear Color Grading Interpolation

👤 Author: Master Colorist & Systems Architect📅 Technical Review: September 2026⚡ ACES 1.3 & WebCodecs Verified

In motion picture post-production, 3D Look-Up Tables (3D LUTs) are the mathematical backbone of digital cinematography. From on-set camera monitoring and logarithmic conversion to final theatrical color grading, 3D LUTs execute complex non-linear color space transformations. 3D LUT Mathematics: Tetrahedral vs Trilinear Color Grading Interpolation dissects the geometry of color cubes, trilinear volume weighting, tetrahedral simplex partitioning, and real-time GPU shader implementations.

The Geometry of 3D Color Cubes: Lattice Discretization

A continuous RGB color space contains over 16.7 million discrete 8-bit color combinations and over 1.07 billion 10-bit combinations. Storing a discrete output mapping for every possible RGB triplet in memory is computationally impractical: a 10-bit uncompressed table would require over 4 gigabytes of memory per LUT.

To solve this memory barrier, color science utilizes Lattice Discretization. A 3D LUT samples the RGB color cube at uniform interval grid coordinates:

  • 17x17x17 Grid (4,913 nodes): Standard on-set monitoring and proxy preview grade format, balancing minimal memory consumption with reasonable color fidelity.
  • 33x33x33 Grid (35,937 nodes): Industry standard for commercial finishing and digital broadcast delivery, providing smooth gradations without visible quantization.
  • 65x65x65 Grid (274,625 nodes): Master mastering standard used in theatrical feature films and high-end archival post-production suites.

Architectural Comparison: Interpolation Algorithms

Algorithm Active Vertices Computational Complexity Neutral Axis Preservation
Nearest Neighbor 1 vertex O(1) - Lowest Severe Banding & Posterization
Trilinear Interpolation 8 vertices 7 Linear Operations Moderate - Diagonal Warping
Prism / Pyramidal 5 to 6 vertices Moderate Intermediate
Tetrahedral Interpolation 4 vertices 3 Vector Operations Flawless - Neutral Axis Locked

Trilinear Interpolation: Volume-Weighted Averaging

When an arbitrary color point $P(r, g, b)$ falls between discrete lattice nodes, the graphics engine locates the enclosing cubic sub-cell defined by eight boundary corners: $C_{000}, C_{001}, C_{010}, C_{011}, C_{100}, C_{101}, C_{110}, C_{111}$.

Let the normalized fractional coordinates within the sub-cell be defined as $(\Delta r, \Delta g, \Delta b) \in [0, 1]^3$. Trilinear interpolation computes the output vector by evaluating three sequential linear interpolations:

P(r, g, b) = \sum_{i=0}^1 \sum_{j=0}^1 \sum_{k=0}^1 C_{ijk} (1 - \Delta r)^{1-i} \Delta r^i (1 - \Delta g)^{1-j} \Delta g^j (1 - \Delta b)^{1-k} \Delta b^k

While trilinear interpolation is widely supported in hardware, it suffers from a fundamental mathematical flaw: it treats the cubic sub-cell as a symmetric volume. Along the neutral diagonal where $R=G=B$, cross-product terms produce subtle non-linear hue shifts, creating microscopic color contaminations in clean monochrome gradients.

Tetrahedral Interpolation: Simplex Decomposition

To achieve mathematical perfection and eliminate diagonal hue warping, professional digital intermediate suites (such as DaVinci Resolve, Baselight, and Nuke) implement Tetrahedral Interpolation.

Tetrahedral interpolation partitions the cubic sub-cell into six non-overlapping tetrahedra (simplices) that all share the central neutral axis connecting $C_{000}$ (black) to $C_{111}$ (white).

The algorithm evaluates relative magnitude inequalities between the fractional coordinate offsets $\Delta r, \Delta g, \Delta b$ to select the exact containing tetrahedron:

  • Tetrahedron 1 ($\Delta r > \Delta g > \Delta b$): Corners: $C_{000}, C_{100}, C_{110}, C_{111}$
  • Tetrahedron 2 ($\Delta r > \Delta b > \Delta g$): Corners: $C_{000}, C_{100}, C_{101}, C_{111}$
  • Tetrahedron 3 ($\Delta g > \Delta r > \Delta b$): Corners: $C_{000}, C_{010}, C_{110}, C_{111}$
  • Tetrahedron 4 ($\Delta g > \Delta b > \Delta r$): Corners: $C_{000}, C_{010}, C_{011}, C_{111}$
  • Tetrahedron 5 ($\Delta b > \Delta r > \Delta g$): Corners: $C_{000}, C_{001}, C_{101}, C_{111}$
  • Tetrahedron 6 ($\Delta b > \Delta g > \Delta r$): Corners: $C_{000}, C_{001}, C_{011}, C_{111}$

For instance, when $\Delta r > \Delta g > \Delta b$, the final interpolated color is calculated using only four corner points:

P(r, g, b) = C_{000} + \Delta r (C_{100} - C_{000}) + \Delta g (C_{110} - C_{100}) + \Delta b (C_{111} - C_{110})

Because every tetrahedron contains the neutral line connecting $C_{000}$ and $C_{111}$, neutral grays remain 100% pure and free of chromatic drift across the entire grading curve.

Hardware Acceleration in GLSL & WebGPU Shaders

In modern web browsers, executing 3D LUT color grading inside real-time video compositors requires compiling custom fragment shaders:

#version 300 es
precision highp float;
uniform sampler3D u_lutTexture;
uniform float u_lutSize; // e.g., 33.0
in vec2 v_texCoord;
out vec4 fragColor;

vec3 sampleLut(vec3 color) {
  vec3 scale = (u_lutSize - 1.0) / u_lutSize;
  vec3 offset = 0.5 / u_lutSize;
  return texture(u_lutTexture, color * scale + offset).rgb;
}

The half-texel offset adjustment ($0.5 / N$) is critical: it aligns normalized texture coordinates with the centers of the discrete 3D LUT texel volumes, preventing boundary clamping distortions along extreme shadow and highlight boundaries.

Precision Quantization & Logarithmic Pre-Shaping

Applying a linear 3D LUT directly to high-dynamic-range camera RAW footage (such as ARRI LogC4 or REDWideGamutRGB Log3G10) wastes over 70% of the lattice nodes on highlights, leaving shadows severely under-sampled.

Professional post-production solves this through 1D Pre-Shaping Curves (Shaper LUTs). A non-linear 1D curve redistributes incoming logarithmic values uniformly across the 3D cube before interpolation. The resulting combination—a 1D shaper paired with a 33x33x33 tetrahedral 3D LUT—matches the color accuracy of a massive 129x129x129 linear cube while saving over 90% of texture cache memory.

Moviemodifier Post-Production Desk

Written by Moviemodifier Post-Production Desk

Senior video transcoding systems architect and colorist specializing in ACES color pipelines, Dolby Atmos spatial audio mastering, and high-performance WebCodecs GPU acceleration.