AgX
A display transform by Troy Sobotka that maps scene-referred values through a log encoding and sigmoid in a rotated primaries space. Highlights roll off to white without hue skews or ACES-style saturation.
In the family Post-processing, color & imaging, tonemapping
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | Built in | renderer.toneMapping = THREE.AgXToneMapping docs |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | Built in | Environment.tonemap_mode = Environment.TONE_MAPPER_AGX docs |
| Unity | None found | Only Neutral and ACES modes are built in (URP and HDRP). |
| Unreal 5.7 | None found | Unreal ships the ACES Filmic tonemapper rather than AgX. |
| Blender 5.2 | Built in | Properties > Render > Color Management > View Transform = AgX docs |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
AgX first applies an inset matrix that moves colours slightly toward the neutral axis so extreme values can desaturate gracefully. The result is encoded as log2 between a fixed black and white relative exposure (about minus 12 to plus 4 stops) and normalised, then a sigmoid, fitted as a polynomial, applies the contrast curve. An outset matrix restores most chroma, and an optional look adds slope, power and saturation tweaks for punchier or flatter results. The shaders in Blender and three.js are small enough to run per fragment. The result reaches white with an even desaturation, so a bright blue light does not flip to purple.
When to choose it
Reach for it when
- bright saturated lights turn orange or cyan at highlights
- highlights shift hue instead of rolling off to white
- want a neutral camera-like look for hdr renders
- emissive colours look garish after tone mapping
Choose it when you want predictable, neutral highlights and a camera-like rendering, especially for saturated emissive content.
Prefer ACES filmic tonemapping when you need ACES compatibility and the punchy look. Prefer Khronos PBR Neutral tone mapper for product viewers where albedo colours must not shift.
Field marks
- Flat, low-contrast default look unless a contrast look is chosen
- Slightly desaturated mid-tones compared with ACES or Neutral
- Several incompatible implementations (Blender, three.js, Filament) differ in constants
- Fully saturated primaries cannot reach display boundaries because of the inset
Presets
three.js AgX tone mapping, exposure 1.0
{
"toneMapping": "AgX",
"exposure": 1
}Attribution: written for this index
AgX inset-matrix HDR tonemapper (WGSL)
{
"EXPOSURE": 1,
"PUNCH": 1.15
}Show WGSL (43 lines)
// WebGPU WGSL fragment specimen: AgX log-encoding + sigmoid look curve
const EXPOSURE: f32 = 1.0000; // P
const PUNCH: f32 = 1.1500; // P
fn agx_map(x_in: vec3f) -> vec3f {
let m = mat3x3f(
vec3f(0.842479, 0.042328, 0.042376),
vec3f(0.078434, 0.878469, 0.078434),
vec3f(0.079224, 0.079166, 0.879143)
);
let x = max(m * max(x_in * EXPOSURE, vec3f(1e-5)), vec3f(1e-5));
let lv = clamp((log2(x) + 12.47393) / 16.5, vec3f(0.0), vec3f(1.0));
let s = lv * lv * (3.0 - 2.0 * lv);
return pow(clamp(s, vec3f(0.0), vec3f(1.0)), vec3f(PUNCH));
}
@fragment
fn fs_main(@builtin(position) pos: vec4f) -> @location(0) vec4f {
let uv = (pos.xy - 0.5 * u.resolution) / u.resolution.y;
var col = vec3f(0.05, 0.055, 0.065);
var hues = array<vec3f, 5>(
vec3f(1.0, 0.22, 0.12),
vec3f(1.0, 0.76, 0.12),
vec3f(0.18, 0.82, 0.42),
vec3f(0.12, 0.54, 1.0),
vec3f(0.70, 0.30, 1.0)
);
for (var i: i32 = 0; i < 5; i = i + 1) {
let c = vec2f((f32(i) - 2.0) * 0.30, -0.06);
let d = uv - c;
let r2 = dot(d, d);
if (r2 < 0.018) {
let n = normalize(vec3f(d.x, -d.y, sqrt(0.018 - r2)));
let l = max(dot(n, normalize(vec3f(0.4, 0.6, 0.7))), 0.12);
col = hues[i] * (l * 0.75 + pow(2.0, f32(i) - 0.4));
}
}
if (uv.y > 0.20 && uv.y < 0.34 && abs(uv.x) < 0.72) {
let ev = mix(-3.0, 5.0, (uv.x + 0.72) / 1.44);
col = vec3f(pow(2.0, ev));
}
return vec4f(agx_map(col), 1.0);
}Attribution: written for this index
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| three-agx-exposure-1 | Tesla T4 1920x1080 | 1.18× baseline (feather) · 0.039 ms / 0.041 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| three-agx-exposure-1 | NVIDIA L4 1920x1080 | 1.00× baseline (feather) · 0.016 ms / 0.016 ms · 2.4× faster on L4 | opengl-timer-query · Cross-architecture validation |
| three-agx-exposure-1 | NVIDIA A100-SXM4-40GB 1920x1080 | 1.00× baseline (feather) · 0.029 ms / 0.029 ms · 1.3× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
Crosses
- Auto exposure from luminance histogram: Exposure feeds the log encoding range.
- 3D LUT color grading: AgX is commonly followed by a LUT-based look.
Sources
- primarysobotka (2022). sobotka/AgX. There Be Kraken and DragonsGitHub API · no license declared · 2026-11-29
- implementationmrdoob (2010). mrdoob/three.js. JavaScript 3D Library.GitHub API · license MIT · 2026-11-29