Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Merge origin/main into feat/611-render-output

Nguyen Xuan An69480a098782
diff --cc scripts/agent-preview-browser.js
index a8da47a7,0d25ce27..7b759791
--- a/scripts/agent-preview-browser.js
+++ b/scripts/agent-preview-browser.js
@@@ -389,7 -397,20 +398,20 @@@ function previousCameraFor(record, moti
return previousCamera;
}
+ // The parts' world matrices now and at the start of the shutter, sampled from time like the previous camera. Only a scene that
+ // asks for object blur (and has motion to sample) pays for it; an imported asset animates by skin, which this does not follow.
+ function objectMotionFor(record, motionTime) {
+ const { shutter, objects } = record.scene.effects.motionBlur;
+ if (!(shutter > 0 && objects > 0) || motionTime === undefined || record.asset) return undefined;
+ const { sampleWorldMatrices } = agentSceneModule('objectMotionBlur');
+ const current = sampleWorldMatrices(record.scene.parts);
+ record.scene.sampleMotion(Math.max(0, motionTime - shutter));
+ const previous = sampleWorldMatrices(record.scene.parts);
+ record.scene.sampleMotion(motionTime);
+ return { current, previous };
+ }
+
-function createPreview(scene, { sessionId, memoryBudgetMiB, backend }, asset, placedAssets, sequenceFrames) {
+function createPreview(scene, { sessionId, memoryBudgetMiB, backend, transparent = false }, asset, placedAssets, sequenceFrames) {
if (active) {
throw new Error('Dispose the current scene before creating another.');
}
@@@ -758,8 -780,7 +781,8 @@@ window.__agentPreview =
const shotEffects = depthOfFieldOverrides
? { ...record.scene.effects, depthOfField: { ...record.scene.effects.depthOfField, ...depthOfFieldOverrides } }
: undefined;
- draw(record, rendererTime, shotCamera, { pass, passDepthRange, previousCamera, ...(objectMotion ? { objectMotion } : {}),
+ const outputFramebuffer = floatOutput && !pass ? record.floatModule.outputFor(record, canvas).framebuffer : undefined;
- draw(record, rendererTime, shotCamera, { pass, passDepthRange, passFloat, previousCamera, outputFramebuffer,
++ draw(record, rendererTime, shotCamera, { pass, passDepthRange, passFloat, previousCamera, outputFramebuffer, ...(objectMotion ? { objectMotion } : {}),
...(brightness === 1 ? {} : { exposure }), ...(shotEffects ? { effects: shotEffects } : {}) });
const info = renderInfo(record.renderer);
return pass === 'objectId' ? { ...info, objectNames: record.renderer.passSupport.objectNames() } : info;