Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
refresh the camera's rig ancestors before measuring a Vector3 focus depth
[._.]/ Adam Eivyc79f851f5591
diff --git a/server/services/musicVideo/documentRender.browser.test.js b/server/services/musicVideo/documentRender.browser.test.jsindex 0dee2a1eb6..8a1e7547f2 100644--- a/server/services/musicVideo/documentRender.browser.test.js+++ b/server/services/musicVideo/documentRender.browser.test.js@@ -208,15 +208,18 @@ describe.skipIf(!canRun)('layered template with real Chrome and ffmpeg', () => {// A striped target card at the focus point: its edges blur visibly if// the focal plane misses it.const head = new THREE.Vector3(0, 2.2, 0.6);- rig.updateMatrixWorld(true);+ // No manual matrix update: the engine must resolve the rig itself.+ const at = camera.position.clone().add(rig.position);const card = new THREE.Group(); card.position.copy(head); scene.add(card);card.add(new THREE.Mesh(new THREE.PlaneGeometry(1, 1), new THREE.MeshBasicMaterial({ color: 0x000000 })));for (let i = -2; i <= 2; i++) { const bar = new THREE.Mesh(new THREE.PlaneGeometry(0.06, 1), new THREE.MeshBasicMaterial({ color: 0xffffff })); bar.position.set(i * 0.18, 0, 0.001); card.add(bar); }- card.lookAt(camera.getWorldPosition(new THREE.Vector3()));+ card.lookAt(at);Object.assign(ctx.lens, { grain: 0, vignette: 0, bloom: 0, focus: head, aperture, maxBlur: 24 });- window.headOnScreen = head.clone().project(camera);+ window.projectHead = () => head.clone().project(camera);};await window.portosComposition.seek(0);+ // The render has refreshed every matrix, so the projection is exact here.+ window.headOnScreen = window.projectHead();const world = document.getElementById('world');const x = Math.round((window.headOnScreen.x + 1) / 2 * world.width) - 40, y = Math.round((1 - window.headOnScreen.y) / 2 * world.height) - 40;const probe = document.createElement('canvas'); probe.width = 80; probe.height = 80;diff --git a/server/services/musicVideo/documentTemplates/spatial/engine.js b/server/services/musicVideo/documentTemplates/spatial/engine.jsindex bf7751a4da..3914ab2a84 100644--- a/server/services/musicVideo/documentTemplates/spatial/engine.js+++ b/server/services/musicVideo/documentTemplates/spatial/engine.js@@ -190,9 +190,9 @@ function createPost(THREE, renderer) {const num = (value, fallback, lo, hi) => Number.isFinite(value) ? Math.min(hi, Math.max(lo, value)) : fallback;// The DOF shader compares view-space depth, so a focus point is projected// into camera space: off-axis subjects and rig-parented cameras both stay sharp.- // renderer.render has not refreshed the camera matrices yet.+ // renderer.render has not refreshed the camera or a rig it was just parented to.let focus;- if (lens.focus?.isVector3) { view.updateMatrixWorld(); focus = Math.max(0.01, -lens.focus.clone().applyMatrix4(view.matrixWorldInverse).z); }+ if (lens.focus?.isVector3) { view.updateWorldMatrix(true, false); focus = Math.max(0.01, -lens.focus.clone().applyMatrix4(view.matrixWorldInverse).z); }else focus = num(lens.focus, LENS_DEFAULTS.focus, 0.01, 1e5);renderer.setRenderTarget(hdr); renderer.clear(); renderer.render(world, view);dof.uniforms.tColor.value = hdr.texture; dof.uniforms.tDepth.value = hdr.depthTexture;