Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Expect an instance update for the moving pendant now that jobs export instances (#896)

Nguyen Xuan An8837498c0b97
diff --git a/bench/native-tracer/sequence-job.mjs b/bench/native-tracer/sequence-job.mjs
index 9c4856be..7ffed5d0 100644
--- a/bench/native-tracer/sequence-job.mjs
+++ b/bench/native-tracer/sequence-job.mjs
@@ -4,7 +4,7 @@
// Variants (the demo room with its motion edited and, except "particles", its particle systems removed, since sparks and swaying hair rebuild the
// triangles and the emissive list at every time and a session is only reused when the exported tables are equal): camera (camera tracks only,
// every later frame `reused`), material (plus a roughness track: `updated`), light (plus a point light intensity track: `updated`), transform
-// (the recipe's own tracks, where a pendant swings: the exported triangles change, so a frame gets a new session unless the swing has returned to an earlier pose) and particles (camera tracks
+// (the recipe's own tracks, where a pendant swings: the job exports shared geometry as instances, so the swing is an instance transform: `updated`, or `reused` when it has returned to an earlier pose) and particles (camera tracks
// with the sparks left in: a new session per frame, as costly as a one-shot trace).
// A run with sessions off carries no `nativeSession` in its reports, so its route list is empty by design.
// Prints one SEQUENCE_JOB line of JSON and exits 1 when a frame differs or a route is not the expected one.
@@ -42,7 +42,7 @@ function buildVariants(recipe) {
camera: { recipe: withMotion(cameraTracks), expectedLaterRoute: 'reused' },
material: { recipe: withMotion([...cameraTracks, { kind: 'material', id: materialId, property: 'roughness', interpolation: 'LINEAR', keyframes: keyframes(0.9, 0.2) }]), expectedLaterRoute: 'updated' },
light: { recipe: withMotion([...cameraTracks, { kind: 'light', id: 'point:0', property: 'intensity', interpolation: 'LINEAR', keyframes: keyframes(14, 4) }]), expectedLaterRoute: 'updated' },
- transform: { recipe: withMotion(recipe.motion.tracks), expectedLaterRoute: 'new-session', allowedRoutes: ['new-session', 'reused'] },
+ transform: { recipe: withMotion(recipe.motion.tracks), expectedLaterRoute: 'updated', allowedRoutes: ['updated', 'reused'] },
particles: { recipe: { ...recipe, motion: { ...recipe.motion, tracks: cameraTracks } }, expectedLaterRoute: 'new-session' },
};
}
diff --git a/docs/cycles-parity.md b/docs/cycles-parity.md
index 2b2b4ae5..3acb84e7 100644
--- a/docs/cycles-parity.md
+++ b/docs/cycles-parity.md
@@ -925,7 +925,7 @@ What the numbers say `[inferred]`: a session removes the acceleration build and
### Real jobs (8 stills through the MCP server, RTX 4090, page on SwiftShader, native tracer on the GPU)
-`bench/native-tracer/sequence-job.mjs` on the demo room, each variant run with sessions and with `JS67_NATIVE_SESSIONS=off`: every frame of every variant is byte-identical between the two runs. Routes of frames 2 to 8 `[measured]`: camera tracks only, `reused` on all 7; plus a roughness track, `updated` on all 7 (table `materials`); plus a point light intensity track, `updated` on all 7 (tables `lights`, `lightTreeNodes`, `lightTreeEmitters`); the recipe's own motion (a pendant swings), `new-session` on 6 and `reused` on 1 (the swing returned to an earlier pose), because the flattened export holds the pendant's triangles; with the sparks and fur particle systems left in, `new-session` on all 7 (`emissiveTriangleCount` changes from frame to frame). Cause, found by diffing the page export between times in Node (`[measured]`): the demo room's `particles` (sparks emit glowing triangles over time, hair sways) rebuild the triangle and emissive tables at every time, so a camera-only edit of the recipe with its particles left in still changes `triangles`; with them removed only the camera block differs. The export itself is deterministic and does not cull by camera. A session cannot keep the acceleration structure across a change of the emissive or triangle count: `update` refuses a count change by design, because the BLAS holds the triangles and the session's buffers and bind group are sized at creation; allowing it needs a Rust change to re-create the emissive, light and light tree buffers and the bind group (and re-specialize the kernel) while keeping the BLAS, which is not worth it while the triangles change in the same frames.
+`bench/native-tracer/sequence-job.mjs` on the demo room, each variant run with sessions and with `JS67_NATIVE_SESSIONS=off`: every frame of every variant is byte-identical between the two runs. Routes of frames 2 to 8 `[measured]`: camera tracks only, `reused` on all 7; plus a roughness track, `updated` on all 7 (table `materials`); plus a point light intensity track, `updated` on all 7 (tables `lights`, `lightTreeNodes`, `lightTreeEmitters`); the recipe's own motion (a pendant swings), `updated` on 6 with the top-level acceleration structure rebuilt (tables `instances`, `emissiveTriangles`, `lights` and the light tree) and `reused` on 1 (the swing returned to an earlier pose), since jobs export shared geometry as instances (before that export every such frame took `new-session`, because the flattened tables hold the pendant's triangles); with the sparks and fur particle systems left in, `new-session` on all 7 (`emissiveTriangleCount` changes from frame to frame). Cause, found by diffing the page export between times in Node (`[measured]`): the demo room's `particles` (sparks emit glowing triangles over time, hair sways) rebuild the triangle and emissive tables at every time, so a camera-only edit of the recipe with its particles left in still changes `triangles`; with them removed only the camera block differs. The export itself is deterministic and does not cull by camera. A session cannot keep the acceleration structure across a change of the emissive or triangle count: `update` refuses a count change by design, because the BLAS holds the triangles and the session's buffers and bind group are sized at creation; allowing it needs a Rust change to re-create the emissive, light and light tree buffers and the bind group (and re-specialize the kernel) while keeping the BLAS, which is not worth it while the triangles change in the same frames.
### Large scenes (12 frames, same card)