Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(post): AgX reads its table tetrahedrally as Blender does, so greys stay grey; oracle scenes for AgX against Blender and for soft point and spot shadows

yhh8a6c52125ee6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 808c4dec6..b1c3fb850 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@ published separately; it ships inside the editor.
- **Voxel Ground compiles on WebGPU again.** The Model shader's new wet-ground map left the voxel ground one texture past what a shader has units for, so its last texture was dropped and the whole shader was refused (`unresolved value 'u_wetMask'`). Voxel ground takes no wet map.
- **Several editors open at once can be told apart by an agent, and each grants on its own.** An editor advertises itself in a file of its own (its process id, its project, its port, its permission) instead of the one file the last editor to start overwrote. An agent attached to more than one gets `list_editors` and `select_editor` (or `--instance` / `ESTELLA_MCP_INSTANCE`), and until it chooses it is refused with the list rather than sent to whichever window won. It then drives the editor it chose and no other. The Read only / Can edit permission belongs to the editor window it is switched in and every editor starts read-only; it is no longer a saved setting that a second editor inherited. The Connect AI Tools dialog shows which editor it is.
- **Fog, water, sky, rain, depth of field and light shafts work under an orthographic camera.** Distance Fog, Height Fog (and its volumetric pass), Underwater, Sky Atmosphere with its clouds, Rain and Depth of Field measured how far a surface is from the camera starting at depth 0, which for an orthographic eye is a plane as far behind the camera as the far plane is ahead (the projection runs from -far to far so 2D content behind the camera still draws). Distance Fog read every surface as past its end and fogged a scene to full colour at any near and far, Height Fog added a camera-length of extra air, Underwater took the camera for being above the water and drew nothing, the cloud layer, placed by that height, stood kilometres off, so a floor above the clouds was still in their shadow, Rain drew its streak layers in front of surfaces a few units from the eye, and Depth of Field blurred what stood exactly at its focus distance. Light Shafts projected the sun to a place on screen, which an orthographic camera does not have (the sun is at infinity), so the shafts were gone; they now run along the sun's direction on screen, as strong as a 60 degree perspective camera would have them for the angle the view makes with the sun. The rest now start from the plane the camera stands in. Perspective cameras are unchanged. Found by the closed-form render checks in `tools/oracle`, which draw spheres, floors and patches whose answer is a formula.
+- **AgX keeps greys grey.** The effect read its 32^3 table by trilinear interpolation; Blender's colour configuration names tetrahedral for the same table, and between the table's nodes the two are not alike: a neutral input came out tinted (middle grey 6 codes short in red, a saturated blue 12 short), where Blender gives 118 / 118 / 118. It reads the table by tetrahedral interpolation now, on both backends, and greys match Blender to 2 codes. Saturated colours with one dark channel are still up to 7 codes off (the table is a 32^3 resample of Blender's 57^3), and the contrast look (`u_contrast` 1.2, Blender's Medium High Contrast) is a contrast in a different log space from Blender's, the same on greys and within 14 codes on saturated colours. Checked against Blender 5.2's own AgX by the render checks in `tools/oracle`, which keep Blender's output as data.
### Changed
diff --git a/fixtures/scenes/oracle-agx-colour-a.esscene b/fixtures/scenes/oracle-agx-colour-a.esscene
new file mode 100644
index 000000000..92598db3c
--- /dev/null
+++ b/fixtures/scenes/oracle-agx-colour-a.esscene
@@ -0,0 +1,398 @@
+{
+ "version": 4,
+ "name": "oracle-agx-colour-a",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Patch0",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -75,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.8,
+ "g": 0.1,
+ "b": 0.05,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Patch1",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -25,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.05,
+ "g": 0.6,
+ "b": 0.1,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Patch2",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 25,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.05,
+ "g": 0.1,
+ "b": 0.9,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "name": "Patch3",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 75,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.9,
+ "g": 0.7,
+ "b": 0.1,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 5,
+ "name": "Patch4",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -75,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.2,
+ "g": 0.3,
+ "b": 0.4,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 6,
+ "name": "Patch5",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -25,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.02,
+ "g": 0.4,
+ "b": 0.35,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 7,
+ "name": "Patch6",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 25,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 1.5,
+ "g": 0.6,
+ "b": 0.2,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 8,
+ "name": "Patch7",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 75,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.5,
+ "g": 0.5,
+ "b": 0.5,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 9,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "agx",
+ "enabled": true,
+ "uniforms": {
+ "u_contrast": 1
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-agx-colour-b.esscene b/fixtures/scenes/oracle-agx-colour-b.esscene
new file mode 100644
index 000000000..693af2d99
--- /dev/null
+++ b/fixtures/scenes/oracle-agx-colour-b.esscene
@@ -0,0 +1,398 @@
+{
+ "version": 4,
+ "name": "oracle-agx-colour-b",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Patch0",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -75,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 4,
+ "g": 0.5,
+ "b": 0.2,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Patch1",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -25,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.1,
+ "g": 3,
+ "b": 0.1,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Patch2",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 25,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.3,
+ "g": 0.3,
+ "b": 6,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "name": "Patch3",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 75,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 2,
+ "g": 1.5,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 5,
+ "name": "Patch4",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -75,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.01,
+ "g": 0.02,
+ "b": 0.05,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 6,
+ "name": "Patch5",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -25,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 1,
+ "g": 0.05,
+ "b": 0.05,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 7,
+ "name": "Patch6",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 25,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.05,
+ "g": 1,
+ "b": 0.05,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 8,
+ "name": "Patch7",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 75,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.05,
+ "g": 0.05,
+ "b": 1,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 9,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "agx",
+ "enabled": true,
+ "uniforms": {
+ "u_contrast": 1
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-agx-contrast-colour.esscene b/fixtures/scenes/oracle-agx-contrast-colour.esscene
new file mode 100644
index 000000000..29e592834
--- /dev/null
+++ b/fixtures/scenes/oracle-agx-contrast-colour.esscene
@@ -0,0 +1,398 @@
+{
+ "version": 4,
+ "name": "oracle-agx-contrast-colour",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Patch0",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -75,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.8,
+ "g": 0.1,
+ "b": 0.05,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Patch1",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -25,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.05,
+ "g": 0.6,
+ "b": 0.1,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Patch2",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 25,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.05,
+ "g": 0.1,
+ "b": 0.9,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "name": "Patch3",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 75,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.9,
+ "g": 0.7,
+ "b": 0.1,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 5,
+ "name": "Patch4",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -75,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.2,
+ "g": 0.3,
+ "b": 0.4,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 6,
+ "name": "Patch5",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -25,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.02,
+ "g": 0.4,
+ "b": 0.35,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 7,
+ "name": "Patch6",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 25,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 1.5,
+ "g": 0.6,
+ "b": 0.2,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 8,
+ "name": "Patch7",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 75,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.5,
+ "g": 0.5,
+ "b": 0.5,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 9,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "agx",
+ "enabled": true,
+ "uniforms": {
+ "u_contrast": 1.2
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-agx-contrast-grey.esscene b/fixtures/scenes/oracle-agx-contrast-grey.esscene
new file mode 100644
index 000000000..e6c21b92d
--- /dev/null
+++ b/fixtures/scenes/oracle-agx-contrast-grey.esscene
@@ -0,0 +1,398 @@
+{
+ "version": 4,
+ "name": "oracle-agx-contrast-grey",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Patch0",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -75,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.002,
+ "g": 0.002,
+ "b": 0.002,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Patch1",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -25,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.01,
+ "g": 0.01,
+ "b": 0.01,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Patch2",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 25,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.03,
+ "g": 0.03,
+ "b": 0.03,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "name": "Patch3",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 75,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.09,
+ "g": 0.09,
+ "b": 0.09,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 5,
+ "name": "Patch4",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -75,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.18,
+ "g": 0.18,
+ "b": 0.18,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 6,
+ "name": "Patch5",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -25,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.3,
+ "g": 0.3,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 7,
+ "name": "Patch6",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 25,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.5,
+ "g": 0.5,
+ "b": 0.5,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 8,
+ "name": "Patch7",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 75,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.8,
+ "g": 0.8,
+ "b": 0.8,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 9,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "agx",
+ "enabled": true,
+ "uniforms": {
+ "u_contrast": 1.2
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-agx-grey-high.esscene b/fixtures/scenes/oracle-agx-grey-high.esscene
new file mode 100644
index 000000000..82c9c9a89
--- /dev/null
+++ b/fixtures/scenes/oracle-agx-grey-high.esscene
@@ -0,0 +1,398 @@
+{
+ "version": 4,
+ "name": "oracle-agx-grey-high",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Patch0",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -75,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Patch1",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -25,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 1.5,
+ "g": 1.5,
+ "b": 1.5,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Patch2",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 25,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 2,
+ "g": 2,
+ "b": 2,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "name": "Patch3",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 75,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 4,
+ "g": 4,
+ "b": 4,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 5,
+ "name": "Patch4",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -75,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 8,
+ "g": 8,
+ "b": 8,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 6,
+ "name": "Patch5",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -25,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 16,
+ "g": 16,
+ "b": 16,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 7,
+ "name": "Patch6",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 25,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 32,
+ "g": 32,
+ "b": 32,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 8,
+ "name": "Patch7",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 75,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 64,
+ "g": 64,
+ "b": 64,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 9,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "agx",
+ "enabled": true,
+ "uniforms": {
+ "u_contrast": 1
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-agx-grey-low.esscene b/fixtures/scenes/oracle-agx-grey-low.esscene
new file mode 100644
index 000000000..8ef2ddd81
--- /dev/null
+++ b/fixtures/scenes/oracle-agx-grey-low.esscene
@@ -0,0 +1,398 @@
+{
+ "version": 4,
+ "name": "oracle-agx-grey-low",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Patch0",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -75,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.002,
+ "g": 0.002,
+ "b": 0.002,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Patch1",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -25,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.01,
+ "g": 0.01,
+ "b": 0.01,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Patch2",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 25,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.03,
+ "g": 0.03,
+ "b": 0.03,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "name": "Patch3",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 75,
+ "y": 5,
+ "z": -50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.09,
+ "g": 0.09,
+ "b": 0.09,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 5,
+ "name": "Patch4",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -75,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.18,
+ "g": 0.18,
+ "b": 0.18,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 6,
+ "name": "Patch5",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -25,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.3,
+ "g": 0.3,
+ "b": 0.3,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 7,
+ "name": "Patch6",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 25,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.5,
+ "g": 0.5,
+ "b": 0.5,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 8,
+ "name": "Patch7",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 75,
+ "y": 5,
+ "z": 50
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.1,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.8,
+ "g": 0.8,
+ "b": 0.8,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 9,
+ "name": "Look",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "PostProcessVolume",
+ "data": {
+ "isGlobal": true,
+ "priority": 0,
+ "weight": 1,
+ "effects": [
+ {
+ "type": "agx",
+ "enabled": true,
+ "uniforms": {
+ "u_contrast": 1
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-soft-point-large.esscene b/fixtures/scenes/oracle-soft-point-large.esscene
new file mode 100644
index 000000000..c33ace86d
--- /dev/null
+++ b/fixtures/scenes/oracle-soft-point-large.esscene
@@ -0,0 +1,190 @@
+{
+ "version": 4,
+ "name": "oracle-soft-point-large",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Floor",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "scale": {
+ "x": 4,
+ "y": 0.1,
+ "z": 4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.8,
+ "g": 0.8,
+ "b": 0.8,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Box",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 95,
+ "z": 0
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.2,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.5,
+ "g": 0.5,
+ "b": 0.5,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Lamp",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -60,
+ "y": 225,
+ "z": 40
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 0,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 1.4,
+ "radius": 700,
+ "falloff": 1,
+ "meshShadows": true,
+ "shadowSoftness": 34
+ }
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "name": "Ambient",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 2,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 0.15
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-soft-point.esscene b/fixtures/scenes/oracle-soft-point.esscene
new file mode 100644
index 000000000..656dde314
--- /dev/null
+++ b/fixtures/scenes/oracle-soft-point.esscene
@@ -0,0 +1,190 @@
+{
+ "version": 4,
+ "name": "oracle-soft-point",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Floor",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "scale": {
+ "x": 4,
+ "y": 0.1,
+ "z": 4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.8,
+ "g": 0.8,
+ "b": 0.8,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Box",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 95,
+ "z": 0
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.2,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.5,
+ "g": 0.5,
+ "b": 0.5,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Lamp",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -60,
+ "y": 225,
+ "z": 40
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 0,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 1.4,
+ "radius": 700,
+ "falloff": 1,
+ "meshShadows": true,
+ "shadowSoftness": 18
+ }
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "name": "Ambient",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 2,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 0.15
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/oracle-soft-spot.esscene b/fixtures/scenes/oracle-soft-spot.esscene
new file mode 100644
index 000000000..d90d71b0f
--- /dev/null
+++ b/fixtures/scenes/oracle-soft-spot.esscene
@@ -0,0 +1,198 @@
+{
+ "version": 4,
+ "name": "oracle-soft-spot",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 400,
+ "z": 0
+ },
+ "rotation": {
+ "x": -0.7071067811865476,
+ "y": 0,
+ "z": 0,
+ "w": 0.7071067811865476
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 100,
+ "nearPlane": 1,
+ "farPlane": 2000,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Floor",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "scale": {
+ "x": 4,
+ "y": 0.1,
+ "z": 4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.8,
+ "g": 0.8,
+ "b": 0.8,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Box",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 95,
+ "z": 0
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 0.2,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "color": {
+ "r": 0.5,
+ "g": 0.5,
+ "b": 0.5,
+ "a": 1
+ },
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Lamp",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -60,
+ "y": 225,
+ "z": 40
+ },
+ "rotation": {
+ "x": -0.5488953854874247,
+ "y": -0.2533363317634268,
+ "z": 0,
+ "w": 0.7965767752070496
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 3,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 1.4,
+ "radius": 700,
+ "falloff": 1,
+ "meshShadows": true,
+ "shadowSoftness": 18,
+ "innerAngle": 100,
+ "outerAngle": 120
+ }
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "name": "Ambient",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 2,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 0.15
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/sdk/src/postprocess/sources/basic.ts b/sdk/src/postprocess/sources/basic.ts
index 987e98ce9..8fd7851d9 100644
--- a/sdk/src/postprocess/sources/basic.ts
+++ b/sdk/src/postprocess/sources/basic.ts
@@ -194,16 +194,29 @@ out vec4 fragColor;
// Scene-linear Rec.709 to FilmLight E-Gamut (Rec.709 to XYZ D65, then XYZ to E-Gamut).
const mat3 TO_EGAMUT = mat3(0.5593711, 0.0762207, 0.0655267, 0.3047833, 0.7879718, 0.1645467, 0.1358455, 0.1358075, 0.7699265);
+// The table is 32^3 and Blender reads it by tetrahedral interpolation, which this does too. Trilinear interpolation (two bilinear taps
+// and a mix) is exact on the table's nodes and not between them, and AgX's table is far from linear there: inside a cell, the grey
+// axis of the cube is not an edge of the interpolation, so a neutral input came out tinted (middle grey 6 codes short in red, and a
+// saturated blue lost 12 of its red). A tetrahedron has the grey diagonal for an edge, so a neutral stays neutral.
+vec3 lutNode(ivec3 n) {
+ return texelFetch(u_lut, ivec2(n.b * 32 + n.r, n.g), 0).rgb;
+}
+
vec3 sampleLut(vec3 t) {
- const float size = 32.0;
- float b = clamp(t.b, 0.0, 1.0) * (size - 1.0);
- float slice0 = floor(b);
- float slice1 = min(slice0 + 1.0, size - 1.0);
- float u = (clamp(t.r, 0.0, 1.0) * (size - 1.0) + 0.5) / (size * size);
- float v = (clamp(t.g, 0.0, 1.0) * (size - 1.0) + 0.5) / size;
- vec3 a = texture(u_lut, vec2(u + slice0 / size, v)).rgb;
- vec3 d = texture(u_lut, vec2(u + slice1 / size, v)).rgb;
- return mix(a, d, b - slice0);
+ vec3 p = clamp(t, 0.0, 1.0) * 31.0;
+ ivec3 i0 = ivec3(min(floor(p), vec3(30.0)));
+ vec3 f = p - vec3(i0);
+ // Walk from the cell's low corner along its axes, the one with the biggest fraction first.
+ ivec3 axis1 = ivec3(1, 0, 0), axis2 = ivec3(0, 1, 0), axis3 = ivec3(0, 0, 1);
+ float f1 = f.r, f2 = f.g, f3 = f.b;
+ if (f2 > f1) { ivec3 ta = axis1; axis1 = axis2; axis2 = ta; float tf = f1; f1 = f2; f2 = tf; }
+ if (f3 > f2) { ivec3 ta = axis2; axis2 = axis3; axis3 = ta; float tf = f2; f2 = f3; f3 = tf; }
+ if (f2 > f1) { ivec3 ta = axis1; axis1 = axis2; axis2 = ta; float tf = f1; f1 = f2; f2 = tf; }
+ vec3 c0 = lutNode(i0);
+ vec3 c1 = lutNode(i0 + axis1);
+ vec3 c2 = lutNode(i0 + axis1 + axis2);
+ vec3 c3 = lutNode(i0 + axis1 + axis2 + axis3);
+ return c0 + (c1 - c0) * f1 + (c2 - c1) * f2 + (c3 - c2) * f3;
}
void main() {
@@ -221,16 +234,28 @@ void main() {
#pragma fragment wgsl
const TO_EGAMUT = mat3x3f(vec3f(0.5593711, 0.0762207, 0.0655267), vec3f(0.3047833, 0.7879718, 0.1645467), vec3f(0.1358455, 0.1358075, 0.7699265));
+fn lutNode(n : vec3i) -> vec3f {
+ return textureLoad(u_lut, vec2i(n.z * 32 + n.x, n.y), 0).rgb;
+}
+
fn sampleLut(t : vec3f) -> vec3f {
- let size = 32.0;
- let b = clamp(t.b, 0.0, 1.0) * (size - 1.0);
- let slice0 = floor(b);
- let slice1 = min(slice0 + 1.0, size - 1.0);
- let u = (clamp(t.r, 0.0, 1.0) * (size - 1.0) + 0.5) / (size * size);
- let v = (clamp(t.g, 0.0, 1.0) * (size - 1.0) + 0.5) / size;
- let a = textureSampleLevel(u_lut, u_lut_s, vec2f(u + slice0 / size, v), 0.0).rgb;
- let d = textureSampleLevel(u_lut, u_lut_s, vec2f(u + slice1 / size, v), 0.0).rgb;
- return mix(a, d, b - slice0);
+ let p = clamp(t, vec3f(0.0), vec3f(1.0)) * 31.0;
+ let i0 = vec3i(min(floor(p), vec3f(30.0)));
+ let f = p - vec3f(i0);
+ var axis1 = vec3i(1, 0, 0);
+ var axis2 = vec3i(0, 1, 0);
+ var axis3 = vec3i(0, 0, 1);
+ var f1 = f.x;
+ var f2 = f.y;
+ var f3 = f.z;
+ if (f2 > f1) { let ta = axis1; axis1 = axis2; axis2 = ta; let tf = f1; f1 = f2; f2 = tf; }
+ if (f3 > f2) { let ta = axis2; axis2 = axis3; axis3 = ta; let tf = f2; f2 = f3; f3 = tf; }
+ if (f2 > f1) { let ta = axis1; axis1 = axis2; axis2 = ta; let tf = f1; f1 = f2; f2 = tf; }
+ let c0 = lutNode(i0);
+ let c1 = lutNode(i0 + axis1);
+ let c2 = lutNode(i0 + axis1 + axis2);
+ let c3 = lutNode(i0 + axis1 + axis2 + axis3);
+ return c0 + (c1 - c0) * f1 + (c2 - c1) * f2 + (c3 - c2) * f3;
}
@fragment fn fs_main(v : VSOut) -> @location(0) vec4f {
diff --git a/tools/oracle/agx.mjs b/tools/oracle/agx.mjs
new file mode 100644
index 000000000..43a8b355d
--- /dev/null
+++ b/tools/oracle/agx.mjs
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file agx.mjs — oracle scenes for the AgX view transform, against Blender's own.
+ *
+ * AgX is not a formula but a table (Blender ships it, and the engine's effect carries that table), so the answer here is Blender: the
+ * same flat scene-linear colours drawn by Blender's Workbench under its AgX view transform, read back as 8-bit display values
+ * (tools/oracle/agx/make-reference.mjs writes them; reference.json is data in the repository, so these scenes need no Blender to run).
+ * What is compared is everything between the colour and the screen: the E-Gamut matrix, the log encode, the contrast, the table's
+ * interpolation, and the display's encode. The base look is contrast 1; Blender's "Medium High Contrast" look is 1.2.
+ */
+import { readFileSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { scene, camera, mesh, volume, probe } from './scene.mjs';
+
+const here = path.dirname(fileURLToPath(import.meta.url));
+const load = (name) => JSON.parse(readFileSync(path.join(here, 'agx', name), 'utf8'));
+const SLOTS = [[-75, -50], [-25, -50], [25, -50], [75, -50], [-75, 50], [-25, 50], [25, 50], [75, 50]];
+
+function agxPatches({ id, reference, from, contrast, tol }) {
+ const colours = reference.patches.slice(from, from + SLOTS.length), codes = reference.codes.slice(from, from + SLOTS.length);
+ const doc = scene(id, () => [
+ camera(),
+ ...colours.map((c, i) => mesh(`Patch${i}`, 'cube', [SLOTS[i][0], 5, SLOTS[i][1]], [0.4, 0.1, 0.4], c, { lit: false })),
+ volume([{ type: 'agx', enabled: true, uniforms: { u_contrast: contrast } }]),
+ ]);
+ const expect = codes.map((rgb, i) => {
+ const p = probe(...SLOTS[i]);
+ return { x: p.x, y: p.y, rgb, tol };
+ });
+ return { id, doc, colorSpace: 'linear', expect, about: `AgX (contrast ${contrast}) against Blender ${reference.source.split(',')[0]}: patches ${from + 1} to ${from + colours.length}` };
+}
+
+const BASE = load('reference.json'), MEDIUM_HIGH = load('reference-AgX-Medium-High-Contrast.json');
+/**
+ * Where the engine and Blender are not the same, and why (measured against Blender 5.2.1):
+ * neutrals within 2 codes. (The table was read trilinearly before, which tinted every grey, red 6 codes short at middle grey; the
+ * tetrahedral read Blender's config names is what holds them.)
+ * saturated within 7. The engine's table is 32^3, resampled from Blender's 57^3, and where one channel is dark and another bright the
+ * transform bends faster than 32 nodes follow. A 57^3 table would close it, at about 740 KB of SDK.
+ * contrast 1.2 neutrals within 2, saturated colours within 14. Blender's look is a contrast in ANOTHER log space (inset Rec.2020, through a
+ * luminance-compensation table), the engine's is in E-Gamut's: the same on greys, near on colours.
+ */
+const NEUTRAL = 3, SATURATED = 8, LOOK_SATURATED = 16;
+
+export const AGX_SCENES = [
+ agxPatches({ id: 'oracle-agx-grey-low', reference: BASE, from: 0, contrast: 1, tol: NEUTRAL }),
+ agxPatches({ id: 'oracle-agx-grey-high', reference: BASE, from: 8, contrast: 1, tol: NEUTRAL }),
+ agxPatches({ id: 'oracle-agx-colour-a', reference: BASE, from: 16, contrast: 1, tol: SATURATED }),
+ agxPatches({ id: 'oracle-agx-colour-b', reference: BASE, from: 24, contrast: 1, tol: SATURATED }),
+ agxPatches({ id: 'oracle-agx-contrast-grey', reference: MEDIUM_HIGH, from: 0, contrast: 1.2, tol: NEUTRAL }),
+ agxPatches({ id: 'oracle-agx-contrast-colour', reference: MEDIUM_HIGH, from: 16, contrast: 1.2, tol: LOOK_SATURATED }),
+];
diff --git a/tools/oracle/agx/blender_agx.py b/tools/oracle/agx/blender_agx.py
new file mode 100644
index 000000000..8502a05fe
--- /dev/null
+++ b/tools/oracle/agx/blender_agx.py
@@ -0,0 +1,77 @@
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+"""
+Blender's own AgX, read back for a list of flat colours: the reference tools/oracle/agx.mjs compares the engine's AgX effect against.
+
+ blender --background --python tools/oracle/agx/blender_agx.py -- patches.json out.json [Look]
+
+patches.json is a list of scene-linear [r, g, b]. Each becomes a flat quad drawn by Workbench with no lighting, no anti-aliasing and no
+dithering, under the view transform AgX (look None, or the named look), and out.json holds the 8-bit display value Blender writes for it:
+what a person comparing the engine with Blender's viewport sees.
+"""
+import json
+import sys
+
+import bpy
+
+args = sys.argv[sys.argv.index('--') + 1:]
+patches = json.load(open(args[0]))
+look = args[2] if len(args) > 2 else 'None'
+
+bpy.ops.wm.read_factory_settings(use_empty=True)
+scene = bpy.context.scene
+scene.render.engine = 'BLENDER_WORKBENCH'
+scene.display.shading.light = 'FLAT'
+scene.display.shading.color_type = 'OBJECT'
+scene.display.render_aa = 'OFF'
+scene.render.film_transparent = False
+scene.render.image_settings.file_format = 'PNG'
+scene.render.image_settings.color_mode = 'RGB'
+scene.render.image_settings.color_depth = '8'
+scene.render.dither_intensity = 0.0
+scene.view_settings.view_transform = 'AgX'
+scene.view_settings.look = look
+scene.view_settings.exposure = 0.0
+scene.view_settings.gamma = 1.0
+scene.display_settings.display_device = 'sRGB'
+scene.world = bpy.data.worlds.new('w')
+scene.world.color = (0.0, 0.0, 0.0)
+
+CELL = 32
+cols = 8
+rows = (len(patches) + cols - 1) // cols
+scene.render.resolution_x = cols * CELL
+scene.render.resolution_y = rows * CELL
+scene.render.resolution_percentage = 100
+
+cam = bpy.data.objects.new('cam', bpy.data.cameras.new('cam'))
+cam.data.type = 'ORTHO'
+cam.data.ortho_scale = float(cols)
+cam.location = (cols / 2.0, -rows / 2.0, 10.0)
+scene.collection.objects.link(cam)
+scene.camera = cam
+
+for n, rgb in enumerate(patches):
+ x, y = n % cols, n // cols
+ mesh = bpy.data.meshes.new('q%d' % n)
+ mesh.from_pydata([(0, 0, 0), (1, 0, 0), (1, -1, 0), (0, -1, 0)], [], [(0, 1, 2, 3)])
+ obj = bpy.data.objects.new('q%d' % n, mesh)
+ obj.location = (x, -y, 0)
+ obj.color = (rgb[0], rgb[1], rgb[2], 1.0)
+ scene.collection.objects.link(obj)
+
+out_png = args[1] + '.png'
+scene.render.filepath = out_png
+bpy.ops.render.render(write_still=True)
+
+img = bpy.data.images.load(out_png)
+w, h = img.size
+px = list(img.pixels)
+result = []
+for n in range(len(patches)):
+ x, y = n % cols, n // cols
+ cx, cy = x * CELL + CELL // 2, (rows - 1 - y) * CELL + CELL // 2 # image rows run bottom-up
+ i = (cy * w + cx) * 4
+ result.append([round(px[i + k] * 255) for k in range(3)])
+json.dump({'look': look, 'view': 'AgX', 'patches': patches, 'codes': result}, open(args[1], 'w'))
+print('AGX_DONE', len(result))
diff --git a/tools/oracle/agx/make-reference.mjs b/tools/oracle/agx/make-reference.mjs
new file mode 100644
index 000000000..223690c0f
--- /dev/null
+++ b/tools/oracle/agx/make-reference.mjs
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file make-reference.mjs — ask Blender what its AgX view transform shows for the patches, and write reference.json beside this file.
+ *
+ * node tools/oracle/agx/make-reference.mjs [look] (look: None, or one of Blender's AgX looks, e.g. "AgX - Medium High Contrast")
+ *
+ * Needs Blender (BLENDER, or the default install path). The result is data in the repository, so the oracle scenes run without it.
+ */
+import { spawnSync } from 'node:child_process';
+import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { ALL } from './patches.mjs';
+
+const here = path.dirname(fileURLToPath(import.meta.url));
+const blender = process.env.BLENDER ?? 'C:/Program Files/Blender Foundation/Blender 5.2/blender.exe';
+const look = process.argv[2] ?? 'None';
+const tmp = mkdtempSync(path.join(os.tmpdir(), 'agx-'));
+const input = path.join(tmp, 'patches.json'), output = path.join(tmp, 'out.json');
+writeFileSync(input, JSON.stringify(ALL));
+const run = spawnSync(blender, ['--background', '--python', path.join(here, 'blender_agx.py'), '--', input, output, look], { encoding: 'utf8' });
+if (run.status !== 0 || !run.stdout.includes('AGX_DONE')) { console.error(run.stdout, run.stderr); process.exit(1); }
+const result = JSON.parse(readFileSync(output, 'utf8'));
+const version = /Blender (\d+\.\d+[^\s]*)/.exec(run.stdout)?.[1] ?? 'unknown';
+const file = path.join(here, look === 'None' ? 'reference.json' : `reference-${look.replace(/[^A-Za-z0-9]+/g, '-')}.json`);
+writeFileSync(file, JSON.stringify({ source: `Blender ${version}, Workbench flat colour, view transform AgX, look ${look}, display sRGB, 8-bit`, patches: result.patches, codes: result.codes }, null, 1) + '\n');
+console.log(`wrote ${path.relative(process.cwd(), file)}: ${result.codes.length} patches`);
diff --git a/tools/oracle/agx/patches.mjs b/tools/oracle/agx/patches.mjs
new file mode 100644
index 000000000..a4dc76675
--- /dev/null
+++ b/tools/oracle/agx/patches.mjs
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file patches.mjs — the scene-linear colours AgX is compared on: a grey ramp from deep shadow to far over-range, and colours that a
+ * per-channel curve and AgX treat differently (saturated primaries, mixed and dark tones, HDR colour).
+ */
+export const GREYS = [0.002, 0.01, 0.03, 0.09, 0.18, 0.3, 0.5, 0.8, 1, 1.5, 2, 4, 8, 16, 32, 64].map((v) => [v, v, v]);
+export const COLOURS = [
+ [0.8, 0.1, 0.05], [0.05, 0.6, 0.1], [0.05, 0.1, 0.9], [0.9, 0.7, 0.1],
+ [0.2, 0.3, 0.4], [0.02, 0.4, 0.35], [1.5, 0.6, 0.2], [0.5, 0.5, 0.5],
+ [4, 0.5, 0.2], [0.1, 3, 0.1], [0.3, 0.3, 6], [2, 1.5, 0.3],
+ [0.01, 0.02, 0.05], [1, 0.05, 0.05], [0.05, 1, 0.05], [0.05, 0.05, 1],
+];
+export const ALL = [...GREYS, ...COLOURS];
diff --git a/tools/oracle/agx/reference-AgX-Medium-High-Contrast.json b/tools/oracle/agx/reference-AgX-Medium-High-Contrast.json
new file mode 100644
index 000000000..3a4fa5da9
--- /dev/null
+++ b/tools/oracle/agx/reference-AgX-Medium-High-Contrast.json
@@ -0,0 +1,327 @@
+{
+ "source": "Blender 5.2.1, Workbench flat colour, view transform AgX, look AgX - Medium High Contrast, display sRGB, 8-bit",
+ "patches": [
+ [
+ 0.002,
+ 0.002,
+ 0.002
+ ],
+ [
+ 0.01,
+ 0.01,
+ 0.01
+ ],
+ [
+ 0.03,
+ 0.03,
+ 0.03
+ ],
+ [
+ 0.09,
+ 0.09,
+ 0.09
+ ],
+ [
+ 0.18,
+ 0.18,
+ 0.18
+ ],
+ [
+ 0.3,
+ 0.3,
+ 0.3
+ ],
+ [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ [
+ 0.8,
+ 0.8,
+ 0.8
+ ],
+ [
+ 1,
+ 1,
+ 1
+ ],
+ [
+ 1.5,
+ 1.5,
+ 1.5
+ ],
+ [
+ 2,
+ 2,
+ 2
+ ],
+ [
+ 4,
+ 4,
+ 4
+ ],
+ [
+ 8,
+ 8,
+ 8
+ ],
+ [
+ 16,
+ 16,
+ 16
+ ],
+ [
+ 32,
+ 32,
+ 32
+ ],
+ [
+ 64,
+ 64,
+ 64
+ ],
+ [
+ 0.8,
+ 0.1,
+ 0.05
+ ],
+ [
+ 0.05,
+ 0.6,
+ 0.1
+ ],
+ [
+ 0.05,
+ 0.1,
+ 0.9
+ ],
+ [
+ 0.9,
+ 0.7,
+ 0.1
+ ],
+ [
+ 0.2,
+ 0.3,
+ 0.4
+ ],
+ [
+ 0.02,
+ 0.4,
+ 0.35
+ ],
+ [
+ 1.5,
+ 0.6,
+ 0.2
+ ],
+ [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ [
+ 4,
+ 0.5,
+ 0.2
+ ],
+ [
+ 0.1,
+ 3,
+ 0.1
+ ],
+ [
+ 0.3,
+ 0.3,
+ 6
+ ],
+ [
+ 2,
+ 1.5,
+ 0.3
+ ],
+ [
+ 0.01,
+ 0.02,
+ 0.05
+ ],
+ [
+ 1,
+ 0.05,
+ 0.05
+ ],
+ [
+ 0.05,
+ 1,
+ 0.05
+ ],
+ [
+ 0.05,
+ 0.05,
+ 1
+ ]
+ ],
+ "codes": [
+ [
+ 1,
+ 1,
+ 1
+ ],
+ [
+ 10,
+ 10,
+ 10
+ ],
+ [
+ 33,
+ 33,
+ 33
+ ],
+ [
+ 76,
+ 76,
+ 76
+ ],
+ [
+ 118,
+ 118,
+ 118
+ ],
+ [
+ 150,
+ 150,
+ 150
+ ],
+ [
+ 178,
+ 178,
+ 178
+ ],
+ [
+ 199,
+ 199,
+ 199
+ ],
+ [
+ 208,
+ 208,
+ 208
+ ],
+ [
+ 221,
+ 221,
+ 221
+ ],
+ [
+ 229,
+ 229,
+ 229
+ ],
+ [
+ 244,
+ 244,
+ 244
+ ],
+ [
+ 255,
+ 255,
+ 255
+ ],
+ [
+ 255,
+ 255,
+ 255
+ ],
+ [
+ 255,
+ 255,
+ 255
+ ],
+ [
+ 255,
+ 255,
+ 255
+ ],
+ [
+ 216,
+ 91,
+ 59
+ ],
+ [
+ 94,
+ 186,
+ 96
+ ],
+ [
+ 60,
+ 112,
+ 215
+ ],
+ [
+ 208,
+ 188,
+ 120
+ ],
+ [
+ 128,
+ 151,
+ 168
+ ],
+ [
+ 53,
+ 167,
+ 160
+ ],
+ [
+ 229,
+ 182,
+ 150
+ ],
+ [
+ 178,
+ 178,
+ 178
+ ],
+ [
+ 255,
+ 189,
+ 173
+ ],
+ [
+ 185,
+ 240,
+ 172
+ ],
+ [
+ 188,
+ 201,
+ 255
+ ],
+ [
+ 232,
+ 217,
+ 178
+ ],
+ [
+ 7,
+ 26,
+ 48
+ ],
+ [
+ 230,
+ 78,
+ 65
+ ],
+ [
+ 121,
+ 208,
+ 99
+ ],
+ [
+ 64,
+ 102,
+ 221
+ ]
+ ]
+}
diff --git a/tools/oracle/agx/reference.json b/tools/oracle/agx/reference.json
new file mode 100644
index 000000000..7e6f38bd3
--- /dev/null
+++ b/tools/oracle/agx/reference.json
@@ -0,0 +1,327 @@
+{
+ "source": "Blender 5.2.1, Workbench flat colour, view transform AgX, look None, display sRGB, 8-bit",
+ "patches": [
+ [
+ 0.002,
+ 0.002,
+ 0.002
+ ],
+ [
+ 0.01,
+ 0.01,
+ 0.01
+ ],
+ [
+ 0.03,
+ 0.03,
+ 0.03
+ ],
+ [
+ 0.09,
+ 0.09,
+ 0.09
+ ],
+ [
+ 0.18,
+ 0.18,
+ 0.18
+ ],
+ [
+ 0.3,
+ 0.3,
+ 0.3
+ ],
+ [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ [
+ 0.8,
+ 0.8,
+ 0.8
+ ],
+ [
+ 1,
+ 1,
+ 1
+ ],
+ [
+ 1.5,
+ 1.5,
+ 1.5
+ ],
+ [
+ 2,
+ 2,
+ 2
+ ],
+ [
+ 4,
+ 4,
+ 4
+ ],
+ [
+ 8,
+ 8,
+ 8
+ ],
+ [
+ 16,
+ 16,
+ 16
+ ],
+ [
+ 32,
+ 32,
+ 32
+ ],
+ [
+ 64,
+ 64,
+ 64
+ ],
+ [
+ 0.8,
+ 0.1,
+ 0.05
+ ],
+ [
+ 0.05,
+ 0.6,
+ 0.1
+ ],
+ [
+ 0.05,
+ 0.1,
+ 0.9
+ ],
+ [
+ 0.9,
+ 0.7,
+ 0.1
+ ],
+ [
+ 0.2,
+ 0.3,
+ 0.4
+ ],
+ [
+ 0.02,
+ 0.4,
+ 0.35
+ ],
+ [
+ 1.5,
+ 0.6,
+ 0.2
+ ],
+ [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ [
+ 4,
+ 0.5,
+ 0.2
+ ],
+ [
+ 0.1,
+ 3,
+ 0.1
+ ],
+ [
+ 0.3,
+ 0.3,
+ 6
+ ],
+ [
+ 2,
+ 1.5,
+ 0.3
+ ],
+ [
+ 0.01,
+ 0.02,
+ 0.05
+ ],
+ [
+ 1,
+ 0.05,
+ 0.05
+ ],
+ [
+ 0.05,
+ 1,
+ 0.05
+ ],
+ [
+ 0.05,
+ 0.05,
+ 1
+ ]
+ ],
+ "codes": [
+ [
+ 3,
+ 3,
+ 3
+ ],
+ [
+ 18,
+ 18,
+ 18
+ ],
+ [
+ 42,
+ 42,
+ 42
+ ],
+ [
+ 82,
+ 82,
+ 82
+ ],
+ [
+ 118,
+ 118,
+ 118
+ ],
+ [
+ 145,
+ 145,
+ 145
+ ],
+ [
+ 170,
+ 170,
+ 170
+ ],
+ [
+ 189,
+ 189,
+ 189
+ ],
+ [
+ 197,
+ 197,
+ 197
+ ],
+ [
+ 209,
+ 209,
+ 209
+ ],
+ [
+ 217,
+ 217,
+ 217
+ ],
+ [
+ 233,
+ 233,
+ 233
+ ],
+ [
+ 245,
+ 245,
+ 245
+ ],
+ [
+ 255,
+ 255,
+ 255
+ ],
+ [
+ 255,
+ 255,
+ 255
+ ],
+ [
+ 255,
+ 255,
+ 255
+ ],
+ [
+ 203,
+ 97,
+ 72
+ ],
+ [
+ 100,
+ 176,
+ 100
+ ],
+ [
+ 72,
+ 114,
+ 203
+ ],
+ [
+ 196,
+ 179,
+ 119
+ ],
+ [
+ 126,
+ 146,
+ 160
+ ],
+ [
+ 73,
+ 159,
+ 153
+ ],
+ [
+ 216,
+ 174,
+ 144
+ ],
+ [
+ 170,
+ 170,
+ 170
+ ],
+ [
+ 248,
+ 180,
+ 164
+ ],
+ [
+ 177,
+ 228,
+ 163
+ ],
+ [
+ 177,
+ 190,
+ 251
+ ],
+ [
+ 220,
+ 206,
+ 169
+ ],
+ [
+ 17,
+ 35,
+ 57
+ ],
+ [
+ 215,
+ 88,
+ 76
+ ],
+ [
+ 122,
+ 196,
+ 102
+ ],
+ [
+ 73,
+ 104,
+ 208
+ ]
+ ]
+}
diff --git a/tools/oracle/formulas.mjs b/tools/oracle/formulas.mjs
index 0b09fa002..e1dbdcb00 100644
--- a/tools/oracle/formulas.mjs
+++ b/tools/oracle/formulas.mjs
@@ -91,3 +91,5 @@ export function smoothstep(edge0, edge1, x) {
const t = clamp01((x - edge0) / (edge1 - edge0));
return t * t * (3 - 2 * t);
}
+
+export const cross = (a, b) => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
diff --git a/tools/oracle/index.mjs b/tools/oracle/index.mjs
index 4e7227fdb..8a8bacf12 100644
--- a/tools/oracle/index.mjs
+++ b/tools/oracle/index.mjs
@@ -13,8 +13,10 @@ import { VOLUMETRIC_SCENES } from './volumetric.mjs';
import { EXPOSURE_SCENES } from './exposure.mjs';
import { OCCLUSION_SCENES } from './occlusion.mjs';
import { REFLECTION_SCENES } from './reflection.mjs';
+import { AGX_SCENES } from './agx.mjs';
+import { SOFT_LIGHT_SCENES } from './softlight.mjs';
-export const ORACLE = [...LIGHT_SCENES, ...SHADOW_SCENES, ...POST_SCENES, ...SKY_SCENES, ...LENS_SCENES, ...VOLUMETRIC_SCENES, ...EXPOSURE_SCENES, ...OCCLUSION_SCENES, ...REFLECTION_SCENES];
+export const ORACLE = [...LIGHT_SCENES, ...SHADOW_SCENES, ...POST_SCENES, ...SKY_SCENES, ...LENS_SCENES, ...VOLUMETRIC_SCENES, ...EXPOSURE_SCENES, ...OCCLUSION_SCENES, ...REFLECTION_SCENES, ...AGX_SCENES, ...SOFT_LIGHT_SCENES];
/** The renderScenes.mjs entry for one oracle scene. */
export const oracleEntry = (o) => ({
diff --git a/tools/oracle/softlight.mjs b/tools/oracle/softlight.mjs
new file mode 100644
index 000000000..2793f7cf7
--- /dev/null
+++ b/tools/oracle/softlight.mjs
@@ -0,0 +1,100 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file softlight.mjs — oracle scenes for soft shadows from point and spot lights (`shadowSoftness`, the size of the light).
+ *
+ * A lamp of radius s lit over a floor, a box floating between them. A floor point sees a share of the lamp's disc (the disc across the
+ * way to the point, radius s) that the box does not cover, and that share is how much of the light reaches it: the penumbra is
+ * s x (how far the point is beyond the box) / (how far the box is from the lamp) wide on each side of the edge. The share is
+ * integrated here with a few hundred sample points over the disc and a ray / box test each, so it is geometry and not a measurement.
+ * The engine's filter is a percentage-closer search with a bounded kernel over a shadow map, so it is an approximation of that
+ * integral, and the tolerance is the width of that approximation.
+ */
+import { scene, camera, mesh, lamp, ambient, probe } from './scene.mjs';
+import { dot, norm, sub, encodeLinear8, linearFalloff, smoothstep, axisAngle, cross } from './formulas.mjs';
+
+const FLOOR_TOP = 5, ALBEDO = 0.8, AMBIENT = 0.15;
+const BOX = { min: [-20, 85, -20], max: [20, 105, 20] };
+const LAMP = [-60, 225, 40];
+const SPOT_INNER = 100, SPOT_OUTER = 120; // full cone angles: wide enough to hold the whole floor in view, narrow enough to be a spot
+
+const slab = (origin, dir, maxT) => {
+ let t0 = 0, t1 = maxT;
+ for (let a = 0; a < 3; a++) {
+ if (Math.abs(dir[a]) < 1e-9) { if (origin[a] < BOX.min[a] || origin[a] > BOX.max[a]) return false; continue; }
+ let ta = (BOX.min[a] - origin[a]) / dir[a], tb = (BOX.max[a] - origin[a]) / dir[a];
+ if (ta > tb) [ta, tb] = [tb, ta];
+ t0 = Math.max(t0, ta); t1 = Math.min(t1, tb);
+ if (t0 > t1) return false;
+ }
+ return true;
+};
+
+/** The share of a lamp of radius `size` a floor point sees, over a disc across the way to the point. */
+function visibleShare(p, size) {
+ const toLamp = sub(LAMP, p), dist = Math.hypot(...toLamp), axis = toLamp.map((v) => v / dist);
+ if (size <= 0) return slab(p, axis, dist) ? 0 : 1;
+ const helper = Math.abs(axis[1]) < 0.99 ? [0, 1, 0] : [1, 0, 0];
+ const u = norm(cross(axis, helper)), v = cross(axis, u);
+ const N = 600;
+ let seen = 0;
+ for (let i = 0; i < N; i++) {
+ const r = size * Math.sqrt((i + 0.5) / N), a = i * 2.399963229728653;
+ const target = LAMP.map((c, k) => c + r * (Math.cos(a) * u[k] + Math.sin(a) * v[k]));
+ const d = sub(target, p), len = Math.hypot(...d);
+ if (!slab(p, d.map((x) => x / len), len)) seen++;
+ }
+ return seen / N;
+}
+
+/** The rotation that turns the -Z of an entity to look along `dir`. */
+function lookAlong(dir) {
+ const from = [0, 0, -1], c = cross(from, dir), s = Math.hypot(...c);
+ if (s < 1e-6) return dot(from, dir) > 0 ? { x: 0, y: 0, z: 0, w: 1 } : axisAngle([0, 1, 0], 180);
+ return axisAngle(c.map((x) => x / s), (Math.atan2(s, dot(from, dir)) * 180) / Math.PI);
+}
+
+/**
+ * Measured against the disc integral (Blender-free, above): the engine's filter is within about 14 codes of it at the 95th percentile of
+ * the penumbra's points, 25 at worst for a lamp of radius 18, and 34 at worst for 34, whose penumbra is wide enough to reach the bound the
+ * filter puts on its kernel. `tol` is that worst case plus a few: loose enough to be an approximation, tight enough that a shadow with
+ * no penumbra (which differs from the integral by up to 70 in the middle of it) fails.
+ */
+function softLamp({ id, size, spot, intensity = 1.4, reach = 700, tol = 30 }) {
+ const light = { radius: reach, falloff: 1, meshShadows: true, shadowSoftness: size, ...(spot ? { type: 3, innerAngle: SPOT_INNER, outerAngle: SPOT_OUTER } : {}) };
+ const doc = scene(id, () => [
+ camera(),
+ mesh('Floor', 'cube', [0, 0, 0], [4, 0.1, 4], [ALBEDO, ALBEDO, ALBEDO], { lit: false }),
+ mesh('Box', 'cube', [0, 95, 0], [0.4, 0.2, 0.4], [0.5, 0.5, 0.5], { lit: false }),
+ lamp(LAMP, intensity, [1, 1, 1], light),
+ ambient(AMBIENT),
+ ]);
+ // Lit, not unlit: the floor is the receiver. Its colour is the albedo and the lamp and ambient light it.
+ doc.entities.find((e) => e.name === 'Floor').components[1].data.lit = true;
+ if (spot) doc.entities.find((e) => e.name === 'Lamp').components[0].data.rotation = lookAlong(norm(sub([0, 95, 0], LAMP)));
+ const axis = norm(sub([0, 95, 0], LAMP));
+ const cosInner = Math.cos((SPOT_INNER * 0.5 * Math.PI) / 180), cosOuter = Math.cos((SPOT_OUTER * 0.5 * Math.PI) / 180);
+ const rows = [];
+ for (let x = -90; x <= 90; x += 6) {
+ for (let z = -90; z <= 90; z += 6) {
+ if (Math.abs(x) < 28 && Math.abs(z) < 28) continue; // under the box: the camera sees the box
+ const p = [x, FLOOR_TOP, z], toLamp = sub(LAMP, p), dist = Math.hypot(...toLamp), dir = toLamp.map((c) => c / dist);
+ const share = visibleShare(p, size);
+ const cone = spot ? smoothstep(cosOuter, cosInner, dot(dir.map((c) => -c), axis)) : 1;
+ const e = ALBEDO * (AMBIENT + intensity * linearFalloff(dist, reach, 0, 1) * cone * dir[1] * share);
+ rows.push({ x, z, share, e });
+ }
+ }
+ // The edge of a shadow is where the filter matters: every point of the penumbra, and a spread of the lit and the dark.
+ const pen = rows.filter((r) => r.share > 0.04 && r.share < 0.96), lit = rows.filter((r) => r.share >= 0.96), dark = rows.filter((r) => r.share <= 0.04);
+ const every = (list, n) => list.filter((_, i) => i % Math.max(1, Math.floor(list.length / n)) === 0).slice(0, n);
+ const chosen = [...pen, ...every(lit, 10), ...every(dark, 10)];
+ const expect = chosen.map((r) => { const p = probe(r.x, r.z); return { x: p.x, y: p.y, rgb: encodeLinear8([r.e, r.e, r.e]), tol }; });
+ return { id, doc, colorSpace: 'linear', expect, penumbra: pen.length, about: `Soft shadow of a ${spot ? 'spot' : 'point'} lamp of radius ${size}: the share of its disc the box leaves open` };
+}
+
+export const SOFT_LIGHT_SCENES = [
+ softLamp({ id: 'oracle-soft-point', size: 18 }),
+ softLamp({ id: 'oracle-soft-point-large', size: 34, tol: 38 }),
+ softLamp({ id: 'oracle-soft-spot', size: 18, spot: true }),
+];