Film emulation (spectral stock simulation)
Simulates analog colour film end to end: exposure of a spectral stock model, dye density, optional enlarger and print stage, producing the cross-channel colour behaviour of a real emulsion rather than a LUT.
In the family Post-processing, color & imaging, film look
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | Environment supports ACES/AgX/Filmic tonemapping and 3D LUTs, not spectral film-stock simulation. |
| Unity | None found | |
| Unreal 5.7 | None found | |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Instead of a colour matrix, film emulation models the physical chain. Scene RGB is expanded to a spectrum, which exposes three light-sensitive layers with their own spectral sensitivities. Each layer's exposure goes through a characteristic density curve, and the resulting dye densities modulate transmitted light with spectral absorption overlap between dyes, which is what gives film its characteristic colour crosstalk. A print or scan stage then converts densities to display colour. Grain, halation and other effects can be layered on. spektrafilm implements this in Python from manufacturer spectral datasheet data; full-resolution export is slow, so treat it as an offline stills tool.
When to choose it
Reach for it when
- lut grading doesn't capture real film colour behaviour
- want the look of a specific analog stock
- highlights should respond like real emulsion dyes
- digital render looks too clinical compared to film
Choose it when you want the colour behaviour and highlights of a specific stock, beyond what a 3D LUT captures, for stills or pre-rendered frames.
Prefer 3D LUT color grading for real-time. Add Film grain synthesis for texture.
Field marks
- Depends on the quality of the measured stock data
- Needs scene-referred linear input; display-referred sources give odd results
- Slow for video
- Results vary between releases of the tool while it is young
Presets
Left: raw digital sRGB clip. Right: spectral film emulsion with H&D curve, red halation and grain
{
"EXPOSURE": 1.15,
"HALATION": 0.68,
"GRAIN": 0.32,
"CONTRAST": 1.25
}Show GLSL (114 lines)
const float EXPOSURE = 1.15; // P
const float HALATION = 0.68; // P
const float GRAIN = 0.32; // P
const float CONTRAST = 1.25; // P
float hash(vec2 p) {
vec3 q = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
q += dot(q, q.yzx + 33.33);
return fract((q.x + q.y) * q.z);
}
// Scene-referred HDR dusk streetscape (bright tungsten lamps, cyan neon, wet street reflection)
vec3 hdrScene(vec2 uv) {
float pulse = 0.88 + 0.12 * sin(iTime * 1.4);
// Twilight gradient sky
vec3 col = mix(vec3(0.28, 0.14, 0.24), vec3(0.03, 0.07, 0.22), clamp((uv.y + 0.12) * 1.6, 0.0, 1.0));
// Architectural skyline silhouettes
float bld1 = step(abs(uv.x + 0.34), 0.15) * step(uv.y, 0.26) * step(-0.12, uv.y);
float bld2 = step(abs(uv.x - 0.30), 0.18) * step(uv.y, 0.34) * step(-0.12, uv.y);
col = mix(col, vec3(0.025, 0.03, 0.05), max(bld1, bld2));
// Glowing HDR cyan neon bar on right building
vec2 nBar = abs(uv - vec2(0.24, 0.16)) - vec2(0.095, 0.014);
float dNeon = length(max(nBar, 0.0));
col += vec3(0.18, 2.2, 3.6) * exp(-dNeon * 38.0) * pulse;
col += vec3(0.55, 4.5, 6.2) * smoothstep(0.012, 0.002, dNeon);
// Overexposed tungsten streetlamps (prime halation triggers)
vec2 l1 = vec2(-0.18, 0.18 + 0.02 * sin(iTime * 0.7));
vec2 l2 = vec2( 0.08, 0.05);
vec2 l3 = vec2(-0.36, 0.08);
float d1 = length(uv - l1), d2 = length(uv - l2), d3 = length(uv - l3);
col += vec3(7.5, 4.8, 2.1) * smoothstep(0.042, 0.016, d1) + vec3(2.8, 1.5, 0.55) * exp(-d1 * 18.0);
col += vec3(6.8, 4.2, 1.9) * smoothstep(0.028, 0.010, d2) + vec3(2.2, 1.1, 0.42) * exp(-d2 * 24.0);
col += vec3(5.2, 3.1, 1.4) * smoothstep(0.022, 0.008, d3) + vec3(1.6, 0.85, 0.32) * exp(-d3 * 28.0);
// Wet asphalt road below y = -0.12 with stretched vertical specular streaks
if (uv.y < -0.12) {
float dist = -0.12 - uv.y;
vec2 rUv = vec2(uv.x + 0.006 * sin(uv.y * 95.0 + iTime * 2.0), -0.12 + dist * 0.92);
float streak1 = exp(-abs(rUv.x - l1.x) * 14.0) * exp(-dist * 2.2);
float streak2 = exp(-abs(rUv.x - l2.x) * 18.0) * exp(-dist * 2.8);
float streakN = exp(-abs(rUv.x - 0.24) * 9.5) * exp(-dist * 2.4);
col = vec3(0.018, 0.022, 0.032);
col += vec3(3.2, 1.85, 0.75) * streak1 * 0.85;
col += vec3(2.6, 1.45, 0.60) * streak2 * 0.72;
col += vec3(0.22, 1.85, 2.95) * streakN * 0.65 * pulse;
}
return col * max(EXPOSURE, 0.05);
}
// Emulsion Hurter-Driffield S-curve + cross-channel dye-coupler print stage
vec3 filmEmulsion(vec3 lin, vec2 uv, vec2 fragCoord) {
// 1. Red-orange anti-halation backing scatter from nearby overexposed HDR highlights
vec3 hal = vec3(0.0);
float halStr = max(HALATION, 0.0);
for (int i = 0; i < 12; i++) {
float a = float(i) * 0.523599;
vec2 dir = vec2(cos(a), sin(a));
vec3 s1 = hdrScene(uv + dir * 0.024);
vec3 s2 = hdrScene(uv + dir * 0.052);
hal += max(s1 - 1.15, 0.0) * 0.65 + max(s2 - 1.35, 0.0) * 0.35;
}
hal /= 12.0;
lin += vec3(hal.r * 0.82 + hal.g * 0.28, hal.r * 0.18 + hal.g * 0.08, hal.b * 0.02) * halStr;
// 2. Spectral-inspired cross-channel sensitivity matrix (warm tungsten skin/gold, cyan shadow tint)
mat3 sens = mat3(
0.92, 0.09, 0.02,
0.04, 0.90, 0.06,
0.01, 0.08, 0.88
);
vec3 expRGB = max(sens * lin, vec3(1e-5));
// 3. Per-layer H&D density curve (toe + gamma + shoulder rolloff)
vec3 logE = log2(expRGB) * max(CONTRAST, 0.25);
vec3 density = 1.0 / (1.0 + exp(-(logE + vec3(0.42, 0.35, 0.22))));
// 4. Print-stock dye crosstalk (subtle cool-teal shadows, creamy warm highlights)
vec3 printCol = vec3(
pow(density.r, 0.94) * 1.04,
pow(density.g, 1.00) * 1.00,
pow(density.b, 1.06) * 0.96
);
printCol += vec3(0.012, 0.024, 0.032) * (1.0 - printCol);
// 5. Luminance-dependent silver-halide grain
float g = (hash(floor(fragCoord * 0.85) + floor(iTime * 24.0) * 17.3) - 0.5) * 2.0;
float lum = dot(printCol, vec3(0.2126, 0.7152, 0.0722));
float grainEnv = smoothstep(0.0, 0.35, lum) * smoothstep(1.0, 0.45, lum);
printCol += g * max(GRAIN, 0.0) * 0.14 * (0.35 + 0.65 * grainEnv);
return clamp(printCol, 0.0, 1.0);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float splitX = 0.0;
if (iMouse.z > 0.5 || length(iMouse.xy) > 1.0) {
splitX = (iMouse.x - 0.5 * iResolution.xy.x) / iResolution.y;
}
vec3 hdr = hdrScene(uv);
vec3 col;
if (uv.x < splitX) {
// Left: raw digital hard-clipped sRGB
col = pow(clamp(hdr, 0.0, 1.0), vec3(1.0 / 2.2));
} else {
// Right: spectral photochemical film stock emulation
col = filmEmulsion(hdr, uv, fragCoord);
}
if (abs(uv.x - splitX) < 0.0025) col = vec3(1.0, 0.88, 0.62);
fragColor = vec4(col, 1.0);
}Attribution: MIT — written for this index
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| film-emulation-live | Tesla T4 1920x1080 | 34.4× baseline (heavy) · 1.13 ms / 1.87 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| film-emulation-live | NVIDIA L4 1920x1080 | 31.9× baseline (heavy) · 0.506 ms / 0.522 ms · 2.2× faster on L4 | opengl-timer-query · Cross-architecture validation |
| film-emulation-live | NVIDIA A100-SXM4-40GB 1920x1080 | 24.3× baseline (heavy) · 0.700 ms / 0.704 ms · 1.6× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
Crosses
- Film stocks exposed by spectra: Expose CG renders onto simulated film stocks from spectral radiance instead of RGB, so colour crosstalk and the look of saturated lights come from the stock's layer sensitivities, not from a guess at the spectrum made after rendering.
- Film grain synthesis: Grain layers on top of the emulated density image.
- Spectral upsampling with sigmoid polynomials: Provides spectra from RGB input.
Sources
- primaryandreavolpato (2025). andreavolpato/spektrafilm. Spectral simulation of analog photography processesGitHub API · license GPL-3.0 · 2026-11-29