Skip to content

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

keep existing worlds' darks by using only PBR Neutral's highlight shoulder, and trace the proof wait in the rich-authoring test

[._.]/ Adam Eivy4d30dc2b3466
diff --git a/server/routes/musicVideoRichAuthoring.browser.test.js b/server/routes/musicVideoRichAuthoring.browser.test.js
index 5405de19b2..f1633eb671 100644
--- a/server/routes/musicVideoRichAuthoring.browser.test.js
+++ b/server/routes/musicVideoRichAuthoring.browser.test.js
@@ -201,7 +201,7 @@ describe.skipIf(!canRun)('rich document authoring in a real browser (Chrome, ffm
await traced('accepting the candidate did not select the generated document', () => page.waitForFunction(() => document.body.textContent.includes('generated ·')));
expect((await store.getProject(p.id)).composition.document.source.kind).toBe('generated');
await page.getByRole('button', { name: 'Render animated proof' }).click();
- await page.locator('video').waitFor({ timeout: 120000 });
+ await traced('the animated proof never rendered', () => page.locator('video').waitFor({ timeout: 120000 }));
await page.locator('video').evaluate(async video => { await video.play(); await new Promise(r => setTimeout(r, 400)); video.pause(); });
expect(await page.locator('video').evaluate(v => v.videoWidth)).toBeGreaterThan(0);
expect(await page.locator('[aria-label="Saved choreography for proof comparison"]').textContent()).toContain(choreography);
diff --git a/server/services/codeAnimation/prompt.js b/server/services/codeAnimation/prompt.js
index 4bb5707ba5..98e9c78cda 100644
--- a/server/services/codeAnimation/prompt.js
+++ b/server/services/codeAnimation/prompt.js
@@ -415,7 +415,7 @@ export function buildMixedMediaDocumentPrompt({ title, song, palette, treatment,
const sections = (song.sections || []).filter((section) => !onlySectionId || section.id === onlySectionId);
return [
`MEDIA POLICY: ${mediaMode}. Code always authors composition, staging, characters, camera, text, motion and timing. Never generate guide images in code-only mode.`,
- renderer === 'three' ? `Write complete authored Three.js worlds, one function render(ctx, env) per section. ctx = { THREE, scene, camera, text, lens }; THREE is the installed locally packaged library; scene is a fresh Scene on EACH seek, camera a PerspectiveCamera, text a transparent Canvas2D overlay with local MV Mono font, lens a per-frame object you set to direct the host post stack. LENS: the host renders HDR then applies depth of field, bloom, PBR Neutral tone mapping, vignette and grain. Set ctx.lens.focus (camera distance, or a THREE.Vector3 such as the subject's head) and ctx.lens.aperture (blur pixels at 1080p; 0 is sharp, 3-6 for wide shots, 10-18 for character close-ups) and animate focus from env.t for rack focus; ctx.lens.maxBlur caps it (default 16). Only colours above ctx.lens.bloomThreshold (default 1) glow, so drive emissive screens, lamps and sparks above 1 (e.g. new THREE.Color(3, 1.6, 0.8)) and raise the threshold above a bright daytime sky so daylight does not haze; ctx.lens.bloom (default 0.3), exposure, vignette and grain are also settable. Light a character with a key that casts shadows plus a soft fill near the camera so faces stay readable in night or backlit shots, and keep additive particles small and away from the lens. Build modeled characters with articulated limbs and expressive poses, environments with depth/lighting/shadows, props, narrative action and camera choreography. Position every object analytically from env.t/localT; no simulation accumulation. Add geometry/lights to ctx.scene and set ctx.camera explicitly. Use ctx.text for designed typography. Render fills the whole frame; a particle field or text overlays alone are not a scene. Do not create a renderer, DOM elements, textures loaded from files, or another clock. env provides t, localT, frame, width, height, song, section, palette, safe, events and reactiveGain. No imports, require, fetch, Math.random, Date, performance, globalThis, window, document or external assets. The host draws aligned subtitles after your text; reserve lower title-safe space. Use reusable local functions within each section for anatomy and world construction.` : `Write original Canvas 2D section functions for a mixed-media music-video document titled ${JSON.stringify(trimTo(title, 200))}. The host owns the document, song clock, selected local media and lyric pass. Return code functions only; do not request or generate image/video assets.`,
+ renderer === 'three' ? `Write complete authored Three.js worlds, one function render(ctx, env) per section. ctx = { THREE, scene, camera, text, lens }; THREE is the installed locally packaged library; scene is a fresh Scene on EACH seek, camera a PerspectiveCamera, text a transparent Canvas2D overlay with local MV Mono font, lens a per-frame object you set to direct the host post stack. LENS: the host renders HDR then applies depth of field, bloom, a PBR Neutral highlight shoulder, vignette and grain. Set ctx.lens.focus (camera distance, or a THREE.Vector3 such as the subject's head) and ctx.lens.aperture (blur pixels at 1080p; 0 is sharp, 3-6 for wide shots, 10-18 for character close-ups) and animate focus from env.t for rack focus; ctx.lens.maxBlur caps it (default 16). Only colours above ctx.lens.bloomThreshold (default 1) glow, so drive emissive screens, lamps and sparks above 1 (e.g. new THREE.Color(3, 1.6, 0.8)) and raise the threshold above a bright daytime sky so daylight does not haze; ctx.lens.bloom (default 0.3), exposure, vignette and grain are also settable. Light a character with a key that casts shadows plus a soft fill near the camera so faces stay readable in night or backlit shots, and keep additive particles small and away from the lens. Build modeled characters with articulated limbs and expressive poses, environments with depth/lighting/shadows, props, narrative action and camera choreography. Position every object analytically from env.t/localT; no simulation accumulation. Add geometry/lights to ctx.scene and set ctx.camera explicitly. Use ctx.text for designed typography. Render fills the whole frame; a particle field or text overlays alone are not a scene. Do not create a renderer, DOM elements, textures loaded from files, or another clock. env provides t, localT, frame, width, height, song, section, palette, safe, events and reactiveGain. No imports, require, fetch, Math.random, Date, performance, globalThis, window, document or external assets. The host draws aligned subtitles after your text; reserve lower title-safe space. Use reusable local functions within each section for anatomy and world construction.` : `Write original Canvas 2D section functions for a mixed-media music-video document titled ${JSON.stringify(trimTo(title, 200))}. The host owns the document, song clock, selected local media and lyric pass. Return code functions only; do not request or generate image/video assets.`,
renderer === 'three' ? '' : CODE_VIDEO_RULES.replace('- Canvas 2D only. No external assets, fonts, or network.', '- Canvas 2D only. No network, remote URLs, filesystem paths or font loading. The host binds only the listed selected project assets; draw over footage/stills without obscuring them, and draw the entire authored world for card scenes, including characters, environments, camera staging, lighting and narrative actions. Local packaged fonts MV Mono, MV Cond and MV Stencil are available; authored titles are allowed, but do not duplicate host subtitles.'),
MUSIC_VIDEO_DIRECTION,
MUSIC_VIDEO_CHOREOGRAPHY,
diff --git a/server/services/musicVideo/documentTemplates/spatial/engine.js b/server/services/musicVideo/documentTemplates/spatial/engine.js
index 3b21114434..ad66354162 100644
--- a/server/services/musicVideo/documentTemplates/spatial/engine.js
+++ b/server/services/musicVideo/documentTemplates/spatial/engine.js
@@ -100,7 +100,7 @@ const LENS_DEFAULTS = Object.freeze({ focus: 10, aperture: 0, maxBlur: 16, bloom
// Persistent cinematic post stack: the scene renders once into an HDR target
// with depth, then a depth-aware gather DOF, a thresholded quarter-res bloom
-// and a composite that tone maps (Khronos PBR Neutral), encodes sRGB and adds
+// and a composite that compresses highlights (PBR Neutral shoulder), encodes sRGB and adds
// a vignette and frame-keyed grain. Every pass runs every frame so GPU
// resources are allocated once and seeks stay deterministic.
function createPost(THREE, renderer) {
@@ -149,8 +149,9 @@ function createPost(THREE, renderer) {
const composite = pass(/* glsl */`
varying vec2 vUv; uniform sampler2D tColor, tBloom; uniform vec2 uRes;
uniform float uBloom, uExposure, uVignette, uGrain, uFrame;
+ // Khronos PBR Neutral's highlight shoulder without its toe offset, so
+ // everything below .76 passes through and existing worlds keep their darks.
vec3 neutral(vec3 c){
- float x = min(c.r, min(c.g, c.b)), off = x < .08 ? x - 6.25 * x * x : .04; c -= off;
float p = max(c.r, max(c.g, c.b)); if (p < .76) return c;
float np = 1. - .0576 / (p - .52); c *= np / p;
return mix(c, vec3(np), 1. - 1. / (.15 * (p - np) + 1.));