Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Merge origin/main into feat/bake-textured

Nguyen Xuan An1149de1491fe
diff --cc CHANGELOG.md
index d716793c,127b693d..01aa7b9a
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -2,8 -2,10 +2,12 @@@
## Unreleased
+- Bake patterned, textured and emissive parts, and skip hair hosts (part of issue #128). A recipe `bake` used to skip every part with a pattern, a map or emission (31 parts, the floor and every wall, in the demo room) and failed `scene_create` with "Textured geometry requires UV channel 0" on a node that hosts hair. Those parts now keep `uvs` and their look and take the bounced light through a new `lightMap` material slot on a second UV set (`geometry.lightUvs`); the fragment shader adds `color * (1 - metallic) * lightMap * lightMapScale`, so a brick pattern tints its own bounced light. Hair and particle host nodes are skipped and listed in `report.skipped`. The shader branch compiles out of scenes with no light map; the renderer carries about 650 bytes of gzip for it in `entry:core` (see `docs/light-bake.md` for the measured sizes). GLB export writes `TEXCOORD_1` and the light map as the emissive texture (an approximation: glTF has no light map slot). The path tracer ignores baked maps by design. New reference scene `brick-room` (a recipe-built closed brick room).
+
+ - Make the path tracer about 2.8 times faster per thread and draw normal and metallic-roughness maps (part of issue #129; a 1080p still of the 181,708 triangle demo room at 64 samples still does not fit the 240 s job limit). Profiling the demo room showed the ray query dominating: 54 percent of the time sat in the generic BVH visitor, which called a closure per box and per triangle and kept distances in a boxed array. `createTracer` in `src/ray-query.js` now walks the BVH with typed stacks, a slab test on inverse directions and triangles packed in leaf order; pixels are bit-identical to before (checksum of a band unchanged) and it runs 1.2 times faster alone. The larger gain is shadow rays: the demo room has 11 light sources, and every bounce traced all of them. The first hit of a path still samples every light; later hits draw one at random and divide by its chance (and the environment multiple importance weights use that chance), which gives 23,300 paths a second per thread against 9,800, with the average moved by less than 1 percent in the demo room and 3 percent allowed by a test. Image jobs now use 8 workers, up from 4 (the machine limit). `normalMap` (with `normalScale`, tangent frame from the UVs as in the rasterizer) and `metallicRoughnessMap` (green scales roughness, blue scales metallic) are drawn on UV-mapped materials; on box-projected materials (`boxMapScale`) they are still ignored and `report.ignored` says so. The `entry:path-tracer` size budget goes from 12,900 to 13,800 bytes gzip for the maps, light selection and the packed ray query; `entry:core` did not change. Tests: maps tilt and mask the light, one light drawn at random keeps the average, and bands drawn in any order give the pixels of the whole image.
+
+ - Move the anisotropy and iridescence shader code out of the core bundle (part of issue #51). It lives in the new `addons/material-layer-shaders` entry, which registers it on import; the renderer asks for it only when a part uses a layer, so a lit box no longer pays for it. A scene that uses a layer in code must import the entry first, or the renderer throws a message that names the import. Recipes load it through `loadAgentSceneModules`, the MCP server does so itself, and the glTF loader loads it for a file that uses either extension. The unused short overloads of `environmentLighting` are gone. Pictures are unchanged.
+ - Add anisotropy and iridescence material layers, and a depth of field for each timeline shot (part of issue #51). Recipe materials take `anisotropy` and `anisotropyRotation` (highlights stretch along a grain, as `KHR_materials_anisotropy`) and `iridescence`, `iridescenceIor` and `iridescenceThickness` (a thin film that shifts reflection colour with the view angle, as `KHR_materials_iridescence`, after Belcour and Barla). Both are compiled out of the shader unless a part uses them, the MCP schema takes them with one short line each, and glTF import and export read and write the two extensions, so they no longer warn as accepted but not rendered. Transmissive materials draw in their own pass and ignore both; `scene_inspect` diagnostics say so. Recipe materials already accepted `clearcoat`, `transmission`, `thickness` and `ior` with the `surface` tag (a demo film that could not ask for them was running an older build, and its murky marble came from the `liquid` tag, which absorbs by thickness): `scene_capabilities` now lists every layer with its range under `scene.materialLayers`, and `npm run smoke:material-layers` renders a glass ball through the real MCP server and checks that the stripes behind it are bent. A timeline shot also takes `focusDistance` (0.01 to 100000 m) and `blur` (0 to 1), which replace the recipe depth of field for that shot only; sampling stays stateless, so a seek gives the same bytes as the frame in a sequence. `bench/reference` gets a `brushed-film` scene scored against Cycles and EEVEE, and the 11 older scenes did not move by more than 0.002 against Cycles.
- A path trace job keeps its own `maxSeconds` below the job deadline: the deadline of an image job with `settings.renderer` now reaches `maxSeconds` plus 60 s (it was 60 s plus 2 s per frame, so a 1920x1080 trace of 120 s was cancelled at about 67 s), and the traced PNG may be as large as any job frame (12 MiB, not 1 MiB).
- Add `67js/addons/path-tracer` (part of issue #57; the Cycles comparison is partial). `renderPathTracedImage({ parts, environment, camera }, options)` draws a still by CPU path tracing against the triangle BVH of the light bake, with next-event estimation for the sun, point, spot and area lights, an importance-sampled environment map, GGX metal, clear coat, glass, maps and cutouts, and a wavelet denoiser, on up to eight module workers. An `image` render job selects it with `settings.renderer: { type: "pathTracer", samples, bounces, denoise, seed, maxSeconds }`; the same recipe and seed give the same PNG, a job past `maxSeconds` fails with no image, and samples, size and ray work are bounded. It loads on demand: the core bundle and the agent scene do not carry it (the limits live in `src/path-tracer-capabilities.js`, listed under `jobs.pathTracer` in `scene_capabilities`; the tool schemas gain one `renderer` field inside the total budget). `npm run reference -- --path-tracer` scores it against Cycles: better than the rasterizer on 7 of the 11 reference scenes (`lit-interior` 0.5055 to 0.1993, `spot-area` 0.1242 to 0.0639), worse on `outdoor-hdri`, `character` and `fog`, mean 0.171 against 0.189. Not drawn: volume fog, normal maps, translucent leaves, caustics, lights seen in mirrors. `src/ray-query.js` now holds the ray query and light falloff that `light-bake` used to carry. `npm run smoke:path-tracer` checks it through MCP.
diff --cc bench/reference/README.md
index fcfda3d8,653359f8..08deb697
--- a/bench/reference/README.md
+++ b/bench/reference/README.md
@@@ -31,10 -32,10 +32,12 @@@ Rows are the baseline taken before shad
Light bake (issue #55): `npm run reference -- --bake lit-interior` bakes bounced light into the room with `addons/light-bake` (defaults: 128 samples, 2 bounces, 25,648 texels, about 6 s on this machine) and leaves the scene itself unchanged; Blender still gets the plain scene. Measured 2026-10-31 on the RTX 3060: `lit-interior` against Cycles goes from 0.5055 to 0.1444 (SwiftShader 0.5051 to 0.1439), and against EEVEE from 0.0923 to 0.4739, because EEVEE has no indirect light here and the bake adds it. No other scene moved by more than 0.002 (the largest change was 0.0001, `car-paint` against EEVEE). The committed baseline rows and images are not rewritten. The remaining gap shows in the FLIP image as faint blotches on the walls, which is bake noise at 128 samples; at 48 samples the blotches were plain to see and the score was 0.1688.
+`brick-room` (issue #128) is a closed room built from a recipe (`createAgentScene`) with three brick pattern walls, two point lights and a table with a vase. Blender gets the box projection as UVs (`boxProjectedGeometry`) and the baked brick map, but not the bump or the roughness map. Measured 2026-11-01 on the RTX 3060: against Cycles 0.5102 without the bake and 0.1515 with it (`npm run reference -- --bake brick-room`; SwiftShader 0.5096 and 0.1503; EEVEE against Cycles 0.5020); the bake took 14.4 s for 28,576 texels while another session loaded the machine. `lit-interior` stayed at 0.1444 with the bake, and every scene without a bake kept its earlier score to four digits (largest change 0.0000).
+
`brick-graph` (issue #50) is a wall of bricks written as one material graph (triangle waves for the joints, half a brick of shift on every second course, noise through a colour ramp, height as bump) on a quad with UVs, so it uses `mapping: "uv"`. `render-blender.py` translates the same graph JSON into Blender nodes (Math, Map Range, Noise Texture, Color Ramp, Mix and Bump), so each side evaluates its own nodes. It measured 0.2269 against Cycles and 0.1440 for EEVEE on 2026-10-31. A first run scored 0.4027 and showed a black wall in 67js: the `min` and `max` nodes returned NaN. The scene found that bug. The other rows were re-measured in the same run; `glass` against Cycles moved from 0.1450 to 0.1326 and `lit-interior` to the with-shadows numbers described above, and no other score moved by more than 0.002.
+ `brushed-film` (issue #51) holds a brushed gold sphere (`anisotropy` 0.8), a dark sphere with a thin film (`iridescence`, IOR 1.3, 400 nm) and a silver sphere with the same film. `render-blender.py` maps the glTF anisotropy model onto Blender's aspect ratio (alpha along the tangent is `mix(alpha, 1, strength^2)`, so Blender gets Anisotropic = (1 - alpha / alpha_tangent) / 0.9 and the geometric-mean roughness) and feeds a UV-map Tangent node, because Blender's default tangent is a different field: with the default tangent the first run scored 0.1673 against Cycles and the highlight ran in rings where 67js had bands; with the UV tangent it scores 0.1613 and the highlight direction matches. Thin film goes to Principled Thin Film Thickness and IOR. EEVEE draws no thin film, so its sphere stays black. The two models are not the same: Blender's film is its own Fresnel integration, 67js uses Belcour and Barla at the view angle, so match the colours by eye in the image, not by the score alone. Measured 2026-11-01 on the RTX 3060 and SwiftShader. Before and after adding anisotropy and iridescence, every older scene scored the same against Cycles and EEVEE to four digits (largest change 0.0000, limit 0.002), because their shaders compile the two layers out.
+
The mean against Cycles is 0.198 for 67js and 0.160 for EEVEE. The mean difference between the RTX 3060 and SwiftShader is 0.007.
EEVEE against Cycles is a yardstick: it shows what a good rasterizer scores. In `lit-interior` and `fog`, EEVEE scores no better than 67js. Those two scenes depend on indirect light, and this suite does not use EEVEE light probes. A low score does not mean a good picture on its own, so read each score with its image in `images/`.
diff --cc bench/reference/baseline.json
index c05be319,d12c095b..21e8feba
--- a/bench/reference/baseline.json
+++ b/bench/reference/baseline.json
@@@ -1,156 -1,156 +1,168 @@@
{
- "metric": "FLIP (LDR), mean error, lower is better",
- "blenderVersion": "5.2.2 LTS",
- "seconds": {
- "brick-graph": {
- "cycles": 53.1,
- "eevee": 66.2
- },
- "brick-room": {
- "cycles": 56.7,
- "eevee": 7.1
- },
- "car-paint": {
- "cycles": 28.1,
- "eevee": 13.7
- },
- "character": {
- "cycles": 38.8,
- "eevee": 12.0
- },
- "fog": {
- "cycles": 146.4,
- "eevee": 95.8
- },
- "foliage": {
- "cycles": 47.6,
- "eevee": 173.8
- },
- "glass": {
- "cycles": 127.1,
- "eevee": 64.6
- },
- "lit-interior": {
- "cycles": 206.9,
- "eevee": 233.9
- },
- "material-spheres": {
- "cycles": 40.8,
- "eevee": 229.1
- },
- "metal": {
- "cycles": 225.1,
- "eevee": 14.1
- },
- "outdoor-hdri": {
- "cycles": 11.3,
- "eevee": 11.0
- },
- "spot-area": {
- "cycles": 12.7,
- "eevee": 21.2
- }
- },
- "graphics": {
- "gpu": "ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 (0x00002487) Direct3D11 vs_5_0 ps_5_0, D3D11)",
- "cpu": "ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (Subzero) (0x0000C0DE)), SwiftShader driver)"
- },
- "scores": {
- "brick-graph": {
- "gpu-vs-cycles": 0.2269,
- "gpu-vs-eevee": 0.148,
- "cpu-vs-cycles": 0.2268,
- "cpu-vs-eevee": 0.1479,
- "eevee-vs-cycles": 0.144,
- "gpu-vs-cpu": 0.0074
- },
- "brick-room": {
- "gpu-vs-cycles": 0.5102,
- "gpu-vs-eevee": 0.071,
- "cpu-vs-cycles": 0.5096,
- "cpu-vs-eevee": 0.0713,
- "eevee-vs-cycles": 0.502,
- "gpu-vs-cpu": 0.0071
- },
- "car-paint": {
- "gpu-vs-cycles": 0.1521,
- "gpu-vs-eevee": 0.1323,
- "cpu-vs-cycles": 0.152,
- "cpu-vs-eevee": 0.1323,
- "eevee-vs-cycles": 0.0819,
- "gpu-vs-cpu": 0.0055
- },
- "character": {
- "gpu-vs-cycles": 0.0995,
- "gpu-vs-eevee": 0.0833,
- "cpu-vs-cycles": 0.099,
- "cpu-vs-eevee": 0.0826,
- "eevee-vs-cycles": 0.074,
- "gpu-vs-cpu": 0.0068
- },
- "fog": {
- "gpu-vs-cycles": 0.2612,
- "gpu-vs-eevee": 0.0542,
- "cpu-vs-cycles": 0.2608,
- "cpu-vs-eevee": 0.0542,
- "eevee-vs-cycles": 0.2662,
- "gpu-vs-cpu": 0.0085
- },
- "foliage": {
- "gpu-vs-cycles": 0.1594,
- "gpu-vs-eevee": 0.1387,
- "cpu-vs-cycles": 0.159,
- "cpu-vs-eevee": 0.1384,
- "eevee-vs-cycles": 0.0783,
- "gpu-vs-cpu": 0.0096
- },
- "glass": {
- "gpu-vs-cycles": 0.1326,
- "gpu-vs-eevee": 0.1472,
- "cpu-vs-cycles": 0.1323,
- "cpu-vs-eevee": 0.1474,
- "eevee-vs-cycles": 0.115,
- "gpu-vs-cpu": 0.0075
- },
- "lit-interior": {
- "gpu-vs-cycles": 0.5055,
- "gpu-vs-eevee": 0.0923,
- "cpu-vs-cycles": 0.5051,
- "cpu-vs-eevee": 0.0928,
- "eevee-vs-cycles": 0.5159,
- "gpu-vs-cpu": 0.0062
- },
- "material-spheres": {
- "gpu-vs-cycles": 0.1598,
- "gpu-vs-eevee": 0.1196,
- "cpu-vs-cycles": 0.1595,
- "cpu-vs-eevee": 0.1194,
- "eevee-vs-cycles": 0.1006,
- "gpu-vs-cpu": 0.0069
- },
- "metal": {
- "gpu-vs-cycles": 0.1868,
- "gpu-vs-eevee": 0.1565,
- "cpu-vs-cycles": 0.1867,
- "cpu-vs-eevee": 0.1565,
- "eevee-vs-cycles": 0.0934,
- "gpu-vs-cpu": 0.0063
- },
- "outdoor-hdri": {
- "gpu-vs-cycles": 0.0676,
- "gpu-vs-eevee": 0.052,
- "cpu-vs-cycles": 0.0672,
- "cpu-vs-eevee": 0.0515,
- "eevee-vs-cycles": 0.0384,
- "gpu-vs-cpu": 0.0058
- },
- "spot-area": {
- "gpu-vs-cycles": 0.1242,
- "gpu-vs-eevee": 0.1707,
- "cpu-vs-cycles": 0.1242,
- "cpu-vs-eevee": 0.1709,
- "eevee-vs-cycles": 0.1935,
- "gpu-vs-cpu": 0.0032
+ "metric": "FLIP (LDR), mean error, lower is better",
+ "blenderVersion": "5.2.2 LTS",
+ "seconds": {
+ "brick-graph": {
+ "cycles": 8.9,
+ "eevee": 15.2
+ },
++ "brick-room": {
++ "cycles": 56.7,
++ "eevee": 7.1
++ },
+ "brushed-film": {
+ "cycles": 7.6,
+ "eevee": 7.4
+ },
+ "car-paint": {
+ "cycles": 35.4,
+ "eevee": 82.5
+ },
+ "character": {
+ "cycles": 19.2,
+ "eevee": 4.5
+ },
+ "fog": {
+ "cycles": 63.5,
+ "eevee": 36.3
+ },
+ "foliage": {
+ "cycles": 39.5,
+ "eevee": 27.4
+ },
+ "glass": {
+ "cycles": 29.5,
+ "eevee": 13.7
+ },
+ "lit-interior": {
+ "cycles": 77.4,
+ "eevee": 2.6
+ },
+ "material-spheres": {
+ "cycles": 25,
+ "eevee": 60.5
+ },
+ "metal": {
+ "cycles": 42.2,
+ "eevee": 30.4
+ },
+ "outdoor-hdri": {
+ "cycles": 42.9,
+ "eevee": 12.9
+ },
+ "spot-area": {
+ "cycles": 28.5,
+ "eevee": 10.1
+ }
+ },
+ "graphics": {
- "gpu": "ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 (0x00002487) Direct3D11 vs_5_0 ps_5_0, D3D11)",
- "cpu": "ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (Subzero) (0x0000C0DE)), SwiftShader driver)"
++ "cpu": "ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (Subzero) (0x0000C0DE)), SwiftShader driver)",
++ "gpu": "ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 (0x00002487) Direct3D11 vs_5_0 ps_5_0, D3D11)"
+ },
+ "scores": {
+ "brick-graph": {
+ "gpu-vs-cycles": 0.2269,
+ "gpu-vs-eevee": 0.148,
+ "cpu-vs-cycles": 0.2268,
+ "cpu-vs-eevee": 0.1479,
+ "eevee-vs-cycles": 0.144,
+ "gpu-vs-cpu": 0.0074
+ },
++ "brick-room": {
++ "gpu-vs-cycles": 0.5102,
++ "gpu-vs-eevee": 0.071,
++ "cpu-vs-cycles": 0.5096,
++ "cpu-vs-eevee": 0.0713,
++ "eevee-vs-cycles": 0.502,
++ "gpu-vs-cpu": 0.0071
++ },
+ "brushed-film": {
+ "gpu-vs-cycles": 0.1613,
+ "gpu-vs-eevee": 0.1601,
+ "cpu-vs-cycles": 0.1613,
+ "cpu-vs-eevee": 0.1601,
+ "eevee-vs-cycles": 0.0939,
+ "gpu-vs-cpu": 0.0058
+ },
+ "car-paint": {
+ "gpu-vs-cycles": 0.1521,
+ "gpu-vs-eevee": 0.1323,
+ "cpu-vs-cycles": 0.152,
+ "cpu-vs-eevee": 0.1323,
+ "eevee-vs-cycles": 0.0819,
+ "gpu-vs-cpu": 0.0055
+ },
+ "character": {
+ "gpu-vs-cycles": 0.0995,
+ "gpu-vs-eevee": 0.0833,
+ "cpu-vs-cycles": 0.099,
+ "cpu-vs-eevee": 0.0826,
+ "eevee-vs-cycles": 0.074,
+ "gpu-vs-cpu": 0.0068
+ },
+ "fog": {
+ "gpu-vs-cycles": 0.2612,
+ "gpu-vs-eevee": 0.0542,
+ "cpu-vs-cycles": 0.2608,
+ "cpu-vs-eevee": 0.0542,
+ "eevee-vs-cycles": 0.2662,
+ "gpu-vs-cpu": 0.0085
+ },
+ "foliage": {
+ "gpu-vs-cycles": 0.1594,
+ "gpu-vs-eevee": 0.1386,
+ "cpu-vs-cycles": 0.159,
+ "cpu-vs-eevee": 0.1384,
+ "eevee-vs-cycles": 0.0783,
+ "gpu-vs-cpu": 0.0096
+ },
+ "glass": {
+ "gpu-vs-cycles": 0.1326,
+ "gpu-vs-eevee": 0.1471,
+ "cpu-vs-cycles": 0.1323,
+ "cpu-vs-eevee": 0.1474,
+ "eevee-vs-cycles": 0.115,
+ "gpu-vs-cpu": 0.0075
+ },
+ "lit-interior": {
+ "gpu-vs-cycles": 0.5055,
+ "gpu-vs-eevee": 0.0923,
+ "cpu-vs-cycles": 0.5051,
+ "cpu-vs-eevee": 0.0928,
+ "eevee-vs-cycles": 0.5159,
+ "gpu-vs-cpu": 0.0062
+ },
+ "material-spheres": {
+ "gpu-vs-cycles": 0.1598,
+ "gpu-vs-eevee": 0.1196,
+ "cpu-vs-cycles": 0.1595,
+ "cpu-vs-eevee": 0.1194,
+ "eevee-vs-cycles": 0.1006,
+ "gpu-vs-cpu": 0.0069
+ },
+ "metal": {
+ "gpu-vs-cycles": 0.1868,
+ "gpu-vs-eevee": 0.1565,
+ "cpu-vs-cycles": 0.1867,
+ "cpu-vs-eevee": 0.1565,
+ "eevee-vs-cycles": 0.0934,
+ "gpu-vs-cpu": 0.0063
+ },
+ "outdoor-hdri": {
+ "gpu-vs-cycles": 0.0676,
+ "gpu-vs-eevee": 0.052,
+ "cpu-vs-cycles": 0.0672,
+ "cpu-vs-eevee": 0.0515,
+ "eevee-vs-cycles": 0.0384,
+ "gpu-vs-cpu": 0.0058
+ },
+ "spot-area": {
+ "gpu-vs-cycles": 0.1242,
+ "gpu-vs-eevee": 0.1707,
+ "cpu-vs-cycles": 0.1242,
+ "cpu-vs-eevee": 0.1709,
+ "eevee-vs-cycles": 0.1935,
+ "gpu-vs-cpu": 0.0032
+ }
}
- }
}
diff --cc bench/reference/harness.js
index a89cacf6,3be45b70..28d37874
--- a/bench/reference/harness.js
+++ b/bench/reference/harness.js
@@@ -2,7 -2,7 +2,8 @@@
import { Renderer67 } from '/src/renderer.js';
import { REFERENCE_SCENES } from './scenes.js';
import { skinnedGeometry } from '/src/path-tracer-scene.js';
+import { boxProjectedGeometry } from '/src/export-box-uv.js';
+ import '/src/material-layer-shaders.js';
function encodeBytes(typedArray) {
const bytes = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
diff --cc bench/size/baseline.json
index c257bdd7,f8a6b805..ef9d4c90
--- a/bench/size/baseline.json
+++ b/bench/size/baseline.json
@@@ -14,9 -14,9 +14,9 @@@
},
"bundles": {
"entry:core": {
- "min": 283595,
- "gzip": 81018,
- "brotli": 69071
- "min": 285004,
- "gzip": 81468,
- "brotli": 69421
++ "min": 287420,
++ "gzip": 82181,
++ "brotli": 70138
},
"entry:model": {
"min": 40093,
@@@ -39,9 -39,14 +39,14 @@@
"brotli": 7331
},
"entry:gltf": {
- "min": 154791,
- "gzip": 47466,
- "brotli": 40652
- "min": 155888,
- "gzip": 47824,
- "brotli": 41448
++ "min": 156342,
++ "gzip": 47981,
++ "brotli": 41563
+ },
+ "entry:gltf+lazy": {
- "min": 162321,
- "gzip": 49816,
- "brotli": 43258
++ "min": 162775,
++ "gzip": 49970,
++ "brotli": 43374
},
"entry:modeling": {
"min": 21149,
@@@ -124,14 -129,14 +129,14 @@@
"brotli": 4675
},
"entry:light-bake": {
-- "min": 67640,
-- "gzip": 24815,
-- "brotli": 21956
++ "min": 69068,
++ "gzip": 25370,
++ "brotli": 22449
},
"entry:path-tracer": {
-- "min": 31466,
-- "gzip": 12605,
-- "brotli": 11075
++ "min": 33334,
++ "gzip": 13432,
++ "brotli": 11761
},
"entry:texture-set": {
"min": 1837,
@@@ -139,24 -144,24 +144,24 @@@
"brotli": 762
},
"entry:agent-scene": {
- "min": 206699,
- "gzip": 63263,
- "brotli": 54923
- "min": 208967,
- "gzip": 63945,
- "brotli": 55786
++ "min": 209457,
++ "gzip": 64112,
++ "brotli": 55993
},
"entry:agent-scene+lazy": {
- "min": 614147,
- "gzip": 210233,
- "brotli": 185269
- "min": 623239,
- "gzip": 213035,
- "brotli": 188048
++ "min": 626190,
++ "gzip": 214248,
++ "brotli": 189205
},
"entry:agent-asset": {
- "min": 300910,
- "gzip": 93744,
- "brotli": 81565
- "min": 303069,
- "gzip": 94728,
- "brotli": 82813
++ "min": 303562,
++ "gzip": 94893,
++ "brotli": 82975
},
"entry:agent-asset+lazy": {
- "min": 650097,
- "gzip": 220739,
- "brotli": 193778
- "min": 659080,
- "gzip": 223845,
- "brotli": 196982
++ "min": 662034,
++ "gzip": 225055,
++ "brotli": 198170
},
"entry:hdri": {
"min": 8075,
@@@ -173,25 -178,35 +178,35 @@@
"gzip": 1608,
"brotli": 1425
},
+ "entry:material-layer-shaders": {
- "min": 71379,
- "gzip": 18505,
- "brotli": 16205
++ "min": 71833,
++ "gzip": 18658,
++ "brotli": 16359
+ },
"scene:lit-box": {
- "min": 214877,
- "gzip": 58928,
- "brotli": 50227
- "min": 215844,
- "gzip": 59286,
- "brotli": 50588
++ "min": 217804,
++ "gzip": 59861,
++ "brotli": 51117
},
"scene:gltf-box": {
- "min": 273787,
- "gzip": 78107,
- "brotli": 67034
- "min": 275471,
- "gzip": 79332,
- "brotli": 68903
++ "min": 277431,
++ "gzip": 79898,
++ "brotli": 69584
+ },
+ "scene:gltf-box+lazy": {
- "min": 281904,
- "gzip": 81319,
- "brotli": 70712
++ "min": 283864,
++ "gzip": 81888,
++ "brotli": 71399
},
"scene:agent-scene": {
- "min": 315953,
- "gzip": 92416,
- "brotli": 79459
- "min": 318701,
- "gzip": 94262,
- "brotli": 81921
++ "min": 320697,
++ "gzip": 94869,
++ "brotli": 82532
},
"scene:agent-scene+lazy": {
- "min": 723401,
- "gzip": 239390,
- "brotli": 209757
- "min": 732973,
- "gzip": 243364,
- "brotli": 214130
++ "min": 737430,
++ "gzip": 245010,
++ "brotli": 215663
}
}
}
diff --cc bench/size/budgets.json
index facb2f43,e04b838f..f84978af
--- a/bench/size/budgets.json
+++ b/bench/size/budgets.json
@@@ -1,17 -1,18 +1,18 @@@
{
-- "archiveBytes": 786350,
++ "archiveBytes": 801000,
"goals": {
"lit-box": 50000,
"gltf-box": 80000,
"agent-scene": 100000
},
"budgets": {
- "entry:core": 82700,
- "entry:core": 83100,
++ "entry:core": 83900,
"entry:model": 14400,
"entry:nature": 13200,
"entry:motion": 13600,
"entry:canvas2d": 9400,
- "entry:gltf": 48500,
- "entry:gltf": 48800,
- "entry:gltf+lazy": 50900,
++ "entry:gltf": 49000,
++ "entry:gltf+lazy": 51000,
"entry:modeling": 8700,
"entry:sculpt": 2500,
"entry:surface": 10100,
@@@ -28,19 -29,21 +29,21 @@@
"entry:terrain": 3100,
"entry:grass": 4400,
"entry:clutter": 5300,
-- "entry:light-bake": 25400,
- "entry:path-tracer": 12900,
++ "entry:light-bake": 25900,
+ "entry:path-tracer": 13800,
"entry:texture-set": 900,
- "entry:agent-scene": 64600,
- "entry:agent-scene+lazy": 214500,
- "entry:agent-asset": 95700,
- "entry:agent-asset+lazy": 225200,
- "entry:agent-scene": 65300,
- "entry:agent-scene+lazy": 217300,
- "entry:agent-asset": 96700,
- "entry:agent-asset+lazy": 228400,
++ "entry:agent-scene": 65400,
++ "entry:agent-scene+lazy": 218600,
++ "entry:agent-asset": 96800,
++ "entry:agent-asset+lazy": 229600,
"entry:hdri": 3300,
"entry:camera-effects": 8600,
"entry:render-passes": 1700,
- "scene:lit-box": 60200,
- "scene:gltf-box": 79700,
- "scene:agent-scene": 94300,
- "scene:agent-scene+lazy": 244200
- "entry:material-layer-shaders": 18900,
- "scene:lit-box": 60500,
- "scene:gltf-box": 81000,
- "scene:gltf-box+lazy": 83000,
- "scene:agent-scene": 96200,
- "scene:agent-scene+lazy": 248300
++ "entry:material-layer-shaders": 19100,
++ "scene:lit-box": 61100,
++ "scene:gltf-box": 81500,
++ "scene:gltf-box+lazy": 83600,
++ "scene:agent-scene": 96800,
++ "scene:agent-scene+lazy": 250000
}
}
diff --cc docs/parity.md
index 01e491b2,06ffb5df..182f7d0e
--- a/docs/parity.md
+++ b/docs/parity.md
@@@ -187,7 -187,7 +187,7 @@@ To move to a new Blender release, run `
| Physics > Baking Physics Simulations | partial | Physics records to a timeline in code or when a recipe scene is created, on the main thread. | [film-physics](../tests/film-physics.test.js) | #61 |
| Physics > Simulation Nodes | missing | No node graph. | | #43 |
| Rendering > Render Engines > EEVEE | partial | A WebGL2 rasterizer with PBR, one directional shadow, 8 point lights, fog and bloom. There are no light probes. | [renderer](../tests/renderer.test.js), [scores against EEVEE](../bench/reference/baseline.json) | #52, #53, #55, #56 |
- | Rendering > Render Engines > Cycles | partial | A CPU path tracer (`addons/path-tracer`, or `settings.renderer` on an image render job; [path-tracer](path-tracer.md)) draws diffuse, GGX metal, clear coat, glass, maps, cutouts, the sun, point, spot and area lights with soft shadows and the environment map, with a denoiser. At 32 samples its FLIP score against Cycles is better than the rasterizer's on 7 of the 11 reference scenes and worse on `outdoor-hdri`, `character`, `fog` (no volume fog) and `foliage` (equal to 0.0003); the mean is 0.171 against 0.189 (`npm run reference -- --path-tracer`, [bench/reference/path-tracer.json](../bench/reference/path-tracer.json)). It does not trace volume fog, normal maps or translucent leaves, and it is not Cycles parity. `addons/light-bake` bakes bounced light from point lights and the sun into a lightmap for each part, on the CPU with ray tracing; recipes reach it through the `bake` section and `set-bake` (draft, standard or fine presets; scene_inspect reports bake seconds and skipped parts), patterned, textured and emissive parts bake through a second UV set and a `lightMap` slot, GLB export writes the map approximately as `TEXCOORD_1` emissive, but there are no reflection probes, no spot or area lights, no baked AO. On `lit-interior` it brings the score against Cycles from 0.5055 to 0.1444 (`npm run reference -- --bake lit-interior`). | [light-bake](../tests/light-bake.test.js), [path-tracer](../tests/path-tracer.test.js), [recipe bake](../tests/agent-bake.test.js), [frame time](../bench/reference/frame-time.mjs), [lit-interior scene](../bench/reference/scenes.js) | #55, #57, #128 |
-| Rendering > Render Engines > Cycles | partial | A CPU path tracer (`addons/path-tracer`, or `settings.renderer` on an image render job; [path-tracer](path-tracer.md)) draws diffuse, GGX metal, clear coat, glass, maps, cutouts, the sun, point, spot and area lights with soft shadows and the environment map, with a denoiser. At 32 samples its FLIP score against Cycles is better than the rasterizer's on 7 of the 11 reference scenes and worse on `outdoor-hdri`, `character`, `fog` (no volume fog) and `foliage` (equal to 0.0003); the mean is 0.171 against 0.189 (`npm run reference -- --path-tracer`, [bench/reference/path-tracer.json](../bench/reference/path-tracer.json)). It draws normal and metallic-roughness maps on UV-mapped materials (issue #129) and runs about 2.8 times faster per thread than at that table, so its scores and seconds there predate both; it does not trace volume fog, translucent leaves or maps on box-projected materials, a 1080p still of a 181,708 triangle room at 64 samples still does not finish inside the 240 s job limit, and it is not Cycles parity. `addons/light-bake` bakes bounced light from point lights and the sun into a lightmap for each part, on the CPU with ray tracing; recipes reach it through the `bake` section and `set-bake` (draft, standard or fine presets; scene_inspect reports bake seconds and skipped parts), but there is no GLB export, no reflection probes, no spot or area lights, no baked AO. On `lit-interior` it brings the score against Cycles from 0.5055 to 0.1444 (`npm run reference -- --bake lit-interior`). | [light-bake](../tests/light-bake.test.js), [path-tracer](../tests/path-tracer.test.js), [recipe bake](../tests/agent-bake.test.js), [frame time](../bench/reference/frame-time.mjs), [lit-interior scene](../bench/reference/scenes.js) | #55, #57 |
++| Rendering > Render Engines > Cycles | partial | A CPU path tracer (`addons/path-tracer`, or `settings.renderer` on an image render job; [path-tracer](path-tracer.md)) draws diffuse, GGX metal, clear coat, glass, maps, cutouts, the sun, point, spot and area lights with soft shadows and the environment map, with a denoiser. At 32 samples its FLIP score against Cycles is better than the rasterizer's on 7 of the 11 reference scenes and worse on `outdoor-hdri`, `character`, `fog` (no volume fog) and `foliage` (equal to 0.0003); the mean is 0.171 against 0.189 (`npm run reference -- --path-tracer`, [bench/reference/path-tracer.json](../bench/reference/path-tracer.json)). It draws normal and metallic-roughness maps on UV-mapped materials (issue #129) and runs about 2.8 times faster per thread than at that table, so its scores and seconds there predate both; it does not trace volume fog, translucent leaves or maps on box-projected materials, a 1080p still of a 181,708 triangle room at 64 samples still does not finish inside the 240 s job limit, and it is not Cycles parity. `addons/light-bake` bakes bounced light from point lights and the sun into a lightmap for each part, on the CPU with ray tracing; recipes reach it through the `bake` section and `set-bake` (draft, standard or fine presets; scene_inspect reports bake seconds and skipped parts), patterned, textured and emissive parts bake through a second UV set and a `lightMap` slot, GLB export writes the map approximately as `TEXCOORD_1` emissive, but there are no reflection probes, no spot or area lights, no baked AO. On `lit-interior` it brings the score against Cycles from 0.5055 to 0.1444 (`npm run reference -- --bake lit-interior`). | [light-bake](../tests/light-bake.test.js), [path-tracer](../tests/path-tracer.test.js), [recipe bake](../tests/agent-bake.test.js), [frame time](../bench/reference/frame-time.mjs), [lit-interior scene](../bench/reference/scenes.js) | #55, #57, #128 |
| Rendering > Render Engines > Workbench | out of scope | A viewport engine for working by hand. | | |
| Rendering > Cameras | partial | Perspective, orthographic views, focal length, animated paths, depth of field from depth and camera motion blur, both repeatable per frame. Object motion blur and bokeh shapes are missing. | [camera-path](../tests/camera-path.test.js), [camera](../tests/camera.test.js), [render-passes](../tests/render-passes.test.js) | #54 |
| Rendering > Lights > Light Objects | partial | One directional light with a shadow, 8 point lights, 8 spot lights and 4 rectangular area lights. Point and spot lights can cast shadows from one 24-tile atlas (a point light takes 6 tiles, a spot light 1). Area lights use a representative point and cast no shadow. The directional shadow is a single map, not cascaded. | [lighting](../tests/lighting.test.js), `npm run reference` scene `spot-area` | #52 |
diff --cc src/renderer.js
index f3db97fe,fdb8e502..e93059ba
--- a/src/renderer.js
+++ b/src/renderer.js
@@@ -54,9 -54,10 +54,11 @@@ function shaderFeaturesOfParts(parts)
MATERIAL_MAPS.forEach((field, index) => {
if (material[field]) features.add(MAP_SHADER_FEATURES[index]);
});
+ if (material.lightMap) features.add('lightMap');
if (material.layers) features.add('splat');
if (material.moss > 0) features.add('moss');
+ if (material.anisotropy > 0) features.add('anisotropy');
+ if (material.iridescence > 0) features.add('iridescence');
if ((material.alphaMode ?? 'opaque') !== 'opaque') features.add('alphaMode');
if (TAG_SHADER_FEATURES.has(material.tag)) features.add(material.tag);
}
@@@ -550,7 -522,7 +552,7 @@@ export class Renderer67
finishMainProgram(pendingProgram) {
this.program = finishProgram(this.context, pendingProgram);
- this.uniforms = Object.fromEntries(['materialDielectric', 'materialCoat', 'materialSheen', 'boxMapScale', 'boxMapAxis', 'lightMap', 'lightMapScale', 'hasLightMap', 'viewProjection', 'lightProjection', 'eye', 'armorColor', 'armorSurface', 'exposure', 'inspection', 'shadowMap', ...MAP_UNIFORMS, ...MAP_FLAGS, ...SKIN_UNIFORMS, ...MORPH_UNIFORMS, 'normalScale', 'occlusionStrength', 'materialMoss', ...SPLAT_UNIFORMS, 'hdrEnabled', 'time', 'wind', 'worldMode', 'daylight', 'fogColor', 'lightDirection', 'fogDensity', 'waterRipple', 'rippleTime', 'explosionProgress', 'explosionCenter', 'assemblyAmount', 'renderPassMode', 'renderPassDepthRange', 'renderPassObjectBase', ...ALPHA_UNIFORMS].map((name) => [name, this.context.getUniformLocation(this.program, name)]));
- this.uniforms = Object.fromEntries(['materialDielectric', 'materialCoat', 'materialSheen', 'materialAnisotropy', 'materialIridescence', 'boxMapScale', 'boxMapAxis', 'viewProjection', 'lightProjection', 'eye', 'armorColor', 'armorSurface', 'exposure', 'inspection', 'shadowMap', ...MAP_UNIFORMS, ...MAP_FLAGS, ...SKIN_UNIFORMS, ...MORPH_UNIFORMS, 'normalScale', 'occlusionStrength', 'materialMoss', ...SPLAT_UNIFORMS, 'hdrEnabled', 'time', 'wind', 'worldMode', 'daylight', 'fogColor', 'lightDirection', 'fogDensity', 'waterRipple', 'rippleTime', 'explosionProgress', 'explosionCenter', 'assemblyAmount', 'renderPassMode', 'renderPassDepthRange', 'renderPassObjectBase', ...ALPHA_UNIFORMS].map((name) => [name, this.context.getUniformLocation(this.program, name)]));
++ this.uniforms = Object.fromEntries(['materialDielectric', 'materialCoat', 'materialSheen', 'materialAnisotropy', 'materialIridescence', 'boxMapScale', 'boxMapAxis', 'lightMap', 'lightMapScale', 'hasLightMap', 'viewProjection', 'lightProjection', 'eye', 'armorColor', 'armorSurface', 'exposure', 'inspection', 'shadowMap', ...MAP_UNIFORMS, ...MAP_FLAGS, ...SKIN_UNIFORMS, ...MORPH_UNIFORMS, 'normalScale', 'occlusionStrength', 'materialMoss', ...SPLAT_UNIFORMS, 'hdrEnabled', 'time', 'wind', 'worldMode', 'daylight', 'fogColor', 'lightDirection', 'fogDensity', 'waterRipple', 'rippleTime', 'explosionProgress', 'explosionCenter', 'assemblyAmount', 'renderPassMode', 'renderPassDepthRange', 'renderPassObjectBase', ...ALPHA_UNIFORMS].map((name) => [name, this.context.getUniformLocation(this.program, name)]));
for (const name of LIGHT_UNIFORMS) {
this.uniforms[name] = this.context.getUniformLocation(this.program, name);
}
diff --cc tests/reference-baseline.test.js
index 2d044d55,e6690737..f4787f4c
--- a/tests/reference-baseline.test.js
+++ b/tests/reference-baseline.test.js
@@@ -4,7 -4,7 +4,7 @@@ import test from 'node:test'
const REFERENCE_DIRECTORY = new URL('../bench/reference/', import.meta.url);
const baseline = JSON.parse(readFileSync(new URL('baseline.json', REFERENCE_DIRECTORY), 'utf8'));
- const EXPECTED_SCENES = ['brick-graph', 'brick-room', 'car-paint', 'character', 'fog', 'foliage', 'glass', 'lit-interior', 'material-spheres', 'metal', 'outdoor-hdri', 'spot-area'];
-const EXPECTED_SCENES = ['brick-graph', 'brushed-film', 'car-paint', 'character', 'fog', 'foliage', 'glass', 'lit-interior', 'material-spheres', 'metal', 'outdoor-hdri', 'spot-area'];
++const EXPECTED_SCENES = ['brick-graph', 'brick-room', 'brushed-film', 'car-paint', 'character', 'fog', 'foliage', 'glass', 'lit-interior', 'material-spheres', 'metal', 'outdoor-hdri', 'spot-area'];
const EXPECTED_SCORES = ['cpu-vs-cycles', 'cpu-vs-eevee', 'eevee-vs-cycles', 'gpu-vs-cpu', 'gpu-vs-cycles', 'gpu-vs-eevee'];
test('the render baseline scores every scene with every renderer pair', () => {