Thirteen tone mapping operators for GLSL and WGSL, as ES module strings and as plain shader files. The two ports are one to one, so both languages give you the same curves.
| Package | Install | For |
|---|---|---|
| glsl-tone-map |
npm i glsl-tone-map |
WebGL, glslify |
| wgsl-tone-map |
npm i wgsl-tone-map |
WebGPU |
Every operator is a string you interpolate into your shader:
import { AGX } from "glsl-tone-map";
const fragmentShader = /* glsl */ `
${AGX}
void main() {
gl_FragColor = vec4(agx(color.rgb), 1.0);
}`;Each one also ships as a plain file — glsl-tone-map/agx.glsl for glslify or a raw-text bundler import, wgsl-tone-map/agx.wgsl likewise.
| Operator | Reference |
|---|---|
aces |
Narkowicz 2015, "ACES Filmic Tone Mapping Curve" |
acesHill |
Stephen Hill's fit of the full ACES RRT and ODT, via BakingLab |
agx |
Missing Deadlines, Filament and AgX_LUT_Gen. Also agxGolden, agxPunchy, agxNeedle |
filmic |
Hejl and Burgess-Dawson, via Filmic Tonemapping Operators |
hejl |
Jim Hejl 2015, ToneMapFilmic_Hejl2015 |
lottes |
Lottes 2016, "Advanced Techniques and Optimization of HDR Color Pipelines" |
neutral |
Khronos PBR Neutral Tone Mapper |
reinhard, reinhard2 |
Reinhard et al. 2002, the second with a white point |
reinhardJodie |
Reinhard driven by luminance so hue survives, via Tone Mapping |
uchimura |
Uchimura 2017, "HDR theory and practice" (curve) |
uncharted2 |
Hable, Uncharted 2 |
unreal |
Unreal 3 documentation, "Color Grading" |
Collected from this comparison of tone mapping operators and this Shadertoy.
Color space. Every operator takes and returns linear color, with one exception: unreal has gamma 2.2 baked in, so don't apply an sRGB transform after it.
Range. aces, acesHill, agx, filmic, neutral, reinhard and uchimura stay within [0, 1]. hejl, lottes, reinhard2, uncharted2 and unreal can exceed 1.0 above their white point, and reinhardJodie can on saturated colors — clamp if your target needs it.
WGSL. It has no function overloading, so the f32 variants are suffixed with Scalar (acesScalar) and the parameterised curves are named hejlCurve, uchimuraCurve and uncharted2Curve. Everything else matches the GLSL sources.
MIT. See license file.