3D engine that AI agents drive
JavaScript 3d3d-engineagentic-aiai-agentsblenderclaude-codegame-enginegaussian-splattinggltfjavascriptmcpmcp-servermodel-context-protocolpath-tracerpath-tracingpbrrenderingthreejs-alternativewebgl2webgpu
Hint motion-not-set on scene_look and scene_review of simulated scenes (#2052)
Nguyen Xuan An5c86179cea3c
diff --git a/changes/2052.md b/changes/2052.mdindex fd20546a..036b3eb5 100644--- a/changes/2052.md+++ b/changes/2052.md@@ -1 +1,2 @@- A stills or video job of a recipe whose only moving content is particles, physics or cloth now plays the motion clock from 0 when `settings.motion` is left out, instead of rendering frozen frames.+- `scene_look` and `scene_review` add a `motion-not-set` hint when the scene has particles, physics or cloth and no `motionTime` was given.diff --git a/scripts/agent-preview-browser.js b/scripts/agent-preview-browser.jsindex c8cbbdcb..207050a6 100644--- a/scripts/agent-preview-browser.js+++ b/scripts/agent-preview-browser.js@@ -51,6 +51,7 @@ import { BRANCH_LIMITS, createBranchStore, printableLabel } from '../src/agent-bimport { agentAssetDecodeOptions, withCatalogLimitAdvice } from '../src/agent-asset-limits.js';import { describeMarks, validateMarks } from '../src/agent-annotate.js';import { sceneQueryFor, partMaterialsFor, summarizeWalkMap, walkOptionsFor, createQueryOnlyCache } from './agent-walkmap.js';+import { MOTION_NOT_SET_HINT, recipePlaysSimulation } from '../src/motion-hint.js';// Open scenes by sessionId, least recently used first. One canvas serves them all, so at most one record owns a renderer;// a call on another scene hands the canvas over (the scene data stays, the renderer is rebuilt).@@ -1337,7 +1338,8 @@ window.__agentPreview = {data: labeledPng(labels),mimeType: 'image/png',metadata: { sessionId, revision: record.scene.revision, topologyRevision: record.scene.topologyRevision,- motionTime: record.scene.motionTime ?? null, ...render, ...(labels ? { labels } : {}) },+ motionTime: record.scene.motionTime ?? null, ...render, ...(labels ? { labels } : {}),+ ...(motionTime === undefined && recipePlaysSimulation(record.scene.exportRecipe()) ? { hints: [MOTION_NOT_SET_HINT] } : {}) },};},// The findings of a view without drawing it, for a job whose frames the page does not draw (the path tracer). Exposure isdiff --git a/scripts/agent-runtime.mjs b/scripts/agent-runtime.mjsindex 3327fc21..ec71139f 100644--- a/scripts/agent-runtime.mjs+++ b/scripts/agent-runtime.mjs@@ -61,6 +61,7 @@ import { mergeFrameDiagnostics, pathTracerFindingsLimit } from '../src/frame-cheimport { BRANCH_LIMITS, validateBranchName } from '../src/agent-branches.js';import { createSharedGpuCard } from './agent-gpu-queue.mjs';import { sessionProblem, SCENE_STORE_LIMITS } from '../src/agent-errors.js';+import { MOTION_NOT_SET_HINT, recipePlaysSimulation } from '../src/motion-hint.js';const SCENE_LIMITS = AGENT_SCENE_DEFAULT_LIMITS;const MAXIMUM_IMAGE_BYTES = 1024 * 1024;@@ -1523,7 +1524,8 @@ export function createAgentRuntime({ kernelWorkers = true, backend = 'gpu', browif (Buffer.byteLength(result.data, 'base64') > MAXIMUM_IMAGE_BYTES) throw new Error('The review PNG exceeds the 1 MiB image response budget. Request smaller shots.');output = { ...result, metadata: { sessionId: settings.sessionId, sourceRevision: snapshot.sourceRevision,backend, width: settings.gridWidth, height: settings.gridHeight, shots,- peakNodeBytes, peakBrowserHeap, maximumPendingFrames: 1 } };+ peakNodeBytes, peakBrowserHeap, maximumPendingFrames: 1,+ ...(recipePlaysSimulation(snapshot.recipe) && settings.shots.some(shot => shot.motionTime === null) ? { hints: [MOTION_NOT_SET_HINT] } : {}) } };} catch (error) {if (deadlineExpired) throw new Error(reviewDeadlineText());throw error;diff --git a/src/motion-hint.js b/src/motion-hint.jsnew file mode 100644index 00000000..d2973df4--- /dev/null+++ b/src/motion-hint.js@@ -0,0 +1,11 @@+/** The hint a preview carries when it shows frame 0 of a scene whose particles, physics or cloth only move on the motion clock. */+export const MOTION_NOT_SET_HINT = {+ kind: 'motion-not-set',+ message: 'This scene has particles, physics or cloth, and no motionTime was given, so the picture is frame 0.',+ fix: 'Pass motionTime (seconds from 0) to see the simulation at that moment, such as motionTime 1.',+};++/** Whether a recipe has simulated content that moves only when a motion time is sampled. */+export function recipePlaysSimulation(recipe) {+ return Boolean(recipe?.physics || recipe?.cloth || recipe?.particles);+}diff --git a/tests/render-job-simulation-motion.test.js b/tests/render-job-simulation-motion.test.jsindex 3138b2b2..69304507 100644--- a/tests/render-job-simulation-motion.test.js+++ b/tests/render-job-simulation-motion.test.js@@ -37,3 +37,10 @@ nodeTest('an image job and a recipe with nothing simulated get no implied motionassert.equal(normalizeJobSettings({ kind: 'image', width: 320, height: 180 }, [], particleRecipe).motion, undefined);assert.equal(normalizeJobSettings(stillsJob, [], { format: 'crucible.scene' }).motion, undefined);});++nodeTest('the motion-not-set hint says what to pass', async () => {+ const { MOTION_NOT_SET_HINT, recipePlaysSimulation } = await import('../src/motion-hint.js');+ assert.match(MOTION_NOT_SET_HINT.fix, /motionTime/);+ assert.equal(recipePlaysSimulation(particleRecipe), true);+ assert.equal(recipePlaysSimulation({ format: 'crucible.scene' }), false);+});