Skip to content

3D engine that AI agents drive

Add a Standard view transform for Blender parity (#2026)

Nguyen Xuan Anbf4b91c4e00e
diff --git a/changes/2026.md b/changes/2026.md
new file mode 100644
index 00000000..059c5429
--- /dev/null
+++ b/changes/2026.md
@@ -0,0 +1 @@
+- Add a `standard` view transform (Blender Standard: sRGB encoding, no tone curve, clipped) beside aces, agx and neutral, in the rasterizer, the path tracer and the recipe, MCP and capabilities text (#2026)
diff --git a/changes/2026.size.md b/changes/2026.size.md
new file mode 100644
index 00000000..0a54f1d4
--- /dev/null
+++ b/changes/2026.size.md
@@ -0,0 +1,4 @@
+- entry:view-transform-shader: the Standard GLSL (about 100 bytes gzip) is the whole cost of matching a Cycles Standard reference, which the Aces, AgX and Neutral curves cannot do.
+- entry:view-transform: the sRGB encode and the standard curve are 82 bytes gzip, shared by the path tracer and the tests.
+- scene:agent-scene+lazy: 129 bytes gzip for the new view transform in the lazy scene bundle; agent-facing capability for Blender parity.
+- goal:agent-scene: 38 bytes gzip for the same Standard view transform; the default scene draws unchanged.
diff --git a/docs/lighting.md b/docs/lighting.md
index 2783beb3..55aa3644 100644
--- a/docs/lighting.md
+++ b/docs/lighting.md
@@ -231,7 +231,7 @@ Recipes reach it through `environment.shadowCascades` (an integer from 1 to 4, o
### View transform and look
-`environment.viewTransform` picks the display curve: `aces` (default, contrasty), `agx` (Blender's default, keeps bright saturated colour without clipping; pick it for a lit scene or to compare with Blender) or `neutral` (Khronos PBR Neutral, base colours show as authored; pick it for product shots and brand colours). `environment.look` adds a graded look after the curve: `warm`, `cool`, `contrast` or `faded`. In code, `new CrucibleRenderer(canvas, parts, { viewTransform: 'agx', look })` takes a look from `parseCube(text)` (a 3D `.cube` file, up to size 65) in `@codepawlhq/crucible/addons/view-transform`; recipes and MCP never take a file path. The curves and the look live in `@codepawlhq/crucible/addons/view-transform-shader`, which a recipe loads through `loadAgentSceneModules`; the default curve costs nothing extra. The path tracer takes the same `viewTransform` and `look` options, so a still and its path-traced image match. The look is not applied to Gaussian splats.
+`environment.viewTransform` picks the display curve: `aces` (default, contrasty), `agx` (Blender's default, keeps bright saturated colour without clipping; pick it for a lit scene or to compare with Blender) `neutral` (Khronos PBR Neutral, base colours show as authored; pick it for product shots and brand colours) or `standard` (Blender's Standard: the sRGB curve with no tone mapping, so a channel above 1 clips; pick it to match a Cycles render that uses Standard, such as the explosion reference, and keep emission within 1 where you can). `environment.look` adds a graded look after the curve: `warm`, `cool`, `contrast` or `faded`. In code, `new CrucibleRenderer(canvas, parts, { viewTransform: 'agx', look })` takes a look from `parseCube(text)` (a 3D `.cube` file, up to size 65) in `@codepawlhq/crucible/addons/view-transform`; recipes and MCP never take a file path. The curves and the look live in `@codepawlhq/crucible/addons/view-transform-shader`, which a recipe loads through `loadAgentSceneModules`; the default curve costs nothing extra. The path tracer takes the same `viewTransform` and `look` options, so a still and its path-traced image match. The look is not applied to Gaussian splats.
## Light linking
diff --git a/docs/parity.md b/docs/parity.md
index 147af63e..ce1689a0 100644
--- a/docs/parity.md
+++ b/docs/parity.md
@@ -208,7 +208,7 @@ To move to a new Blender release, run `node scripts/parity-manual-snapshot.mjs`.
| Rendering > Shader Nodes > Color | partial | Color ramp, mix and invert. There is no hue, curves, gamma or blend modes. | [material-graph](../tests/material-graph.test.js) | #50 |
| Rendering > Shader Nodes > Utilities | partial | Maths on numbers and vectors: add, sub, mul, div, min, max, pow, abs, floor, fract, sqrt, clamp and smoothstep. There is no vector maths, mapping, map range or separate and combine nodes. | [material-graph](../tests/material-graph.test.js) | #50 |
| Rendering > Shader Nodes > Group | missing | No node graph. | | #50 |
-| Rendering > Color Management | partial | View transforms `aces` (default), `agx` and `neutral` (Khronos PBR Neutral) in the rasterizer and the path tracer, and `.cube` look LUTs or four named looks; grading as before. Neutral matches Blender 5.2 within 0.01 on a ramp, AgX within 0.026 (a fit of Blender 5.2's AgX LUT; saturated colour is the part that is off). No choice of working color space or display device; no Filmic or Standard. | [view transforms](../tests/view-transform.test.js), [effects](../tests/effects.test.js) | AgX looks |
+| Rendering > Color Management | partial | View transforms `aces` (default), `agx`, `neutral` (Khronos PBR Neutral) and `standard` (sRGB, no tone curve, clipped) in the rasterizer and the path tracer, and `.cube` look LUTs or four named looks; grading as before. Neutral matches Blender 5.2 within 0.01 on a ramp, AgX within 0.026 (a fit of Blender 5.2's AgX LUT; saturated colour is the part that is off). No choice of working color space or display device; no Filmic. | [view transforms](../tests/view-transform.test.js), [effects](../tests/effects.test.js) | AgX looks |
| Rendering > Freestyle | partial | `environment.lines` draws silhouette, boundary and crease lines in screen space, and `polylines` draws screen-width lines in the world. There are no line sets, styles or strokes along curves. Outline width is 1.65 px at 960x540 and 1.60 px at 3840x2160 for a requested 2 px, against 1.73 px in Freestyle ([comparison](line-art.md)). | [line-art](../tests/line-art.test.js), [guide](line-art.md), [reference script](../bench/reference/line-art.mjs) | |
| Rendering > View Layers & Passes | partial | Render jobs write albedo, normal, emission, depth, object ID, the lighting passes diffuse, glossy, shadow, ao, mist, transmission, volume and environment, and the auxiliary passes position, velocity, uv, cryptomatte (with object and material manifests in job metrics) and aov (from `material.aov` or a material graph's `aov` output) as PNG, PNG16, single-pass EXR or multilayer EXR (`multilayer: true`, packing `Combined` and `<pass>.<channel>` into one `.exr` per frame). There are no view layers or per-layer collection overrides. | [render-passes](../tests/render-passes.test.js), [lighting-passes](../tests/lighting-passes.test.js) | #54, #601, #706 |
| Rendering > Render Output > Output Properties | partial | PNG and MP4, frame rate, duration (to 60 s) and size, and a CPU or NVENC encoder. There is no stereo or metadata. | [agent-render-jobs](../tests/agent-render-jobs.test.js) | #60 |
diff --git a/docs/path-tracer.md b/docs/path-tracer.md
index 837f34a4..6aa73eba 100644
--- a/docs/path-tracer.md
+++ b/docs/path-tracer.md
@@ -180,7 +180,7 @@ The 1920 by 1080 still of `tests/fixtures/demo-room.recipe.json` at `samples: 64
## Display bytes on the GPU for native film frames
-A native session frame (`scripts/agent-native-sequence.mjs`) with no JavaScript denoiser and no temporal blend asks Cook for its post stage (`post: { viewTransform, exposure }`, mapped by `scripts/native-post-look.mjs`), so the 8-bit picture comes from the card instead of the per-pixel loop in `toneMapToRgba8`. Cook documents 2/255 per channel against that helper, which stays the reference; `tests/native-post.test.js` checks aces, agx and neutral against it on the real addon. Every other frame (the OIDN or wavelet denoiser, a temporal blend, a 3D look table, a view transform Cook lacks, no session) uses the helper, and `report.display` names the path and the reason. Grain, bloom, vignette, saturation, contrast and temperature are not part of a native film frame today (`listIgnoredFrameEffects`), so they are not mapped. PNG encoding of these frames goes through `scripts/native-png.mjs` (Node's zlib does the checksums).
+A native session frame (`scripts/agent-native-sequence.mjs`) with no JavaScript denoiser and no temporal blend asks Cook for its post stage (`post: { viewTransform, exposure }`, mapped by `scripts/native-post-look.mjs`), so the 8-bit picture comes from the card instead of the per-pixel loop in `toneMapToRgba8`. Cook documents 2/255 per channel against that helper, which stays the reference; `tests/native-post.test.js` checks aces, agx and neutral against it on the real addon. Every other frame (the OIDN or wavelet denoiser, a temporal blend, a 3D look table, a view transform Cook lacks, such as `standard`, no session) uses the helper, and `report.display` names the path and the reason. Grain, bloom, vignette, saturation, contrast and temperature are not part of a native film frame today (`listIgnoredFrameEffects`), so they are not mapped. PNG encoding of these frames goes through `scripts/native-png.mjs` (Node's zlib does the checksums).
Measured once on the RTX 3060, 1920 by 1080, traced film to encoded PNG, median of 7 (`node scripts/benchmark-native-post.mjs`): 276 ms with the helper and the portable encoder, 22 ms with Cook post and the Node encoder (post 13 ms, encode about 9 ms; the encode part is a gain for the helper path too).
diff --git a/scripts/blender-inventory-compare.mjs b/scripts/blender-inventory-compare.mjs
index cb19ec19..9bbb5b2c 100644
--- a/scripts/blender-inventory-compare.mjs
+++ b/scripts/blender-inventory-compare.mjs
@@ -245,7 +245,7 @@ function comparePhysics(inventory) {
function compareRender(inventory) {
const colour = inventory.color_management;
- const viewTransformMap = { 'Khronos PBR Neutral': ['done', 'neutral'], 'AgX': ['done', 'agx'], 'ACES 2.0': ['partial', 'aces (ACES 1.3 style fit)'], 'ACES 1.3': ['partial', 'aces'] };
+ const viewTransformMap = { 'Khronos PBR Neutral': ['done', 'neutral'], 'AgX': ['done', 'agx'], 'Standard': ['done', 'standard'], 'ACES 2.0': ['partial', 'aces (ACES 1.3 style fit)'], 'ACES 1.3': ['partial', 'aces'] };
const engineMap = { CYCLES: ['partial', 'CPU path tracer, addons/path-tracer'], BLENDER_EEVEE: ['partial', 'WebGL2 rasterizer'], BLENDER_WORKBENCH: ['out of scope', 'Workbench is a viewport engine'] };
const lightMap = { POINT: ['done', 'pointLights (16)'], SUN: ['done', 'directional key light'], SPOT: ['done', 'spotLights (8)'], AREA: ['partial', 'areaLights (7), no shadow'] };
const probeMap = { SPHERE: ['partial', 'bake.probes, specular only'], PLANE: ['missing', ''], VOLUME: ['missing', 'irradiance grid in progress, issue #543'] };
@@ -254,7 +254,7 @@ function compareRender(inventory) {
engines: mapEnum(inventory.render.engines.map(engine => engine.identifier), engineMap),
lights: mapEnum(inventory.lights_cameras_world.light_types.map(item => item.identifier), lightMap),
probes: mapEnum(inventory.lights_cameras_world.light_probe_types.map(item => item.identifier), probeMap),
- viewTransforms: colour.view_transforms.map(name => ({ name, status: viewTransformMap[name]?.[0] ?? 'missing', note: viewTransformMap[name]?.[1] ?? 'Not offered; Crucible has aces, agx, neutral' })),
+ viewTransforms: colour.view_transforms.map(name => ({ name, status: viewTransformMap[name]?.[0] ?? 'missing', note: viewTransformMap[name]?.[1] ?? 'Not offered; Crucible has aces, agx, neutral, standard' })),
lookCounts,
displayDevices: colour.display_devices,
settingGroups: Object.entries(inventory.render.engine_settings).map(([name, properties]) => ({ name, count: properties.length })),
diff --git a/scripts/mcp-server.mjs b/scripts/mcp-server.mjs
index c92fb7d4..bd410e10 100644
--- a/scripts/mcp-server.mjs
+++ b/scripts/mcp-server.mjs
@@ -314,7 +314,7 @@ const environment = z.strictObject({
sunBounce: z.number().min(0).optional().describe('Sun bounce in a closed room: 0 off, 1 default.'),
specularAntiAliasing: z.number().min(0).max(4).optional().describe('Specular anti-aliasing: 0 off, 1 default; widens highlights that sparkle on grainy normal-mapped metal.'),
resolveCoplanar: z.union([z.literal('offset'), z.literal(false)]).optional().describe("Flush faces are ranked at draw time by default ('offset'); false opts out."),
- viewTransform: z.enum(VIEW_TRANSFORM_NAMES).optional().describe('Display transform, for example agx to compare with Blender.'),
+ viewTransform: z.enum(VIEW_TRANSFORM_NAMES).optional().describe('Display transform, agx or standard to compare with Blender.'),
look: z.union([z.enum([...LOOK_NAMES, ...BUNDLED_CUBE_LOOK_NAMES]), z.string().regex(CATALOG_FILE_ID)]).nullable().optional().describe('Look preset or .cube; scene_capabilities catalogLooks. null clears.'),
sky: z.record(z.string(), z.unknown()).nullable().optional().describe('Physical sky: {type:"physical", sunElevation, sunRotation, turbidity, groundAlbedo, aerialPerspective}; sets key light, sky and fog. Fields in scene_capabilities physicalSky.'),
wind: z.strictObject({ strength: bounded(0, 4).optional(), direction: bounded(-360, 360).optional().describe('Degrees: 0 toward +x, 90 toward +z.') }).optional().describe('Sway of foliage and grass materials; strength defaults to 0.3.'),
diff --git a/skills/build-crucible-scene/references/look.md b/skills/build-crucible-scene/references/look.md
index 5075ea6e..9a05d6d2 100644
--- a/skills/build-crucible-scene/references/look.md
+++ b/skills/build-crucible-scene/references/look.md
@@ -58,8 +58,9 @@ key light. `"hdri": null` clears it. `ambientIntensity` also scales the HDRI's d
## Color look and tone mapping
`environment.look` is one of `warm`, `cool`, `contrast`, `faded`, a shipped cube (`teal-orange`, `noir`) or the
-64-character ID of a `.cube` file from `scene_asset_catalog`. `environment.viewTransform` is `aces` (default), `agx` or
-`neutral`.
+64-character ID of a `.cube` file from `scene_asset_catalog`. `environment.viewTransform` is `aces` (default), `agx`,
+`neutral` or `standard` (Blender Standard: sRGB, no tone curve, values above 1 clip; pick it to match a Cycles
+reference rendered with Standard).
Tool `scene_apply`:
diff --git a/skills/build-crucible-scene/references/scene-contract.md b/skills/build-crucible-scene/references/scene-contract.md
index 1302f658..1971538d 100644
--- a/skills/build-crucible-scene/references/scene-contract.md
+++ b/skills/build-crucible-scene/references/scene-contract.md
@@ -69,7 +69,7 @@ Local `environment.pointLights` support 16 world-space sources with inverse-squa
Each light provides `position` and optional `color`, `intensity`, `radius`, `range` and `castShadow`.
`environment.spotLights` (eight) take `position`, `direction`, and optional `angle` (outer half angle in radians, default 0.785), `penumbra` (0 to 1, default 0.15), `color`, `intensity`, `radius`, `range` and `castShadow`. Intensity is candela, the same unit as a point light.
`environment.areaLights` (up to seven) are rectangles with `position`, `direction` (the side that emits), `width`, `height`, optional `up`, `color` and `intensity` (candela seen head on). With `castShadow: true` (1 of the 24 tiles) they cast a soft shadow. `environment.sunAngularRadius` (radians) softens the sun shadow; `ies` on a spot or area light takes `downlight`, `wide-flood`, `narrow-spot`, `batwing` or `{ angles, candela }`.
-`environment.viewTransform` (`aces` default, `agx` for lit scenes and Blender comparisons, `neutral` for product and brand colour) and `environment.look` (`warm`, `cool`, `contrast`, `faded`) set the display curve and a grade; `scene_capabilities.viewTransform` says when to pick each, and a recipe using them needs `loadAgentSceneModules`.
+`environment.viewTransform` (`aces` default, `agx` for lit scenes and Blender comparisons, `neutral` for product and brand colour, `standard` to match a Blender Standard reference) and `environment.look` (`warm`, `cool`, `contrast`, `faded`) set the display curve and a grade; `scene_capabilities.viewTransform` says when to pick each, and a recipe using them needs `loadAgentSceneModules`.
`castShadow: true` on a point light uses 6 of the 24 shadow tiles, on a spot light 1. Past 24 the edit is rejected. Shadows reach `range`, or 30 units when `range` is 0. Set `castShadow` on the few lights that show a visible shadow, because each one adds a depth pass. `affects: ['node-id', ...]` on a point, spot or area light, and `environment.keyAffects` for the sun, limit a light to those nodes (a light without it lights every node; an unknown ID is rejected; the bake honours it, the path tracer ignores it and says so). `environment.shadowCascades` (1 to 4, 0 for one map) sharpens a long sun shadow near the camera; it turns on by itself at 3 when `shadow.extent` is above 40, so set it only to choose another count or 0. Details: docs/lighting.md.
`keyIntensity`, `fillIntensity` and `ambientIntensity` independently scale existing lighting.
diff --git a/src/agent-scene-capabilities.js b/src/agent-scene-capabilities.js
index 192f3f32..3d5268c1 100644
--- a/src/agent-scene-capabilities.js
+++ b/src/agent-scene-capabilities.js
@@ -315,7 +315,7 @@ export const AGENT_SCENE_CAPABILITIES = Object.freeze({
lineArt: Object.freeze({ field: 'environment.lines', fields: 'width px 0.25-16 (1.5), color, boundaries, creaseAngle deg (35), depthJump (0.08), toon steps 0-8, polylines [{points [x,y,z] 2-256, color, width, depthTest, closed}] max 64, nodes {id:{lines,silhouetteOnly,color}}; {} turns on, null clears; material toon 0-8', note: 'docs/line-art.md' }),
viewTransform: Object.freeze({
field: 'environment.viewTransform', names: VIEW_TRANSFORM_NAMES, default: 'aces', look: 'environment.look', looks: LOOK_NAMES,
- choose: 'agx for lit scenes and Blender comparisons, neutral for product and brand colour, aces for contrast; needs loadAgentSceneModules',
+ choose: 'agx for lit scenes and Blender comparisons, neutral for product and brand colour, standard to match a Blender Standard reference (sRGB, no tone curve, values above 1 clip), aces for contrast; needs loadAgentSceneModules',
}),
// Flush surfaces flicker (z-fighting). They are ranked at draw time by default; coplanar-overlap warns about what is left.
renderFlags: Object.freeze({ nodeFields: Object.freeze(['visible', 'castShadow', 'receiveShadow', 'holdout', 'shadowCatcher', 'shadowOnly']), rayVisibility: "mesh node, path tracer only: 'glass' (a pane lets shadow rays through) or {camera,diffuse,glossy,transmission,shadow,volumeScatter: false} hides it from that ray; emitters cannot hide from the last three", motion: 'node track property visible: 1 or 0, STEP', note: 'visible:false hides a node and children; holdout and shadowCatcher need a transparent canvas (CrucibleRenderer transparent:true); flags split batches. Blended and transmissive parts cast a sun shadow weighted by opacity and tinted by colour (1024 map, one extra draw of those parts only); shadowOnly:true casts a shadow and is not drawn (gobo); castShadow:false turns it off, and cascades or splat/3-layer-map receivers skip the tint.' }),
diff --git a/src/agent-scene-modules.js b/src/agent-scene-modules.js
index b09e8e65..9e8c4217 100644
--- a/src/agent-scene-modules.js
+++ b/src/agent-scene-modules.js
@@ -96,7 +96,7 @@ const MODULE_MARKERS = {
vegetation: ['"vegetation":{', '"wind":{'],
crowd: ['"crowd":{'],
lineArt: ['"lines":{', '"toon":'],
- viewTransform: ['"viewTransform":"agx"', '"viewTransform":"neutral"', '"look":"'],
+ viewTransform: ['"viewTransform":"agx"', '"viewTransform":"neutral"', '"viewTransform":"standard"', '"look":"'],
// Flush faces are ranked whenever this is loaded (issue #751): the MCP preview registers it, loadAllAgentSceneModules loads it,
// and so does a recipe that names resolveCoplanar or places an asset, since glTF models nest facades a few millimetres apart.
// A recipe of plain primitives in a host without it stays free of the 85 KB of flush code, so it needs no on-demand module.
diff --git a/src/view-transform-names.js b/src/view-transform-names.js
index b0a643a6..dea9ce4a 100644
--- a/src/view-transform-names.js
+++ b/src/view-transform-names.js
@@ -1,7 +1,7 @@
// The names a recipe may use, kept apart from the curves so that validating a recipe does not pull the curves in.
-/** Display transforms: aces is the built-in curve and the default. */
-export const VIEW_TRANSFORM_NAMES = Object.freeze(['aces', 'agx', 'neutral']);
+/** Display transforms: aces is the built-in curve and the default; standard is Blender's Standard (the sRGB curve, no tone mapping). */
+export const VIEW_TRANSFORM_NAMES = Object.freeze(['aces', 'agx', 'neutral', 'standard']);
/** Looks a recipe can name. They are built in code, so no file path crosses the recipe or the MCP boundary. */
export const LOOK_NAMES = Object.freeze(['warm', 'cool', 'contrast', 'faded']);
diff --git a/src/view-transform-shader.js b/src/view-transform-shader.js
index 498275db..f5dcdda7 100644
--- a/src/view-transform-shader.js
+++ b/src/view-transform-shader.js
@@ -3,9 +3,9 @@ import { AGX_CONSTANTS, NEUTRAL_CONSTANTS, namedLook } from './view-transform.js
import { VIEW_TRANSFORM_NAMES, LOOK_NAMES } from './view-transform-names.js';
import { catalogLook } from './look-catalog.js';
-// The GLSL of the AgX and Khronos PBR Neutral view transforms and of the look LUT. It lives outside shaders.js so a
-// scene on the default curve never downloads it: the renderer asks for it only when it is given viewTransform: 'agx' or
-// 'neutral', or a look, and importing this module (or loading it through loadAgentSceneModules) registers it.
+// The GLSL of the AgX, Khronos PBR Neutral and Standard view transforms and of the look LUT. It lives outside shaders.js so a
+// scene on the default curve never downloads it: the renderer asks for it only when it is given viewTransform: 'agx',
+// 'neutral' or 'standard', or a look, and importing this module (or loading it through loadAgentSceneModules) registers it.
// The constants are printed from view-transform.js, which the path tracer and the tests read, so the curves cannot drift.
// The renderer carries the display curve in four programs (the main fragment, the liquid fragment, the environment
// background and the HDR post pass). Each holds the ACES fit as one expression, which apply swaps for a call to
@@ -54,6 +54,14 @@ const NEUTRAL_GLSL = `vec3 selectedViewTransform(vec3 color) {
return clamp(mix(color, vec3(newPeak), desaturate), 0.0, 1.0);
}`;
+const STANDARD_GLSL = `vec3 selectedViewTransform(vec3 color) {
+ vec3 clipped = clamp(color, 0.0, 1.0);
+ vec3 encoded = mix(clipped * 12.92, 1.055 * pow(clipped, vec3(1.0 / 2.4)) - 0.055, step(0.0031308, clipped));
+ return pow(encoded, vec3(2.2));
+}`;
+
+const VIEW_TRANSFORM_GLSL = { agx: AGX_GLSL, neutral: NEUTRAL_GLSL, standard: STANDARD_GLSL };
+
const LOOK_GLSL = `uniform highp sampler3D ${LOOK_UNIFORM};
vec3 applyLook(vec3 color) {
float size = float(textureSize(${LOOK_UNIFORM}, 0).x);
@@ -72,7 +80,7 @@ function apply(source, kind, viewTransform, hasLook) {
let result = source;
if (viewTransform !== 'aces') {
if (!result.includes(ACES_EXPRESSION)) throw new Error(`The ${kind} shader no longer holds the ACES expression that a view transform replaces.`);
- result = insertAfterPrecision(result.replaceAll(ACES_EXPRESSION, 'selectedViewTransform(color)'), viewTransform === 'agx' ? AGX_GLSL : NEUTRAL_GLSL);
+ result = insertAfterPrecision(result.replaceAll(ACES_EXPRESSION, 'selectedViewTransform(color)'), VIEW_TRANSFORM_GLSL[viewTransform]);
}
if (hasLook && kind === 'post') {
if (!result.includes(POST_FINISH_LINE)) throw new Error('The post shader no longer holds the line that a look is applied before.');
diff --git a/src/view-transform.js b/src/view-transform.js
index 00f4661c..2e10adf5 100644
--- a/src/view-transform.js
+++ b/src/view-transform.js
@@ -7,7 +7,8 @@ import { LOOK_NAMES, VIEW_TRANSFORM_NAMES } from './view-transform-names.js';
// sigmoid, a 2.4 power, a matrix back to Rec.709) as a fit of AgX_Base_sRGB.cube, not the 57-point LUT itself. The
// older Filament/three.js polynomial put 0.18 grey 0.04 above Blender (0.501 against 0.461).
// - neutral is the Khronos PBR Neutral tone mapper: base colours below 0.76 pass unchanged.
-// All three take linear sRGB and return display-linear sRGB in 0 to 1; the caller encodes with a power of 1 / 2.2.
+// - standard is Blender's Standard: the sRGB encoding of the clipped scene value, with no tone curve. A value above 1 clips.
+// All four take linear sRGB and return display-linear sRGB in 0 to 1; the caller encodes with a power of 1 / 2.2.
const rowsToColumns = rows => rows[0].map((_, column) => rows.map(row => row[column]));
@@ -79,6 +80,17 @@ export function neutralColor(rgb) {
return shifted.map(channel => clampUnit(channel * newPeak / peak * (1 - mix) + newPeak * mix));
}
+/** The sRGB transfer function of one linear channel clipped to 0 to 1 (IEC 61966-2-1). */
+export function srgbEncode(value) {
+ const color = clampUnit(value);
+ return color <= 0.0031308 ? color * 12.92 : 1.055 * color ** (1 / 2.4) - 0.055;
+}
+
+/** Blender Standard. The caller encodes with a power of 1 / 2.2, so this returns the value that power turns into the sRGB encoding. */
+export function standardColor(rgb) {
+ return rgb.map(channel => srgbEncode(channel) ** 2.2);
+}
+
const LARGEST_RADIANCE = 1e30;
// NaN reads as black and infinity as a very bright finite value, so one bad channel cannot turn the whole pixel into NaN
@@ -90,6 +102,7 @@ export function applyViewTransform(name, rgb) {
const finite = rgb.map(finiteChannel);
if (name === 'agx') return agxColor(finite);
if (name === 'neutral') return neutralColor(finite);
+ if (name === 'standard') return standardColor(finite);
if (name === 'aces' || name === undefined) return finite.map(acesChannel);
throw new RangeError(`viewTransform must be one of ${VIEW_TRANSFORM_NAMES.join(', ')}.`);
}
diff --git a/tests/view-transform-standard.test.js b/tests/view-transform-standard.test.js
new file mode 100644
index 00000000..34379311
--- /dev/null
+++ b/tests/view-transform-standard.test.js
@@ -0,0 +1,58 @@
+import assert from 'node:assert/strict';
+import test from 'node:test';
+import { toneMapToRgba8 } from '../src/path-tracer.js';
+import { normalizeAgentLook } from '../src/agent-look.js';
+import { fragmentShader, viewTransformShader } from '../src/shaders.js';
+import { applyViewTransform, displayColor, srgbEncode, standardColor } from '../src/view-transform.js';
+import { VIEW_TRANSFORM_NAMES } from '../src/view-transform-names.js';
+import '../src/view-transform-shader.js';
+
+const closeTo = (actual, expected, tolerance = 1e-4) => assert.ok(Math.abs(actual - expected) <= tolerance, `${actual} is not within ${tolerance} of ${expected}`);
+
+test('standard is the sRGB curve with no tone mapping and clips above 1', () => {
+ closeTo(srgbEncode(0), 0);
+ closeTo(srgbEncode(0.0031308), 0.04045, 1e-5);
+ closeTo(srgbEncode(0.18), 0.4614, 5e-4);
+ closeTo(srgbEncode(1), 1);
+ closeTo(srgbEncode(2), 1);
+ closeTo(srgbEncode(-3), 0);
+});
+
+test('standard goes through the 1 / 2.2 power the renderer applies and comes out as the sRGB encoding', () => {
+ const display = displayColor([0.18, 1, 4], { viewTransform: 'standard' });
+ closeTo(display[0], srgbEncode(0.18));
+ closeTo(display[1], 1);
+ closeTo(display[2], 1);
+ assert.deepEqual(standardColor([0, 0, 0]), [0, 0, 0]);
+ assert.notDeepEqual(applyViewTransform('standard', [0.18, 0.18, 0.18]), applyViewTransform('neutral', [0.18, 0.18, 0.18]));
+});
+
+test('standard differs from neutral, which shifts shadows and compresses highlights', () => {
+ const fireball = [6, 2.2, 0.3];
+ const standard = displayColor(fireball, { viewTransform: 'standard' });
+ const neutral = displayColor(fireball, { viewTransform: 'neutral' });
+ assert.deepEqual(standard.map(value => Math.round(value * 255)), [255, 255, 149]);
+ assert.ok(neutral[1] < standard[1] - 0.05, 'neutral compresses the highlight that standard clips');
+});
+
+test('the path tracer image and the shader apply it, and the default is untouched', () => {
+ const linear = new Float32Array([0.18, 0.18, 0.18, 2, 2, 2]);
+ const bytes = toneMapToRgba8(linear, 2, 1, { viewTransform: 'standard' });
+ assert.deepEqual([...bytes], [118, 118, 118, 255, 255, 255, 255, 255]);
+ const shader = viewTransformShader.apply(fragmentShader, 'main', 'standard', false);
+ assert.ok(shader.includes('0.0031308') && shader.includes('selectedViewTransform(color)') && !shader.includes('2.51 * color'));
+ assert.deepEqual([...toneMapToRgba8(linear, 2, 1)], [...toneMapToRgba8(linear, 2, 1, { viewTransform: 'aces' })]);
+});
+
+test('standard is accepted by the recipe, the names and the capabilities text', () => {
+ assert.ok(VIEW_TRANSFORM_NAMES.includes('standard'));
+ assert.equal(normalizeAgentLook({ environment: { viewTransform: 'standard' } }).environment.viewTransform, 'standard');
+ assert.throws(() => normalizeAgentLook({ environment: { viewTransform: 'filmic' } }), /expected one of aces, agx, neutral, standard/);
+});
+
+test('a native film frame with standard falls back to the JavaScript path, so Cook needs no change', async () => {
+ const { mapLookToCookPost } = await import('../scripts/native-post-look.mjs');
+ const mapped = mapLookToCookPost({ viewTransform: 'standard' });
+ assert.equal(mapped.post, undefined);
+ assert.match(mapped.reason, /no "standard" view transform/);
+});
diff --git a/tests/view-transform.test.js b/tests/view-transform.test.js
index 4b2d42b9..49903c3a 100644
--- a/tests/view-transform.test.js
+++ b/tests/view-transform.test.js
@@ -84,7 +84,7 @@ test('the GLSL of agx and neutral prints the constants the path tracer uses', ()
test('the display curve is replaced in all four programs, and the look only in the post pass', () => {
const sources = { main: fragmentShader, liquid: liquidFragmentShader, background: environmentBackgroundFragment, post: postFragment };
for (const [kind, source] of Object.entries(sources)) {
- for (const name of ['agx', 'neutral']) {
+ for (const name of ['agx', 'neutral', 'standard']) {
const changed = viewTransformShader.apply(source, kind, name, false);
assert.ok(!changed.includes('2.51 * color'), `${kind} ${name} drops the ACES fit`);
assert.ok(changed.includes('selectedViewTransform(color)'));