The showcase prompt, round 3, Gemini 4 Carbon

agent

+44:07
reasoning

Focusing on updating the file system paths STAGE_FS and GLASS_FS. Will then remove the sceneCopyTex variable. After that, modifying camera defaults and refining exposure and true 3D glass stage-refraction settings are the next priorities.

  • edit_file{"Path":"~/run/index.html","Replacement":" const STAGE_FS = `#version 300 es\n precision highp float;\n in vec3 vWorldPos;\n uniform sampler2D uCausticTex;\n uniform sampler2D uBloomTex;\n uniform sampler2D uTargetTex;\n uniform vec3 uCamPos;\n uniform vec3 uLightWorld;\n uniform float uFocalZ;\n uniform float uCausticScale;\n uniform int uCompareMask;\n\n out vec4 fragColor;\n\n float hash21(vec2 p) {\n p = fract(p * vec2(123.34, 456.21));\n p += dot(p, p + 45.32);\n return fract(p.x * p.y);\n }\n\n float smoothGrain(vec2 p) {\n vec2 i = floor(p), f = fract(p);\n f = f * f * (3.0 - 2.0 * f);\n float a = hash21(i), b = hash21(i + vec2(1.0, 0.0));\n float c = hash21(i + vec2(0.0, 1.0)), d = hash21(i + vec2(1.0, 1.0));\n return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);\n }\n\n void main() {\n vec2 optP = vec2(vWorldPos.x, -vWorldPos.z);\n const float STAGE_EXTENT = 1.45;\n vec2 causticUV = optP / (2.0 * STAGE_EXTENT) + 0.5;\n\n // Smooth honed black basalt optical stage\n float rStage = length(vWorldPos.xz);\n float grain = (smoothGrain(vWorldPos.xz * 85.0) - 0.5) * 0.005;\n vec3 baseSlate = vec3(0.015, 0.017, 0.024) + grain;\n\n vec3 L = normalize(uLightWorld - vWorldPos);\n vec3 V = normalize(uCamPos - vWorldPos);\n vec3 H = normalize(L + V);\n float spec = pow(max(0.0, H.y), 48.0) * 0.022;\n vec2 boxD = abs(optP) - vec2(1.0);\n float frameBorder = abs(max(boxD.x, boxD.y));\n baseSlate += vec3(1.0, 0.88, 0.72) * spec * smoothstep(-0.15, 0.45, max(boxD.x, boxD.y));\n\n // Calibrated hairline 100mm optical bench reticle & millimeter ticks\n float borderLine = exp(-pow(frameBorder / 0.0042, 2.0)) * step(max(abs(optP.x), abs(optP.y)), 1.03);\n float tickMarks = 0.0;\n if (abs(frameBorder - 0.022) < 0.018 && max(abs(optP.x), abs(optP.y)) < 1.03) {\n float c = (abs(optP.x) > abs(optP.y)) ? optP.y : optP.x;\n tickMarks = exp(-pow(sin(c * 3.14159265 * 10.0) / 0.12, 2.0)) * 0.35;\n }\n vec3 reticleCol = vec3(0.34, 0.38, 0.48) * (borderLine * 0.42 + tickMarks * 0.22);\n\n // Sample live raytraced HDR Caustics + Dual-Kawase halation\n vec3 causticRaw = vec3(0.0);\n vec3 bloomRaw = vec3(0.0);\n if (causticUV.x > 0.002 && causticUV.x < 0.998 && causticUV.y > 0.002 && causticUV.y < 0.998) {\n causticRaw = texture(uCausticTex, causticUV).rgb * uCausticScale;\n bloomRaw = texture(uBloomTex, causticUV).rgb * uCausticScale;\n }\n\n // Rich contrast curve so evacuated dark regions stay deep obsidian while concentrated cusps blaze\n vec3 crispCaustic = pow(max(causticRaw, 0.0), vec3(1.16)) * 1.35;\n vec3 lightDeposit = crispCaustic + pow(max(bloomRaw, 0.0), vec3(1.15)) * 0.24;\n\n if (uCompareMask == 1 && abs(optP.x) < 1.0 && abs(optP.y) < 1.0) {\n if (optP.x < 0.0) {\n vec2 tUV = optP * 0.5 + 0.5;\n float targVal = texture(uTargetTex, tUV).r;\n float maskTrans = clamp((targVal - 0.032) / 1.15, 0.0, 1.0);\n float directSun = 0.055; // 1.0x unconcentrated incident flux (92% blocked elsewhere!)\n lightDeposit = vec3(1.0, 0.85, 0.62) * (directSun * maskTrans);\n }\n float splitLine = exp(-pow(optP.x / 0.0038, 2.0));\n reticleCol += vec3(0.95, 0.74, 0.45) * splitLine * 0.75;\n }\n\n vec3 col = baseSlate + reticleCol + lightDeposit;\n float vig = smoothstep(3.4, 1.30, rStage);\n col *= vig;\n\n col = (col * (2.51 * col + 0.03)) / (col * (2.43 * col + 0.59) + 0.14);\n col = pow(max(col, 0.0), vec3(1.0 / 2.2));\n fragColor = vec4(col, 1.0);\n }\n `;\n\n // ----------------------------------------------------------------------------\n // PASS 3B: 3D WATERTIGHT SCULPTED OPTICAL GLASS BLOCK\n // Uses Exact Analytical 3D Ray-Plane Refraction onto Stage y=0!\n // ----------------------------------------------------------------------------\n const GLASS_VS = `#version 300 es\n precision highp float;\n layout(location = 0) in vec3 aGridPos;\n layout(location = 1) in vec3 aWallNormal;\n\n uniform mat4 uVP;\n uniform float uFocalZ;\n uniform float uTGlass;\n\n ${GLSL_BSPLINE_HEIGHT}\n\n out vec3 vWorldPos;\n out vec3 vNormal;\n out vec2 vOptP;\n out float vHeight;\n out float vFaceType;\n out float vCurvature;\n\n void main() {\n vec2 p = aGridPos.xy;\n float face = aGridPos.z;\n vec3 hGrad = sampleGlassSpline(p);\n // Estimate local mean curvature for subtle caustics-in-glass sheen\n vec3 hR = sampleGlassSpline(p + vec2(0.015, 0.0));\n vec3 hU = sampleGlassSpline(p + vec2(0.0, 0.015));\n vCurvature = (hR.y - hGrad.y) + (hU.z - hGrad.z);\n\n float yWorld = 0.0;\n vec3 nWorld = vec3(0.0, 1.0, 0.0);\n\n if (face < 0.5) {\n yWorld = uFocalZ + hGrad.x;\n nWorld = normalize(vec3(hGrad.y, -1.0, -hGrad.z));\n } else if (face < 1.5) {\n yWorld = uFocalZ + uTGlass;\n nWorld = vec3(0.0, 1.0, 0.0);\n } else {\n float isTop = aWallNormal.y;\n yWorld = (isTop > 0.5) ? (uFocalZ + uTGlass) : (uFocalZ + hGrad.x);\n nWorld = normalize(vec3(aWallNormal.x, 0.0, aWallNormal.z));\n }\n\n vec3 worldPos = vec3(p.x, yWorld, -p.y);\n vWorldPos = worldPos;\n vNormal = nWorld;\n vOptP = p;\n vHeight = hGrad.x;\n vFaceType = face;\n gl_Position = uVP * vec4(worldPos, 1.0);\n }\n `;\n\n const GLASS_FS = `#version 300 es\n precision highp float;\n in vec3 vWorldPos;\n in vec3 vNormal;\n in vec2 vOptP;\n in float vHeight;\n in float vFaceType;\n in float vCurvature;\n\n uniform sampler2D uCausticTex;\n uniform sampler2D uBloomTex;\n uniform float uCausticScale;\n uniform vec3 uCamPos;\n uniform vec3 uLightWorld;\n uniform float uBaseIOR;\n uniform vec3 uGlassTint;\n uniform int uShowInterf;\n\n out vec4 fragColor;\n\n vec3 sampleStageAtWorldXZ(vec2 xz) {\n vec2 optP = vec2(xz.x, -xz.y);\n const float STAGE_EXTENT = 1.45;\n vec2 cUV = optP / (2.0 * STAGE_EXTENT) + 0.5;\n vec3 base = vec3(0.018, 0.022, 0.032);\n vec2 boxD = abs(optP) - vec2(1.0);\n float borderLine = exp(-pow(abs(max(boxD.x, boxD.y)) / 0.005, 2.0)) * step(max(abs(optP.x), abs(optP.y)), 1.03);\n base += vec3(0.32, 0.36, 0.46) * borderLine * 0.4;\n if (cUV.x > 0.002 && cUV.x < 0.998 && cUV.y > 0.002 && cUV.y < 0.998) {\n vec3 cRaw = texture(uCausticTex, cUV).rgb * uCausticScale;\n vec3 bRaw = texture(uBloomTex, cUV).rgb * uCausticScale;\n base += pow(max(cRaw, 0.0), vec3(1.16)) * 1.35 + pow(max(bRaw, 0.0), vec3(1.15)) * 0.24;\n }\n base *= smoothstep(3.4, 1.3, length(xz));\n return base;\n }\n\n void main() {\n vec3 N = normalize(gl_FrontFacing ? vNormal : -vNormal);\n vec3 V = normalize(uCamPos - vWorldPos);\n vec3 I = -V;\n\n // Exact 3D chromatic view-ray refraction onto the y = 0 stage below (or dark studio horizon)\n vec3 rayR = refract(I, N, 1.0 / (uBaseIOR - 0.018));\n vec3 rayG = refract(I, N, 1.0 / uBaseIOR);\n vec3 rayB = refract(I, N, 1.0 / (uBaseIOR + 0.018));\n\n vec3 refrLinear = vec3(0.022, 0.028, 0.042);\n if (rayG.y < -0.04) {\n vec2 xzR = vWorldPos.xz + rayR.xz * (-vWorldPos.y / min(-0.04, rayR.y));\n vec2 xzG = vWorldPos.xz + rayG.xz * (-vWorldPos.y / rayG.y);\n vec2 xzB = vWorldPos.xz + rayB.xz * (-vWorldPos.y / min(-0.04, rayB.y));\n refrLinear = vec3(\n sampleStageAtWorldXZ(xzR).r,\n sampleStageAtWorldXZ(xzG).g,\n sampleStageAtWorldXZ(xzB).b\n );\n } else {\n // Grazing internal reflection of studio softbox & warm lamp glow\n float horizon = smoothstep(-0.1, 0.5, rayG.y);\n refrLinear = mix(vec3(0.04, 0.07, 0.10), vec3(0.14, 0.20, 0.28), horizon);\n }\n\n // Beer-Lambert optical crystal tint + subtle polished aqua-emerald ground bevel glow\n float cosTheta = max(0.02, dot(N, V));\n float pathLen = (vFaceType > 1.5) ? 0.65 : (0.16 / max(0.22, cosTheta));\n vec3 absorb = pow(uGlassTint, vec3(pathLen * 2.2));\n refrLinear *= absorb;\n\n // Subtle internal light-scatter glow where the overhead lamp illuminates sculpted glass curvature\n vec3 L = normalize(uLightWorld - vWorldPos);\n float transGlow = pow(max(0.0, dot(-L, V)), 5.0) * 0.08 + abs(vCurvature) * 0.012;\n refrLinear += vec3(0.85, 0.94, 1.0) * uGlassTint * transGlow;\n\n if (vFaceType > 1.5) {\n // Frosted/polished optical slab perimeter edge catchlight\n float sideLight = 0.45 + 0.55 * abs(dot(N, normalize(vec3(1.0, 0.4, 0.8))));\n refrLinear += vec3(0.07, 0.15, 0.18) * uGlassTint * sideLight;\n }\n\n // Schlick Fresnel reflection from overhead point lamp & dual studio softboxes\n float r0 = pow((uBaseIOR - 1.0) / (uBaseIOR + 1.0), 2.0);\n float fresnel = r0 + (1.0 - r0) * pow(1.0 - cosTheta, 5.0);\n\n vec3 H = normalize(L + V);\n float specLamp = pow(max(0.0, dot(N, H)), 220.0) * 2.4 + pow(max(0.0, dot(N, H)), 26.0) * 0.18;\n vec3 R_refl = reflect(I, N);\n float box1 = smoothstep(0.25, 0.85, R_refl.y) * smoothstep(-0.6, 0.4, R_refl.x);\n float box2 = smoothstep(0.10, 0.70, R_refl.y) * smoothstep(0.6, -0.3, R_refl.z) * 0.6;\n vec3 envLinear = vec3(0.20, 0.26, 0.35) * (box1 + box2) + vec3(1.0, 0.88, 0.68) * specLamp;\n\n // Crisp diamond-chamfer bevel highlight around [-1, 1]^2 glass edge\n vec2 edgeD = abs(vOptP);\n float bevel = smoothstep(0.980, 0.998, max(edgeD.x, edgeD.y));\n\n vec3 col = mix(refrLinear, envLinear, clamp(fresnel * 1.35 + 0.05, 0.05, 0.92));\n col += vec3(0.22, 0.34, 0.40) * bevel * 0.55;\n\n // Optional Mach-Zehnder Laser Interferogram (micron thickness fringes cos(phase))\n if (uShowInterf == 1 && vFaceType < 1.5) {\n float phase = vHeight * 280.0;\n float fringe = pow(0.5 + 0.5 * cos(phase), 2.6);\n vec3 interfCol = mix(vec3(0.01, 0.08, 0.12), vec3(0.32, 0.95, 0.86), fringe);\n col = mix(col, col * 0.35 + interfCol * 0.55, 0.68);\n }\n\n // Match stage ACES filmic tone-mapping + gamma\n col = (col * (2.51 * col + 0.03)) / (col * (2.43 * col + 0.59) + 0.14);\n col = pow(max(col, 0.0), vec3(1.0 / 2.2));\n fragColor = vec4(col, 1.0);\n }\n `;","Target":" const STAGE_FS = `#version 300 es\n precision highp float;\n in vec3 vWorldPos;\n uniform sampler2D uCausticTex;\n uniform sampler2D uBloomTex;\n uniform sampler2D uTargetTex;\n uniform vec3 uCamPos;\n uniform vec3 uLightWorld;\n uniform float uFocalZ;\n uniform float uCausticScale;\n uniform int uCompareMask;\n\n out vec4 fragColor;\n\n // Subtle procedural slate micro-grain\n float hash21(vec2 p) {\n p = fract(p * vec2(123.34, 456.21));\n p += dot(p, p + 45.32);\n return fract(p.x * p.y);\n }\n\n void main() {\n // Optical stage coords: px = x, ps = -z\n vec2 optP = vec2(vWorldPos.x, -vWorldPos.z);\n const float STAGE_EXTENT = 1.45;\n vec2 causticUV = optP / (2.0 * STAGE_EXTENT) + 0.5;\n\n // Base dark anodized obsidian tabletop\n float rStage = length(vWorldPos.xz);\n float grain = (hash21(floor(vWorldPos.xz * 260.0)) - 0.5) * 0.012;\n vec3 baseSlate = vec3(0.026, 0.028, 0.036) + grain;\n\n // Subtle soft specular sheen from point lamp on matte stone\n vec3 L = normalize(uLightWorld - vWorldPos);\n vec3 V = normalize(uCamPos - vWorldPos);\n vec3 H = normalize(L + V);\n float spec = pow(max(0.0, H.y), 42.0) * 0.035;\n // Soft shadow cast by glass mount frame outside [-1,1]^2 vs subtle ambient occlusion\n vec2 boxD = abs(optP) - vec2(1.0);\n float frameBorder = abs(max(boxD.x, boxD.y));\n baseSlate += vec3(1.0, 0.88, 0.72) * spec * smoothstep(0.0, 0.4, max(boxD.x, boxD.y) + 0.2);\n\n // Calibrated hairline optical bench reticle & 100mm aperture frame ticks\n float borderLine = exp(-pow(frameBorder / 0.0045, 2.0)) * step(max(abs(optP.x), abs(optP.y)), 1.03);\n float tickMarks = 0.0;\n if (abs(frameBorder - 0.022) < 0.018 && max(abs(optP.x), abs(optP.y)) < 1.03) {\n float c = (abs(optP.x) > abs(optP.y)) ? optP.y : optP.x;\n tickMarks = exp(-pow(sin(c * 3.14159265 * 10.0) / 0.12, 2.0)) * 0.35;\n }\n vec3 reticleCol = vec3(0.32, 0.35, 0.44) * (borderLine * 0.42 + tickMarks * 0.22);\n\n // Sample live raytraced HDR Caustics + physically soft Dual-Kawase halation\n vec3 causticRaw = vec3(0.0);\n vec3 bloomRaw = vec3(0.0);\n if (causticUV.x > 0.002 && causticUV.x < 0.998 && causticUV.y > 0.002 && causticUV.y < 0.998) {\n causticRaw = texture(uCausticTex, causticUV).rgb * uCausticScale;\n bloomRaw = texture(uBloomTex, causticUV).rgb * uCausticScale;\n }\n\n vec3 lightDeposit = causticRaw + bloomRaw * 0.36;\n\n // Optional \"Mask vs. Lens\" split comparison (left half: absorptive stencil mask; right half: refractive lens!)\n if (uCompareMask == 1 && abs(optP.x) < 1.0 && abs(optP.y) < 1.0) {\n if (optP.x < 0.0) {\n vec2 tUV = optP * 0.5 + 0.5;\n float targVal = texture(uTargetTex, tUV).r;\n // Absorptive mask simply blocks light where targVal < max, peaking at ONLY 1.0x uniform lamp irradiance!\n // Notice how dim 1.0x un-concentrated sunlight is compared to 20x-30x optimal-transport photon focusing!\n float maskTrans = clamp((targVal - 0.032) / 1.15, 0.0, 1.0);\n float directSun = 0.14; // exact same 1.0x mean incident photon budget!\n lightDeposit = vec3(1.0, 0.88, 0.68) * (directSun * maskTrans);\n }\n // Hairline split divider at x = 0\n float splitLine = exp(-pow(optP.x / 0.004, 2.0));\n reticleCol += vec3(0.95, 0.74, 0.45) * splitLine * 0.65;\n }\n\n vec3 col = baseSlate + reticleCol + lightDeposit;\n\n // Smooth radial fade into dark studio floor\n float vig = smoothstep(3.3, 1.35, rStage);\n col *= vig;\n\n // Filmic ACES-inspired highlight roll-off so 30x caustic cusps glow incandescent white-gold!\n col = (col * (2.51 * col + 0.03)) / (col * (2.43 * col + 0.59) + 0.14);\n col = pow(max(col, 0.0), vec3(1.0 / 2.2));\n fragColor = vec4(col, 1.0);\n }\n `;\n\n // ----------------------------------------------------------------------------\n // PASS 3B: 3D WATERTIGHT SCULPTED OPTICAL GLASS BLOCK (Refraction + Interferogram)\n // ----------------------------------------------------------------------------\n const GLASS_VS = `#version 300 es\n precision highp float;\n layout(location = 0) in vec3 aGridPos; // (px, ps, faceType: 0=bottom sculpted, 1=top flat, 2..5=side walls)\n layout(location = 1) in vec3 aWallNormal;\n\n uniform mat4 uVP;\n uniform float uFocalZ;\n uniform float uTGlass;\n\n ${GLSL_BSPLINE_HEIGHT}\n\n out vec3 vWorldPos;\n out vec3 vNormal;\n out vec2 vOptP;\n out float vHeight;\n out float vFaceType;\n\n void main() {\n vec2 p = aGridPos.xy;\n float face = aGridPos.z;\n vec3 hGrad = sampleGlassSpline(p);\n float yWorld = 0.0;\n vec3 nWorld = vec3(0.0, 1.0, 0.0);\n\n if (face < 0.5) {\n // Bottom sculpted optical face: y = uFocalZ + h(px, ps)\n // Optical normal into air is (hx, hy, -1) -> World (X=px, Y=z, Z=-ps) normal is (hx, -1.0, -hy)!\n yWorld = uFocalZ + hGrad.x;\n nWorld = normalize(vec3(hGrad.y, -1.0, -hGrad.z));\n } else if (face < 1.5) {\n // Top flat entrance face\n yWorld = uFocalZ + uTGlass;\n nWorld = vec3(0.0, 1.0, 0.0);\n } else {\n // Polished perimeter bevel walls: aWallNormal.y stores top(1) vs bottom(0) selector\n float isTop = aWallNormal.y;\n yWorld = (isTop > 0.5) ? (uFocalZ + uTGlass) : (uFocalZ + hGrad.x);\n nWorld = normalize(vec3(aWallNormal.x, 0.0, aWallNormal.z));\n }\n\n vec3 worldPos = vec3(p.x, yWorld, -p.y);\n vWorldPos = worldPos;\n vNormal = nWorld;\n vOptP = p;\n vHeight = hGrad.x;\n vFaceType = face;\n gl_Position = uVP * vec4(worldPos, 1.0);\n }\n `;\n\n const GLASS_FS = `#version 300 es\n precision highp float;\n in vec3 vWorldPos;\n in vec3 vNormal;\n in vec2 vOptP;\n in float vHeight;\n in float vFaceType;\n\n uniform sampler2D uSceneCopyTex;\n uniform vec2 uViewport;\n uniform vec3 uCamPos;\n uniform vec3 uLightWorld;\n uniform float uBaseIOR;\n uniform vec3 uGlassTint;\n uniform int uShowInterf;\n\n out vec4 fragColor;\n\n void main() {\n vec3 N = normalize(gl_FrontFacing ? vNormal : -vNormal);\n vec3 V = normalize(uCamPos - vWorldPos);\n vec3 I = -V;\n\n // True screen-space optical refraction with subtle R/G/B chromatic offset\n vec2 screenUV = gl_FragCoord.xy / uViewport;\n vec3 R_refr = refract(I, N, 1.0 / uBaseIOR);\n vec2 refrOffset = R_refr.xz * 0.048 * (vFaceType > 1.5 ? 1.65 : 1.0);\n\n vec3 bgR = texture(uSceneCopyTex, clamp(screenUV + refrOffset * 0.94, 0.002, 0.998)).rgb;\n vec3 bgG = texture(uSceneCopyTex, clamp(screenUV + refrOffset * 1.00, 0.002, 0.998)).rgb;\n vec3 bgB = texture(uSceneCopyTex, clamp(screenUV + refrOffset * 1.06, 0.002, 0.998)).rgb;\n vec3 refrCol = vec3(bgR.r, bgG.g, bgB.b);\n\n // Beer-Lambert optical crystal edge tint (polished green-aqua crown glass edges!)\n float cosTheta = max(0.02, dot(N, V));\n float pathLen = (vFaceType > 1.5) ? 0.55 : (0.14 / max(0.25, cosTheta));\n vec3 absorb = pow(uGlassTint, vec3(pathLen * 2.4));\n refrCol *= absorb;\n if (vFaceType > 1.5) {\n // Polished ground-glass edge catchlight\n refrCol += vec3(0.06, 0.11, 0.13) * uGlassTint;\n }\n\n // Schlick Fresnel reflection from overhead lamp & cool studio softboxes\n float r0 = pow((uBaseIOR - 1.0) / (uBaseIOR + 1.0), 2.0);\n float fresnel = r0 + (1.0 - r0) * pow(1.0 - cosTheta, 5.0);\n\n vec3 L = normalize(uLightWorld - vWorldPos);\n vec3 H = normalize(L + V);\n float specLamp = pow(max(0.0, dot(N, H)), 180.0) * 1.6 + pow(max(0.0, dot(N, H)), 24.0) * 0.14;\n vec3 R_refl = reflect(I, N);\n // Subtle studio softbox sky reflection strip\n float studioStrip = smoothstep(0.35, 0.85, R_refl.y) * (0.55 + 0.45 * smoothstep(-0.3, 0.5, R_refl.x));\n vec3 envRefl = vec3(0.30, 0.36, 0.46) * studioStrip + vec3(1.0, 0.90, 0.72) * specLamp;\n\n // Subtle bevel edge highlight on glass perimeter\n vec2 edgeD = abs(vOptP);\n float rim = smoothstep(0.982, 1.0, max(edgeD.x, edgeD.y));\n vec3 col = mix(refrCol, envRefl, clamp(fresnel * 1.25, 0.04, 0.92)) + vec3(0.14, 0.20, 0.24) * rim * 0.45;\n\n // Optional Mach-Zehnder Laser Interferogram (reveals micron height contours cos(4*pi*h/lambda)!)\n if (uShowInterf == 1 && vFaceType < 1.5) {\n float phase = vHeight * 260.0;\n float fringe = 0.5 + 0.5 * cos(phase);\n fringe = pow(fringe, 3.0);\n vec3 interfCol = mix(vec3(0.02, 0.14, 0.18), vec3(0.45, 0.96, 0.88), fringe);\n col = mix(col, col * 0.45 + interfCol * 0.68, 0.62);\n }\n\n fragColor = vec4(col, 1.0);\n }\n `;"}

    input

    {
      "Path": "~/run/index.html",
      "Replacement": "  const STAGE_FS = `#version 300 es\n    precision highp float;\n    in vec3 vWorldPos;\n    uniform sampler2D uCausticTex;\n    uniform sampler2D uBloomTex;\n    uniform sampler2D uTargetTex;\n    uniform vec3 uCamPos;\n    uniform vec3 uLightWorld;\n    uniform float uFocalZ;\n    uniform float uCausticScale;\n    uniform int uCompareMask;\n\n    out vec4 fragColor;\n\n    float hash21(vec2 p) {\n      p = fract(p * vec2(123.34, 456.21));\n      p += dot(p, p + 45.32);\n      return fract(p.x * p.y);\n    }\n\n    float smoothGrain(vec2 p) {\n      vec2 i = floor(p), f = fract(p);\n      f = f * f * (3.0 - 2.0 * f);\n      float a = hash21(i), b = hash21(i + vec2(1.0, 0.0));\n      float c = hash21(i + vec2(0.0, 1.0)), d = hash21(i + vec2(1.0, 1.0));\n      return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);\n    }\n\n    void main() {\n      vec2 optP = vec2(vWorldPos.x, -vWorldPos.z);\n      const float STAGE_EXTENT = 1.45;\n      vec2 causticUV = optP / (2.0 * STAGE_EXTENT) + 0.5;\n\n      // Smooth honed black basalt optical stage\n      float rStage = length(vWorldPos.xz);\n      float grain = (smoothGrain(vWorldPos.xz * 85.0) - 0.5) * 0.005;\n      vec3 baseSlate = vec3(0.015, 0.017, 0.024) + grain;\n\n      vec3 L = normalize(uLightWorld - vWorldPos);\n      vec3 V = normalize(uCamPos - vWorldPos);\n      vec3 H = normalize(L + V);\n      float spec = pow(max(0.0, H.y), 48.0) * 0.022;\n      vec2 boxD = abs(optP) - vec2(1.0);\n      float frameBorder = abs(max(boxD.x, boxD.y));\n      baseSlate += vec3(1.0, 0.88, 0.72) * spec * smoothstep(-0.15, 0.45, max(boxD.x, boxD.y));\n\n      // Calibrated hairline 100mm optical bench reticle & millimeter ticks\n      float borderLine = exp(-pow(frameBorder / 0.0042, 2.0)) * step(max(abs(optP.x), abs(optP.y)), 1.03);\n      float tickMarks = 0.0;\n      if (abs(frameBorder - 0.022) < 0.018 && max(abs(optP.x), abs(optP.y)) < 1.03) {\n        float c = (abs(optP.x) > abs(optP.y)) ? optP.y : optP.x;\n        tickMarks = exp(-pow(sin(c * 3.14159265 * 10.0) / 0.12, 2.0)) * 0.35;\n      }\n      vec3 reticleCol = vec3(0.34, 0.38, 0.48) * (borderLine * 0.42 + tickMarks * 0.22);\n\n      // Sample live raytraced HDR Caustics + Dual-Kawase halation\n      vec3 causticRaw = vec3(0.0);\n      vec3 bloomRaw = vec3(0.0);\n      if (causticUV.x > 0.002 && causticUV.x < 0.998 && causticUV.y > 0.002 && causticUV.y < 0.998) {\n        causticRaw = texture(uCausticTex, causticUV).rgb * uCausticScale;\n        bloomRaw = texture(uBloomTex, causticUV).rgb * uCausticScale;\n      }\n\n      // Rich contrast curve so evacuated dark regions stay deep obsidian while concentrated cusps blaze\n      vec3 crispCaustic = pow(max(causticRaw, 0.0), vec3(1.16)) * 1.35;\n      vec3 lightDeposit = crispCaustic + pow(max(bloomRaw, 0.0), vec3(1.15)) * 0.24;\n\n      if (uCompareMask == 1 && abs(optP.x) < 1.0 && abs(optP.y) < 1.0) {\n        if (optP.x < 0.0) {\n          vec2 tUV = optP * 0.5 + 0.5;\n          float targVal = texture(uTargetTex, tUV).r;\n          float maskTrans = clamp((targVal - 0.032) / 1.15, 0.0, 1.0);\n          float directSun = 0.055; // 1.0x unconcentrated incident flux (92% blocked elsewhere!)\n          lightDeposit = vec3(1.0, 0.85, 0.62) * (directSun * maskTrans);\n        }\n        float splitLine = exp(-pow(optP.x / 0.0038, 2.0));\n        reticleCol += vec3(0.95, 0.74, 0.45) * splitLine * 0.75;\n      }\n\n      vec3 col = baseSlate + reticleCol + lightDeposit;\n      float vig = smoothstep(3.4, 1.30, rStage);\n      col *= vig;\n\n      col = (col * (2.51 * col + 0.03)) / (col * (2.43 * col + 0.59) + 0.14);\n      col = pow(max(col, 0.0), vec3(1.0 / 2.2));\n      fragColor = vec4(col, 1.0);\n    }\n  `;\n\n  // ----------------------------------------------------------------------------\n  // PASS 3B: 3D WATERTIGHT SCULPTED OPTICAL GLASS BLOCK\n  //          Uses Exact Analytical 3D Ray-Plane Refraction onto Stage y=0!\n  // ----------------------------------------------------------------------------\n  const GLASS_VS = `#version 300 es\n    precision highp float;\n    layout(location = 0) in vec3 aGridPos;\n    layout(location = 1) in vec3 aWallNormal;\n\n    uniform mat4 uVP;\n    uniform float uFocalZ;\n    uniform float uTGlass;\n\n    ${GLSL_BSPLINE_HEIGHT}\n\n    out vec3 vWorldPos;\n    out vec3 vNormal;\n    out vec2 vOptP;\n    out float vHeight;\n    out float vFaceType;\n    out float vCurvature;\n\n    void main() {\n      vec2 p = aGridPos.xy;\n      float face = aGridPos.z;\n      vec3 hGrad = sampleGlassSpline(p);\n      // Estimate local mean curvature for subtle caustics-in-glass sheen\n      vec3 hR = sampleGlassSpline(p + vec2(0.015, 0.0));\n      vec3 hU = sampleGlassSpline(p + vec2(0.0, 0.015));\n      vCurvature = (hR.y - hGrad.y) + (hU.z - hGrad.z);\n\n      float yWorld = 0.0;\n      vec3 nWorld = vec3(0.0, 1.0, 0.0);\n\n      if (face < 0.5) {\n        yWorld = uFocalZ + hGrad.x;\n        nWorld = normalize(vec3(hGrad.y, -1.0, -hGrad.z));\n      } else if (face < 1.5) {\n        yWorld = uFocalZ + uTGlass;\n        nWorld = vec3(0.0, 1.0, 0.0);\n      } else {\n        float isTop = aWallNormal.y;\n        yWorld = (isTop > 0.5) ? (uFocalZ + uTGlass) : (uFocalZ + hGrad.x);\n        nWorld = normalize(vec3(aWallNormal.x, 0.0, aWallNormal.z));\n      }\n\n      vec3 worldPos = vec3(p.x, yWorld, -p.y);\n      vWorldPos = worldPos;\n      vNormal = nWorld;\n      vOptP = p;\n      vHeight = hGrad.x;\n      vFaceType = face;\n      gl_Position = uVP * vec4(worldPos, 1.0);\n    }\n  `;\n\n  const GLASS_FS = `#version 300 es\n    precision highp float;\n    in vec3 vWorldPos;\n    in vec3 vNormal;\n    in vec2 vOptP;\n    in float vHeight;\n    in float vFaceType;\n    in float vCurvature;\n\n    uniform sampler2D uCausticTex;\n    uniform sampler2D uBloomTex;\n    uniform float uCausticScale;\n    uniform vec3 uCamPos;\n    uniform vec3 uLightWorld;\n    uniform float uBaseIOR;\n    uniform vec3 uGlassTint;\n    uniform int uShowInterf;\n\n    out vec4 fragColor;\n\n    vec3 sampleStageAtWorldXZ(vec2 xz) {\n      vec2 optP = vec2(xz.x, -xz.y);\n      const float STAGE_EXTENT = 1.45;\n      vec2 cUV = optP / (2.0 * STAGE_EXTENT) + 0.5;\n      vec3 base = vec3(0.018, 0.022, 0.032);\n      vec2 boxD = abs(optP) - vec2(1.0);\n      float borderLine = exp(-pow(abs(max(boxD.x, boxD.y)) / 0.005, 2.0)) * step(max(abs(optP.x), abs(optP.y)), 1.03);\n      base += vec3(0.32, 0.36, 0.46) * borderLine * 0.4;\n      if (cUV.x > 0.002 && cUV.x < 0.998 && cUV.y > 0.002 && cUV.y < 0.998) {\n        vec3 cRaw = texture(uCausticTex, cUV).rgb * uCausticScale;\n        vec3 bRaw = texture(uBloomTex, cUV).rgb * uCausticScale;\n        base += pow(max(cRaw, 0.0), vec3(1.16)) * 1.35 + pow(max(bRaw, 0.0), vec3(1.15)) * 0.24;\n      }\n      base *= smoothstep(3.4, 1.3, length(xz));\n      return base;\n    }\n\n    void main() {\n      vec3 N = normalize(gl_FrontFacing ? vNormal : -vNormal);\n      vec3 V = normalize(uCamPos - vWorldPos);\n      vec3 I = -V;\n\n      // Exact 3D chromatic view-ray refraction onto the y = 0 stage below (or dark studio horizon)\n      vec3 rayR = refract(I, N, 1.0 / (uBaseIOR - 0.018));\n      vec3 rayG = refract(I, N, 1.0 / uBaseIOR);\n      vec3 rayB = refract(I, N, 1.0 / (uBaseIOR + 0.018));\n\n      vec3 refrLinear = vec3(0.022, 0.028, 0.042);\n      if (rayG.y < -0.04) {\n        vec2 xzR = vWorldPos.xz + rayR.xz * (-vWorldPos.y / min(-0.04, rayR.y));\n        vec2 xzG = vWorldPos.xz + rayG.xz * (-vWorldPos.y / rayG.y);\n        vec2 xzB = vWorldPos.xz + rayB.xz * (-vWorldPos.y / min(-0.04, rayB.y));\n        refrLinear = vec3(\n          sampleStageAtWorldXZ(xzR).r,\n          sampleStageAtWorldXZ(xzG).g,\n          sampleStageAtWorldXZ(xzB).b\n        );\n      } else {\n        // Grazing internal reflection of studio softbox & warm lamp glow\n        float horizon = smoothstep(-0.1, 0.5, rayG.y);\n        refrLinear = mix(vec3(0.04, 0.07, 0.10), vec3(0.14, 0.20, 0.28), horizon);\n      }\n\n      // Beer-Lambert optical crystal tint + subtle polished aqua-emerald ground bevel glow\n      float cosTheta = max(0.02, dot(N, V));\n      float pathLen = (vFaceType > 1.5) ? 0.65 : (0.16 / max(0.22, cosTheta));\n      vec3 absorb = pow(uGlassTint, vec3(pathLen * 2.2));\n      refrLinear *= absorb;\n\n      // Subtle internal light-scatter glow where the overhead lamp illuminates sculpted glass curvature\n      vec3 L = normalize(uLightWorld - vWorldPos);\n      float transGlow = pow(max(0.0, dot(-L, V)), 5.0) * 0.08 + abs(vCurvature) * 0.012;\n      refrLinear += vec3(0.85, 0.94, 1.0) * uGlassTint * transGlow;\n\n      if (vFaceType > 1.5) {\n        // Frosted/polished optical slab perimeter edge catchlight\n        float sideLight = 0.45 + 0.55 * abs(dot(N, normalize(vec3(1.0, 0.4, 0.8))));\n        refrLinear += vec3(0.07, 0.15, 0.18) * uGlassTint * sideLight;\n      }\n\n      // Schlick Fresnel reflection from overhead point lamp & dual studio softboxes\n      float r0 = pow((uBaseIOR - 1.0) / (uBaseIOR + 1.0), 2.0);\n      float fresnel = r0 + (1.0 - r0) * pow(1.0 - cosTheta, 5.0);\n\n      vec3 H = normalize(L + V);\n      float specLamp = pow(max(0.0, dot(N, H)), 220.0) * 2.4 + pow(max(0.0, dot(N, H)), 26.0) * 0.18;\n      vec3 R_refl = reflect(I, N);\n      float box1 = smoothstep(0.25, 0.85, R_refl.y) * smoothstep(-0.6, 0.4, R_refl.x);\n      float box2 = smoothstep(0.10, 0.70, R_refl.y) * smoothstep(0.6, -0.3, R_refl.z) * 0.6;\n      vec3 envLinear = vec3(0.20, 0.26, 0.35) * (box1 + box2) + vec3(1.0, 0.88, 0.68) * specLamp;\n\n      // Crisp diamond-chamfer bevel highlight around [-1, 1]^2 glass edge\n      vec2 edgeD = abs(vOptP);\n      float bevel = smoothstep(0.980, 0.998, max(edgeD.x, edgeD.y));\n\n      vec3 col = mix(refrLinear, envLinear, clamp(fresnel * 1.35 + 0.05, 0.05, 0.92));\n      col += vec3(0.22, 0.34, 0.40) * bevel * 0.55;\n\n      // Optional Mach-Zehnder Laser Interferogram (micron thickness fringes cos(phase))\n      if (uShowInterf == 1 && vFaceType < 1.5) {\n        float phase = vHeight * 280.0;\n        float fringe = pow(0.5 + 0.5 * cos(phase), 2.6);\n        vec3 interfCol = mix(vec3(0.01, 0.08, 0.12), vec3(0.32, 0.95, 0.86), fringe);\n        col = mix(col, col * 0.35 + interfCol * 0.55, 0.68);\n      }\n\n      // Match stage ACES filmic tone-mapping + gamma\n      col = (col * (2.51 * col + 0.03)) / (col * (2.43 * col + 0.59) + 0.14);\n      col = pow(max(col, 0.0), vec3(1.0 / 2.2));\n      fragColor = vec4(col, 1.0);\n    }\n  `;",
      "Target": "  const STAGE_FS = `#version 300 es\n    precision highp float;\n    in vec3 vWorldPos;\n    uniform sampler2D uCausticTex;\n    uniform sampler2D uBloomTex;\n    uniform sampler2D uTargetTex;\n    uniform vec3 uCamPos;\n    uniform vec3 uLightWorld;\n    uniform float uFocalZ;\n    uniform float uCausticScale;\n    uniform int uCompareMask;\n\n    out vec4 fragColor;\n\n    // Subtle procedural slate micro-grain\n    float hash21(vec2 p) {\n      p = fract(p * vec2(123.34, 456.21));\n      p += dot(p, p + 45.32);\n      return fract(p.x * p.y);\n    }\n\n    void main() {\n      // Optical stage coords: px = x, ps = -z\n      vec2 optP = vec2(vWorldPos.x, -vWorldPos.z);\n      const float STAGE_EXTENT = 1.45;\n      vec2 causticUV = optP / (2.0 * STAGE_EXTENT) + 0.5;\n\n      // Base dark anodized obsidian tabletop\n      float rStage = length(vWorldPos.xz);\n      float grain = (hash21(floor(vWorldPos.xz * 260.0)) - 0.5) * 0.012;\n      vec3 baseSlate = vec3(0.026, 0.028, 0.036) + grain;\n\n      // Subtle soft specular sheen from point lamp on matte stone\n      vec3 L = normalize(uLightWorld - vWorldPos);\n      vec3 V = normalize(uCamPos - vWorldPos);\n      vec3 H = normalize(L + V);\n      float spec = pow(max(0.0, H.y), 42.0) * 0.035;\n      // Soft shadow cast by glass mount frame outside [-1,1]^2 vs subtle ambient occlusion\n      vec2 boxD = abs(optP) - vec2(1.0);\n      float frameBorder = abs(max(boxD.x, boxD.y));\n      baseSlate += vec3(1.0, 0.88, 0.72) * spec * smoothstep(0.0, 0.4, max(boxD.x, boxD.y) + 0.2);\n\n      // Calibrated hairline optical bench reticle & 100mm aperture frame ticks\n      float borderLine = exp(-pow(frameBorder / 0.0045, 2.0)) * step(max(abs(optP.x), abs(optP.y)), 1.03);\n      float tickMarks = 0.0;\n      if (abs(frameBorder - 0.022) < 0.018 && max(abs(optP.x), abs(optP.y)) < 1.03) {\n        float c = (abs(optP.x) > abs(optP.y)) ? optP.y : optP.x;\n        tickMarks = exp(-pow(sin(c * 3.14159265 * 10.0) / 0.12, 2.0)) * 0.35;\n      }\n      vec3 reticleCol = vec3(0.32, 0.35, 0.44) * (borderLine * 0.42 + tickMarks * 0.22);\n\n      // Sample live raytraced HDR Caustics + physically soft Dual-Kawase halation\n      vec3 causticRaw = vec3(0.0);\n      vec3 bloomRaw = vec3(0.0);\n      if (causticUV.x > 0.002 && causticUV.x < 0.998 && causticUV.y > 0.002 && causticUV.y < 0.998) {\n        causticRaw = texture(uCausticTex, causticUV).rgb * uCausticScale;\n        bloomRaw = texture(uBloomTex, causticUV).rgb * uCausticScale;\n      }\n\n      vec3 lightDeposit = causticRaw + bloomRaw * 0.36;\n\n      // Optional \"Mask vs. Lens\" split comparison (left half: absorptive stencil mask; right half: refractive lens!)\n      if (uCompareMask == 1 && abs(optP.x) < 1.0 && abs(optP.y) < 1.0) {\n        if (optP.x < 0.0) {\n          vec2 tUV = optP * 0.5 + 0.5;\n          float targVal = texture(uTargetTex, tUV).r;\n          // Absorptive mask simply blocks light where targVal < max, peaking at ONLY 1.0x uniform lamp irradiance!\n          // Notice how dim 1.0x un-concentrated sunlight is compared to 20x-30x optimal-transport photon focusing!\n          float maskTrans = clamp((targVal - 0.032) / 1.15, 0.0, 1.0);\n          float directSun = 0.14; // exact same 1.0x mean incident photon budget!\n          lightDeposit = vec3(1.0, 0.88, 0.68) * (directSun * maskTrans);\n        }\n        // Hairline split divider at x = 0\n        float splitLine = exp(-pow(optP.x / 0.004, 2.0));\n        reticleCol += vec3(0.95, 0.74, 0.45) * splitLine * 0.65;\n      }\n\n      vec3 col = baseSlate + reticleCol + lightDeposit;\n\n      // Smooth radial fade into dark studio floor\n      float vig = smoothstep(3.3, 1.35, rStage);\n      col *= vig;\n\n      // Filmic ACES-inspired highlight roll-off so 30x caustic cusps glow incandescent white-gold!\n      col = (col * (2.51 * col + 0.03)) / (col * (2.43 * col + 0.59) + 0.14);\n      col = pow(max(col, 0.0), vec3(1.0 / 2.2));\n      fragColor = vec4(col, 1.0);\n    }\n  `;\n\n  // ----------------------------------------------------------------------------\n  // PASS 3B: 3D WATERTIGHT SCULPTED OPTICAL GLASS BLOCK (Refraction + Interferogram)\n  // ----------------------------------------------------------------------------\n  const GLASS_VS = `#version 300 es\n    precision highp float;\n    layout(location = 0) in vec3 aGridPos; // (px, ps, faceType: 0=bottom sculpted, 1=top flat, 2..5=side walls)\n    layout(location = 1) in vec3 aWallNormal;\n\n    uniform mat4 uVP;\n    uniform float uFocalZ;\n    uniform float uTGlass;\n\n    ${GLSL_BSPLINE_HEIGHT}\n\n    out vec3 vWorldPos;\n    out vec3 vNormal;\n    out vec2 vOptP;\n    out float vHeight;\n    out float vFaceType;\n\n    void main() {\n      vec2 p = aGridPos.xy;\n      float face = aGridPos.z;\n      vec3 hGrad = sampleGlassSpline(p);\n      float yWorld = 0.0;\n      vec3 nWorld = vec3(0.0, 1.0, 0.0);\n\n      if (face < 0.5) {\n        // Bottom sculpted optical face: y = uFocalZ + h(px, ps)\n        // Optical normal into air is (hx, hy, -1) -> World (X=px, Y=z, Z=-ps) normal is (hx, -1.0, -hy)!\n        yWorld = uFocalZ + hGrad.x;\n        nWorld = normalize(vec3(hGrad.y, -1.0, -hGrad.z));\n      } else if (face < 1.5) {\n        // Top flat entrance face\n        yWorld = uFocalZ + uTGlass;\n        nWorld = vec3(0.0, 1.0, 0.0);\n      } else {\n        // Polished perimeter bevel walls: aWallNormal.y stores top(1) vs bottom(0) selector\n        float isTop = aWallNormal.y;\n        yWorld = (isTop > 0.5) ? (uFocalZ + uTGlass) : (uFocalZ + hGrad.x);\n        nWorld = normalize(vec3(aWallNormal.x, 0.0, aWallNormal.z));\n      }\n\n      vec3 worldPos = vec3(p.x, yWorld, -p.y);\n      vWorldPos = worldPos;\n      vNormal = nWorld;\n      vOptP = p;\n      vHeight = hGrad.x;\n      vFaceType = face;\n      gl_Position = uVP * vec4(worldPos, 1.0);\n    }\n  `;\n\n  const GLASS_FS = `#version 300 es\n    precision highp float;\n    in vec3 vWorldPos;\n    in vec3 vNormal;\n    in vec2 vOptP;\n    in float vHeight;\n    in float vFaceType;\n\n    uniform sampler2D uSceneCopyTex;\n    uniform vec2 uViewport;\n    uniform vec3 uCamPos;\n    uniform vec3 uLightWorld;\n    uniform float uBaseIOR;\n    uniform vec3 uGlassTint;\n    uniform int uShowInterf;\n\n    out vec4 fragColor;\n\n    void main() {\n      vec3 N = normalize(gl_FrontFacing ? vNormal : -vNormal);\n      vec3 V = normalize(uCamPos - vWorldPos);\n      vec3 I = -V;\n\n      // True screen-space optical refraction with subtle R/G/B chromatic offset\n      vec2 screenUV = gl_FragCoord.xy / uViewport;\n      vec3 R_refr = refract(I, N, 1.0 / uBaseIOR);\n      vec2 refrOffset = R_refr.xz * 0.048 * (vFaceType > 1.5 ? 1.65 : 1.0);\n\n      vec3 bgR = texture(uSceneCopyTex, clamp(screenUV + refrOffset * 0.94, 0.002, 0.998)).rgb;\n      vec3 bgG = texture(uSceneCopyTex, clamp(screenUV + refrOffset * 1.00, 0.002, 0.998)).rgb;\n      vec3 bgB = texture(uSceneCopyTex, clamp(screenUV + refrOffset * 1.06, 0.002, 0.998)).rgb;\n      vec3 refrCol = vec3(bgR.r, bgG.g, bgB.b);\n\n      // Beer-Lambert optical crystal edge tint (polished green-aqua crown glass edges!)\n      float cosTheta = max(0.02, dot(N, V));\n      float pathLen = (vFaceType > 1.5) ? 0.55 : (0.14 / max(0.25, cosTheta));\n      vec3 absorb = pow(uGlassTint, vec3(pathLen * 2.4));\n      refrCol *= absorb;\n      if (vFaceType > 1.5) {\n        // Polished ground-glass edge catchlight\n        refrCol += vec3(0.06, 0.11, 0.13) * uGlassTint;\n      }\n\n      // Schlick Fresnel reflection from overhead lamp & cool studio softboxes\n      float r0 = pow((uBaseIOR - 1.0) / (uBaseIOR + 1.0), 2.0);\n      float fresnel = r0 + (1.0 - r0) * pow(1.0 - cosTheta, 5.0);\n\n      vec3 L = normalize(uLightWorld - vWorldPos);\n      vec3 H = normalize(L + V);\n      float specLamp = pow(max(0.0, dot(N, H)), 180.0) * 1.6 + pow(max(0.0, dot(N, H)), 24.0) * 0.14;\n      vec3 R_refl = reflect(I, N);\n      // Subtle studio softbox sky reflection strip\n      float studioStrip = smoothstep(0.35, 0.85, R_refl.y) * (0.55 + 0.45 * smoothstep(-0.3, 0.5, R_refl.x));\n      vec3 envRefl = vec3(0.30, 0.36, 0.46) * studioStrip + vec3(1.0, 0.90, 0.72) * specLamp;\n\n      // Subtle bevel edge highlight on glass perimeter\n      vec2 edgeD = abs(vOptP);\n      float rim = smoothstep(0.982, 1.0, max(edgeD.x, edgeD.y));\n      vec3 col = mix(refrCol, envRefl, clamp(fresnel * 1.25, 0.04, 0.92)) + vec3(0.14, 0.20, 0.24) * rim * 0.45;\n\n      // Optional Mach-Zehnder Laser Interferogram (reveals micron height contours cos(4*pi*h/lambda)!)\n      if (uShowInterf == 1 && vFaceType < 1.5) {\n        float phase = vHeight * 260.0;\n        float fringe = 0.5 + 0.5 * cos(phase);\n        fringe = pow(fringe, 3.0);\n        vec3 interfCol = mix(vec3(0.02, 0.14, 0.18), vec3(0.45, 0.96, 0.88), fringe);\n        col = mix(col, col * 0.45 + interfCol * 0.68, 0.62);\n      }\n\n      fragColor = vec4(col, 1.0);\n    }\n  `;"
    }

    result, 1 line

    Made 1 replacement in ~/run/index.html starting at line 1641 (+131/-89 lines).

agent

+45:29
reasoning

Camera framing is updated to the specified values. The camera preset is updated. Millimeter display for focal length is set to 86mm. Unnecessary texture operations are removed. Textures for the glass shader are bound. Framebuffer scale is tuned.

  • edit_file{"Path":"~/run/index.html","Replacement":" const fboCaustic = createFBO(CAUSTIC_RES, CAUSTIC_RES, useFloatCausticFBO);\n const fboBloomA = createFBO(512, 512, useFloatCausticFBO);\n const fboBloomB = createFBO(256, 256, useFloatCausticFBO);","Target":" const fboCaustic = createFBO(CAUSTIC_RES, CAUSTIC_RES, useFloatCausticFBO);\n const fboBloomA = createFBO(512, 512, useFloatCausticFBO);\n const fboBloomB = createFBO(256, 256, useFloatCausticFBO);\n\n // Scene copy texture for true 3D glass refraction\n const sceneCopyTex = gl.createTexture();\n let sceneCopyW = 0, sceneCopyH = 0;\n function ensureSceneCopyTex(w, h) {\n if (sceneCopyW === w && sceneCopyH === h) return;\n sceneCopyW = w; sceneCopyH = h;\n gl.bindTexture(gl.TEXTURE_2D, sceneCopyTex);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, w, h, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }"}

    input

    {
      "Path": "~/run/index.html",
      "Replacement": "  const fboCaustic = createFBO(CAUSTIC_RES, CAUSTIC_RES, useFloatCausticFBO);\n  const fboBloomA  = createFBO(512, 512, useFloatCausticFBO);\n  const fboBloomB  = createFBO(256, 256, useFloatCausticFBO);",
      "Target": "  const fboCaustic = createFBO(CAUSTIC_RES, CAUSTIC_RES, useFloatCausticFBO);\n  const fboBloomA  = createFBO(512, 512, useFloatCausticFBO);\n  const fboBloomB  = createFBO(256, 256, useFloatCausticFBO);\n\n  // Scene copy texture for true 3D glass refraction\n  const sceneCopyTex = gl.createTexture();\n  let sceneCopyW = 0, sceneCopyH = 0;\n  function ensureSceneCopyTex(w, h) {\n    if (sceneCopyW === w && sceneCopyH === h) return;\n    sceneCopyW = w; sceneCopyH = h;\n    gl.bindTexture(gl.TEXTURE_2D, sceneCopyTex);\n    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, w, h, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n  }"
    }

    result, 1 line

    Made 1 replacement in ~/run/index.html starting at line 2006 (+0/-14 lines).
  • read_file{"EndLine":3165,"Path":"~/run/index.html","StartLine":2840}

    input

    {
      "EndLine": 3165,
      "Path": "~/run/index.html",
      "StartLine": 2840
    }

    result, 327 lines

    Showing lines 2840-3165 of 3165
    2840:   // 12. MAIN 60FPS ANIMATION & MULTI-PASS RENDER LOOP
    2841:   // ============================================================================
    2842:   let lastTime = performance.now();
    2843:   let startTime = lastTime;
    2844:   let slowFrameStreak = 0;
    2845: 
    2846:   function resizeCanvas() {
    2847:     const dpr = Math.min(window.devicePixelRatio || 1, 2.0);
    2848:     const w = Math.max(2, Math.floor(window.innerWidth * dpr));
    2849:     const h = Math.max(2, Math.floor(window.innerHeight * dpr));
    2850:     if (canvas.width !== w || canvas.height !== h) {
    2851:       canvas.width = w;
    2852:       canvas.height = h;
    2853:     }
    2854:     ensureSceneCopyTex(w, h);
    2855:   }
    2856: 
    2857:   // Cache uniform locations once for zero GC pressure
    2858:   const uCaustic = {
    2859:     lightOpt: gl.getUniformLocation(progCaustic, "uLightOpt"),
    2860:     focalZ: gl.getUniformLocation(progCaustic, "uFocalZ"),
    2861:     tGlass: gl.getUniformLocation(progCaustic, "uTGlass"),
    2862:     baseIOR: gl.getUniformLocation(progCaustic, "uBaseIOR"),
    2863:     disp: gl.getUniformLocation(progCaustic, "uDispersion"),
    2864:     expScale: gl.getUniformLocation(progCaustic, "uExposureScale"),
    2865:     numBands: gl.getUniformLocation(progCaustic, "uNumBands"),
    2866:     heightTex: gl.getUniformLocation(progCaustic, "uHeightTex")
    2867:   };
    2868:   const uBloom = {
    2869:     tex: gl.getUniformLocation(progBloom, "uTex"),
    2870:     texel: gl.getUniformLocation(progBloom, "uTexel"),
    2871:     radius: gl.getUniformLocation(progBloom, "uRadius")
    2872:   };
    2873:   const uStage = {
    2874:     vp: gl.getUniformLocation(progStage, "uVP"),
    2875:     causticTex: gl.getUniformLocation(progStage, "uCausticTex"),
    2876:     bloomTex: gl.getUniformLocation(progStage, "uBloomTex"),
    2877:     targetTex: gl.getUniformLocation(progStage, "uTargetTex"),
    2878:     camPos: gl.getUniformLocation(progStage, "uCamPos"),
    2879:     lightWorld: gl.getUniformLocation(progStage, "uLightWorld"),
    2880:     focalZ: gl.getUniformLocation(progStage, "uFocalZ"),
    2881:     causticScale: gl.getUniformLocation(progStage, "uCausticScale"),
    2882:     compareMask: gl.getUniformLocation(progStage, "uCompareMask")
    2883:   };
    2884:   const uGlass = {
    2885:     vp: gl.getUniformLocation(progGlass, "uVP"),
    2886:     focalZ: gl.getUniformLocation(progGlass, "uFocalZ"),
    2887:     tGlass: gl.getUniformLocation(progGlass, "uTGlass"),
    2888:     heightTex: gl.getUniformLocation(progGlass, "uHeightTex"),
    2889:     sceneCopy: gl.getUniformLocation(progGlass, "uSceneCopyTex"),
    2890:     viewport: gl.getUniformLocation(progGlass, "uViewport"),
    2891:     camPos: gl.getUniformLocation(progGlass, "uCamPos"),
    2892:     lightWorld: gl.getUniformLocation(progGlass, "uLightWorld"),
    2893:     baseIOR: gl.getUniformLocation(progGlass, "uBaseIOR"),
    2894:     glassTint: gl.getUniformLocation(progGlass, "uGlassTint"),
    2895:     showInterf: gl.getUniformLocation(progGlass, "uShowInterf")
    2896:   };
    2897:   const uLine = { vp: gl.getUniformLocation(progLine, "uVP") };
    2898:   const uLamp = {
    2899:     vp: gl.getUniformLocation(progLamp, "uVP"),
    2900:     pos: gl.getUniformLocation(progLamp, "uLampPos"),
    2901:     right: gl.getUniformLocation(progLamp, "uCamRight"),
    2902:     up: gl.getUniformLocation(progLamp, "uCamUp"),
    2903:     size: gl.getUniformLocation(progLamp, "uSize"),
    2904:     lock: gl.getUniformLocation(progLamp, "uFocusLock")
    2905:   };
    2906: 
    2907:   function frame(now) {
    2908:     const dt = Math.min(0.05, (now - lastTime) * 0.001);
    2909:     const rawFrameMs = now - lastTime;
    2910:     lastTime = now;
    2911:     const elapsed = (now - startTime) * 0.001;
    2912: 
    2913:     // Adaptive spectral band governor for software GL / low-power mobile
    2914:     if (elapsed > 1.5 && rawFrameMs > 28 && state.numSpectralBands === 5) {
    2915:       slowFrameStreak++;
    2916:       if (slowFrameStreak > 12) state.numSpectralBands = 3;
    2917:     } else {
    2918:       slowFrameStreak = 0;
    2919:     }
    2920:     statRays.textContent = state.numSpectralBands === 5 ? "512K BEAMS · 5λ" : "307K BEAMS · 3λ";
    2921: 
    2922:     resizeCanvas();
    2923: 
    2924:     // 1) Autonomous Opening Choreography (sweeps chaotic caustics -> razor focus -> gentle tour)
    2925:     if (state.autoChoreo) {
    2926:       // Cycle every 8.5s: 0..1.6s dramatic sweep into focus, 1.6..6.8s gentle living focus shimmer, 6.8..8.5s morph to next!
    2927:       const period = 8.5;
    2928:       const cyc = elapsed % period;
    2929:       const tourIdx = Math.floor(elapsed / period) % presetOrder.length;
    2930:       const desiredPreset = presetOrder[tourIdx];
    2931:       if (desiredPreset !== state.preset && elapsed > 2.0) {
    2932:         selectPreset(desiredPreset, true);
    2933:       }
    2934: 
    2935:       if (cyc < 1.55) {
    2936:         const u = 1.0 - cyc / 1.55;
    2937:         const ease = u * u * (3 - 2 * u);
    2938:         const ang = elapsed * 0.9;
    2939:         state.lampTargetX = Math.cos(ang) * 1.45 * ease;
    2940:         state.lampTargetS = Math.sin(ang) * 1.05 * ease;
    2941:       } else if (cyc < 7.2) {
    2942:         // Subtle living sunlight micro-shimmer around focal lock!
    2943:         state.lampTargetX = Math.cos(elapsed * 1.35) * 0.055;
    2944:         state.lampTargetS = Math.sin(elapsed * 1.05) * 0.055;
    2945:       } else {
    2946:         const u = (cyc - 7.2) / (period - 7.2);
    2947:         const ease = u * u;
    2948:         state.lampTargetX = Math.cos(elapsed * 1.1) * 1.15 * ease;
    2949:         state.lampTargetS = Math.sin(elapsed * 1.1) * 0.85 * ease;
    2950:       }
    2951:       // Gentle studio camera breathing
    2952:       state.camTargetYaw = 0.34 + Math.sin(elapsed * 0.28) * 0.14;
    2953:       if (state.showRays) {
    2954:         state.raySliceS = Math.sin(elapsed * 0.55) * 0.52;
    2955:       }
    2956:     }
    2957: 
    2958:     // 2) Smooth Spring Interpolation of Lamp, Camera & 3D Glass Surface Heightfield
    2959:     const prevLampX = state.lampX, prevLampS = state.lampS;
    2960:     const kLamp = 1.0 - Math.exp(-11.0 * dt);
    2961:     state.lampX += (state.lampTargetX - state.lampX) * kLamp;
    2962:     state.lampS += (state.lampTargetS - state.lampS) * kLamp;
    2963:     const lampSpeed = Math.hypot(state.lampX - prevLampX, state.lampS - prevLampS) / Math.max(1e-4, dt);
    2964: 
    2965:     const kCam = 1.0 - Math.exp(-8.5 * dt);
    2966:     state.camYaw += (state.camTargetYaw - state.camYaw) * kCam;
    2967:     state.camPitch += (state.camTargetPitch - state.camPitch) * kCam;
    2968:     state.camDist += (state.camTargetDist - state.camDist) * kCam;
    2969:     state.camCenterY += (state.camTargetCenterY - state.camCenterY) * kCam;
    2970: 
    2971:     // Smoothly morph physical 3D glass surface hCurrent -> hSolved
    2972:     const kGlass = 1.0 - Math.exp(-7.5 * dt);
    2973:     let maxDiffH = 0;
    2974:     for (let i = 0; i < N_GRID * N_GRID; i++) {
    2975:       const diff = state.hSolved[i] - state.hCurrent[i];
    2976:       if (Math.abs(diff) > maxDiffH) maxDiffH = Math.abs(diff);
    2977:       state.hCurrent[i] += diff * kGlass;
    2978:     }
    2979:     if (maxDiffH > 1e-6) {
    2980:       gl.bindTexture(gl.TEXTURE_2D, heightTex);
    2981:       gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, N_GRID, N_GRID, gl.RED, gl.FLOAT, state.hCurrent);
    2982:     }
    2983: 
    2984:     const focalZ = DESIGN_F * state.focalRatio;
    2985:     const mat = MATERIALS[state.selectedGlass];
    2986: 
    2987:     // Optical alignment score (0..1) for HUD telemetry & crystalline harmonic synth
    2988:     const offAxis = Math.hypot(state.lampX, state.lampS) / 2.2;
    2989:     const offFocal = Math.abs(state.focalRatio - (MATERIALS[state.carvedForGlass].nD - 1) / (mat.nD - 1));
    2990:     const alignment = Math.max(0, Math.min(1, Math.exp(-2.8 * offAxis * offAxis - 5.0 * offFocal * offFocal)));
    2991:     statFocus.textContent = `ALIGN ${Math.round(alignment * 100)}%`;
    2992:     synth.update(alignment, lampSpeed);
    2993: 
    2994:     // --------------------------------------------------------------------------
    2995:     // PASS 1: RENDER CONTINUOUS GPU SPECTRAL CAUSTICS INTO CAUSTIC FBO
    2996:     // --------------------------------------------------------------------------
    2997:     gl.bindFramebuffer(gl.FRAMEBUFFER, fboCaustic.fbo);
    2998:     gl.viewport(0, 0, fboCaustic.w, fboCaustic.h);
    2999:     gl.disable(gl.DEPTH_TEST);
    3000:     gl.disable(gl.CULL_FACE);
    3001:     gl.clearColor(0, 0, 0, 0);
    3002:     gl.clear(gl.COLOR_BUFFER_BIT);
    3003: 
    3004:     gl.enable(gl.BLEND);
    3005:     gl.blendFunc(gl.ONE, gl.ONE);
    3006: 
    3007:     gl.useProgram(progCaustic);
    3008:     gl.activeTexture(gl.TEXTURE0);
    3009:     gl.bindTexture(gl.TEXTURE_2D, heightTex);
    3010:     gl.uniform1i(uCaustic.heightTex, 0);
    3011:     gl.uniform3f(uCaustic.lightOpt, state.lampX, state.lampS, state.lampZ);
    3012:     gl.uniform1f(uCaustic.focalZ, focalZ);
    3013:     gl.uniform1f(uCaustic.tGlass, T_GLASS);
    3014:     gl.uniform1f(uCaustic.baseIOR, mat.nD);
    3015:     gl.uniform1f(uCaustic.disp, mat.disp);
    3016:     // Scale exposure slightly down when using 8-bit fallback FBO so highlights never clip before tone-mapping
    3017:     const fboScale = useFloatCausticFBO ? 0.145 : 0.022;
    3018:     const stageRecoverScale = useFloatCausticFBO ? 1.0 : (0.145 / 0.022);
    3019:     gl.uniform1f(uCaustic.expScale, fboScale);
    3020:     gl.uniform1i(uCaustic.numBands, state.numSpectralBands);
    3021: 
    3022:     gl.bindVertexArray(beamVAO);
    3023:     gl.drawElementsInstanced(gl.TRIANGLES, beamIndices.length, gl.UNSIGNED_INT, 0, state.numSpectralBands);
    3024: 
    3025:     // --------------------------------------------------------------------------
    3026:     // PASS 2: DUAL-KAWASE PHYSICALLY SOFT HDR CAUSTIC HALATION / BLOOM
    3027:     // --------------------------------------------------------------------------
    3028:     gl.disable(gl.BLEND);
    3029:     gl.useProgram(progBloom);
    3030:     gl.bindVertexArray(emptyVAO);
    3031: 
    3032:     gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomA.fbo);
    3033:     gl.viewport(0, 0, fboBloomA.w, fboBloomA.h);
    3034:     gl.activeTexture(gl.TEXTURE0);
    3035:     gl.bindTexture(gl.TEXTURE_2D, fboCaustic.tex);
    3036:     gl.uniform1i(uBloom.tex, 0);
    3037:     gl.uniform2f(uBloom.texel, 1 / fboCaustic.w, 1 / fboCaustic.h);
    3038:     gl.uniform1f(uBloom.radius, 1.5);
    3039:     gl.drawArrays(gl.TRIANGLES, 0, 3);
    3040: 
    3041:     gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomB.fbo);
    3042:     gl.viewport(0, 0, fboBloomB.w, fboBloomB.h);
    3043:     gl.bindTexture(gl.TEXTURE_2D, fboBloomA.tex);
    3044:     gl.uniform2f(uBloom.texel, 1 / fboBloomA.w, 1 / fboBloomA.h);
    3045:     gl.uniform1f(uBloom.radius, 2.2);
    3046:     gl.drawArrays(gl.TRIANGLES, 0, 3);
    3047: 
    3048:     gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomA.fbo);
    3049:     gl.viewport(0, 0, fboBloomA.w, fboBloomA.h);
    3050:     gl.bindTexture(gl.TEXTURE_2D, fboBloomB.tex);
    3051:     gl.uniform2f(uBloom.texel, 1 / fboBloomB.w, 1 / fboBloomB.h);
    3052:     gl.uniform1f(uBloom.radius, 1.8);
    3053:     gl.drawArrays(gl.TRIANGLES, 0, 3);
    3054: 
    3055:     // --------------------------------------------------------------------------
    3056:     // PASS 3: UNIFIED 3D ATELIER OPTICAL BENCH SCENE
    3057:     // --------------------------------------------------------------------------
    3058:     gl.bindFramebuffer(gl.FRAMEBUFFER, null);
    3059:     const W = canvas.width, H = canvas.height;
    3060:     gl.viewport(0, 0, W, H);
    3061:     gl.clearColor(0.027, 0.031, 0.045, 1.0);
    3062:     gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
    3063:     gl.enable(gl.DEPTH_TEST);
    3064:     gl.depthMask(true);
    3065: 
    3066:     const cosP = Math.cos(state.camPitch), sinP = Math.sin(state.camPitch);
    3067:     const cosY = Math.cos(state.camYaw),   sinY = Math.sin(state.camYaw);
    3068:     const camPos = [
    3069:       state.camDist * cosP * sinY,
    3070:       state.camCenterY + state.camDist * sinP,
    3071:       state.camDist * cosP * cosY
    3072:     ];
    3073:     const center = [0, state.camCenterY * 0.52, 0];
    3074:     const proj = mat4Perspective(39 * Math.PI / 180, W / H, 0.15, 40.0);
    3075:     const view = mat4LookAt(camPos, center, [0, 1, 0]);
    3076:     currentVP = mat4Mul(proj, view);
    3077:     const lightWorld = [state.lampX, state.lampZ, -state.lampS];
    3078: 
    3079:     // 3A: Obsidian Receiver Stage + Live Caustics
    3080:     gl.useProgram(progStage);
    3081:     gl.uniformMatrix4fv(uStage.vp, false, currentVP);
    3082:     gl.uniform3fv(uStage.camPos, camPos);
    3083:     gl.uniform3fv(uStage.lightWorld, lightWorld);
    3084:     gl.uniform1f(uStage.focalZ, focalZ);
    3085:     gl.uniform1f(uStage.causticScale, stageRecoverScale);
    3086:     gl.uniform1i(uStage.compareMask, state.compareMask ? 1 : 0);
    3087: 
    3088:     gl.activeTexture(gl.TEXTURE0);
    3089:     gl.bindTexture(gl.TEXTURE_2D, fboCaustic.tex);
    3090:     gl.uniform1i(uStage.causticTex, 0);
    3091:     gl.activeTexture(gl.TEXTURE1);
    3092:     gl.bindTexture(gl.TEXTURE_2D, fboBloomA.tex);
    3093:     gl.uniform1i(uStage.bloomTex, 1);
    3094:     gl.activeTexture(gl.TEXTURE2);
    3095:     gl.bindTexture(gl.TEXTURE_2D, targetTex);
    3096:     gl.uniform1i(uStage.targetTex, 2);
    3097: 
    3098:     gl.bindVertexArray(stageVAO);
    3099:     gl.drawArrays(gl.TRIANGLES, 0, 6);
    3100: 
    3101:     // Copy rendered stage into sceneCopyTex so the 3D crystal block refracts the live caustic tabletop!
    3102:     gl.bindTexture(gl.TEXTURE_2D, sceneCopyTex);
    3103:     gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, W, H);
    3104: 
    3105:     // 3B: Render 3D Sculpted Optical Crystal Block (Back faces then Front faces for true depth!)
    3106:     gl.useProgram(progGlass);
    3107:     gl.uniformMatrix4fv(uGlass.vp, false, currentVP);
    3108:     gl.uniform1f(uGlass.focalZ, focalZ);
    3109:     gl.uniform1f(uGlass.tGlass, T_GLASS);
    3110:     gl.uniform2f(uGlass.viewport, W, H);
    3111:     gl.uniform3fv(uGlass.camPos, camPos);
    3112:     gl.uniform3fv(uGlass.lightWorld, lightWorld);
    3113:     gl.uniform1f(uGlass.baseIOR, mat.nD);
    3114:     gl.uniform3fv(uGlass.glassTint, mat.tint);
    3115:     gl.uniform1i(uGlass.showInterf, state.showInterf ? 1 : 0);
    3116: 
    3117:     gl.activeTexture(gl.TEXTURE0);
    3118:     gl.bindTexture(gl.TEXTURE_2D, heightTex);
    3119:     gl.uniform1i(uGlass.heightTex, 0);
    3120:     gl.activeTexture(gl.TEXTURE1);
    3121:     gl.bindTexture(gl.TEXTURE_2D, sceneCopyTex);
    3122:     gl.uniform1i(uGlass.sceneCopy, 1);
    3123: 
    3124:     gl.bindVertexArray(glassVAO);
    3125:     gl.enable(gl.CULL_FACE);
    3126:     gl.cullFace(gl.FRONT);
    3127:     gl.drawElements(gl.TRIANGLES, glassIndexCount, gl.UNSIGNED_INT, 0);
    3128:     gl.cullFace(gl.BACK);
    3129:     gl.drawElements(gl.TRIANGLES, glassIndexCount, gl.UNSIGNED_INT, 0);
    3130:     gl.disable(gl.CULL_FACE);
    3131: 
    3132:     // 3C: Additive 3D Diagnostic Lines (Ray Sheet, Optimal Transport Grid, Bench Guides) + Point Lamp
    3133:     const lineVertCount = buildDiagnosticLines(focalZ, mat.nD);
    3134:     gl.enable(gl.BLEND);
    3135:     gl.blendFunc(gl.ONE, gl.ONE);
    3136:     gl.depthMask(false);
    3137: 
    3138:     if (lineVertCount > 0) {
    3139:       gl.useProgram(progLine);
    3140:       gl.uniformMatrix4fv(uLine.vp, false, currentVP);
    3141:       gl.bindVertexArray(lineVAO);
    3142:       gl.drawArrays(gl.LINES, 0, lineVertCount);
    3143:     }
    3144: 
    3145:     // 3D Point Lamp Filament Halo
    3146:     gl.useProgram(progLamp);
    3147:     gl.uniformMatrix4fv(uLamp.vp, false, currentVP);
    3148:     gl.uniform3fv(uLamp.pos, lightWorld);
    3149:     gl.uniform3f(uLamp.right, view[0], view[4], view[8]);
    3150:     gl.uniform3f(uLamp.up, view[1], view[5], view[9]);
    3151:     gl.uniform1f(uLamp.size, 0.34);
    3152:     gl.uniform1f(uLamp.lock, alignment);
    3153:     gl.bindVertexArray(emptyVAO);
    3154:     gl.drawArrays(gl.TRIANGLES, 0, 6);
    3155: 
    3156:     gl.depthMask(true);
    3157:     gl.disable(gl.BLEND);
    3158:     requestAnimationFrame(frame);
    3159:   }
    3160: 
    3161:   requestAnimationFrame(frame);
    3162: })();
    3163: </script>
    3164: </body>
    3165: </html>
  • edit_file{"Path":"~/run/index.html","Replacement":" // Camera spherical orbit around bench center (frames lamp + crystal slab + laser rays + caustic stage!)\n camYaw: 0.36,\n camPitch: 0.42,\n camDist: 7.55,\n camTargetYaw: 0.36,\n camTargetPitch: 0.42,\n camTargetDist: 7.55,\n camCenterY: 1.72,\n camTargetCenterY: 1.72,","Target":" // Camera spherical orbit around bench center (0, 1.05, 0)\n camYaw: 0.34,\n camPitch: 0.56,\n camDist: 6.35,\n camTargetYaw: 0.34,\n camTargetPitch: 0.56,\n camTargetDist: 6.35,\n camCenterY: 1.02,\n camTargetCenterY: 1.02,"}

    input

    {
      "Path": "~/run/index.html",
      "Replacement": "    // Camera spherical orbit around bench center (frames lamp + crystal slab + laser rays + caustic stage!)\n    camYaw: 0.36,\n    camPitch: 0.42,\n    camDist: 7.55,\n    camTargetYaw: 0.36,\n    camTargetPitch: 0.42,\n    camTargetDist: 7.55,\n    camCenterY: 1.72,\n    camTargetCenterY: 1.72,",
      "Target": "    // Camera spherical orbit around bench center (0, 1.05, 0)\n    camYaw: 0.34,\n    camPitch: 0.56,\n    camDist: 6.35,\n    camTargetYaw: 0.34,\n    camTargetPitch: 0.56,\n    camTargetDist: 6.35,\n    camCenterY: 1.02,\n    camTargetCenterY: 1.02,"
    }

    result, 1 line

    Made 1 replacement in ~/run/index.html starting at line 2155 (+9/-9 lines).
  • edit_file{"Path":"~/run/index.html","Replacement":" function setCameraPreset(mode) {\n camBtns.forEach((b) => b.classList.toggle(\"active\", b.dataset.cam === mode));\n if (mode === \"studio\") {\n state.camTargetYaw = 0.36; state.camTargetPitch = 0.42; state.camTargetDist = 7.55; state.camTargetCenterY = 1.72;\n } else if (mode === \"profile\") {\n state.camTargetYaw = 0.16; state.camTargetPitch = 0.10; state.camTargetDist = 4.55; state.camTargetCenterY = 1.65;\n } else if (mode === \"top\") {\n state.camTargetYaw = 0.0; state.camTargetPitch = 1.51; state.camTargetDist = 5.15; state.camTargetCenterY = 0.10;\n }\n }\n camBtns.forEach((btn) => btn.addEventListener(\"click\", () => {\n markUserInteracted();\n setCameraPreset(btn.dataset.cam);\n }));\n\n // Focal Height Slider\n const focalSlider = document.getElementById(\"focalSlider\");\n const focalVal = document.getElementById(\"focalVal\");\n focalSlider.addEventListener(\"input\", () => {\n markUserInteracted();\n let v = parseFloat(focalSlider.value);\n if (Math.abs(v - 1.0) < 0.022) { v = 1.0; focalSlider.value = \"1.00\"; } // subtle magnetic detent at exact focus!\n state.focalRatio = v;\n focalVal.textContent = `${Math.round(v * 86)} mm`;\n });","Target":" function setCameraPreset(mode) {\n camBtns.forEach((b) => b.classList.toggle(\"active\", b.dataset.cam === mode));\n if (mode === \"studio\") {\n state.camTargetYaw = 0.34; state.camTargetPitch = 0.56; state.camTargetDist = 6.35; state.camTargetCenterY = 1.02;\n } else if (mode === \"profile\") {\n state.camTargetYaw = 0.14; state.camTargetPitch = 0.13; state.camTargetDist = 5.20; state.camTargetCenterY = 1.65;\n } else if (mode === \"top\") {\n state.camTargetYaw = 0.0; state.camTargetPitch = 1.50; state.camTargetDist = 5.45; state.camTargetCenterY = 0.25;\n }\n }\n camBtns.forEach((btn) => btn.addEventListener(\"click\", () => {\n markUserInteracted();\n setCameraPreset(btn.dataset.cam);\n }));\n\n // Focal Height Slider\n const focalSlider = document.getElementById(\"focalSlider\");\n const focalVal = document.getElementById(\"focalVal\");\n focalSlider.addEventListener(\"input\", () => {\n markUserInteracted();\n let v = parseFloat(focalSlider.value);\n if (Math.abs(v - 1.0) < 0.022) { v = 1.0; focalSlider.value = \"1.00\"; } // subtle magnetic detent at exact focus!\n state.focalRatio = v;\n focalVal.textContent = `${Math.round(v * 110)} mm`;\n });"}

    input

    {
      "Path": "~/run/index.html",
      "Replacement": "  function setCameraPreset(mode) {\n    camBtns.forEach((b) => b.classList.toggle(\"active\", b.dataset.cam === mode));\n    if (mode === \"studio\") {\n      state.camTargetYaw = 0.36; state.camTargetPitch = 0.42; state.camTargetDist = 7.55; state.camTargetCenterY = 1.72;\n    } else if (mode === \"profile\") {\n      state.camTargetYaw = 0.16; state.camTargetPitch = 0.10; state.camTargetDist = 4.55; state.camTargetCenterY = 1.65;\n    } else if (mode === \"top\") {\n      state.camTargetYaw = 0.0;  state.camTargetPitch = 1.51; state.camTargetDist = 5.15; state.camTargetCenterY = 0.10;\n    }\n  }\n  camBtns.forEach((btn) => btn.addEventListener(\"click\", () => {\n    markUserInteracted();\n    setCameraPreset(btn.dataset.cam);\n  }));\n\n  // Focal Height Slider\n  const focalSlider = document.getElementById(\"focalSlider\");\n  const focalVal = document.getElementById(\"focalVal\");\n  focalSlider.addEventListener(\"input\", () => {\n    markUserInteracted();\n    let v = parseFloat(focalSlider.value);\n    if (Math.abs(v - 1.0) < 0.022) { v = 1.0; focalSlider.value = \"1.00\"; } // subtle magnetic detent at exact focus!\n    state.focalRatio = v;\n    focalVal.textContent = `${Math.round(v * 86)} mm`;\n  });",
      "Target": "  function setCameraPreset(mode) {\n    camBtns.forEach((b) => b.classList.toggle(\"active\", b.dataset.cam === mode));\n    if (mode === \"studio\") {\n      state.camTargetYaw = 0.34; state.camTargetPitch = 0.56; state.camTargetDist = 6.35; state.camTargetCenterY = 1.02;\n    } else if (mode === \"profile\") {\n      state.camTargetYaw = 0.14; state.camTargetPitch = 0.13; state.camTargetDist = 5.20; state.camTargetCenterY = 1.65;\n    } else if (mode === \"top\") {\n      state.camTargetYaw = 0.0;  state.camTargetPitch = 1.50; state.camTargetDist = 5.45; state.camTargetCenterY = 0.25;\n    }\n  }\n  camBtns.forEach((btn) => btn.addEventListener(\"click\", () => {\n    markUserInteracted();\n    setCameraPreset(btn.dataset.cam);\n  }));\n\n  // Focal Height Slider\n  const focalSlider = document.getElementById(\"focalSlider\");\n  const focalVal = document.getElementById(\"focalVal\");\n  focalSlider.addEventListener(\"input\", () => {\n    markUserInteracted();\n    let v = parseFloat(focalSlider.value);\n    if (Math.abs(v - 1.0) < 0.022) { v = 1.0; focalSlider.value = \"1.00\"; } // subtle magnetic detent at exact focus!\n    state.focalRatio = v;\n    focalVal.textContent = `${Math.round(v * 110)} mm`;\n  });"
    }

    result, 1 line

    Made 1 replacement in ~/run/index.html starting at line 2479 (+4/-4 lines).
  • edit_file{"Path":"~/run/index.html","Replacement":" focalSlider.value = \"1.00\";\n focalVal.textContent = \"86 mm\";\n });","Target":" focalSlider.value = \"1.00\";\n focalVal.textContent = \"110 mm\";\n });"}

    input

    {
      "Path": "~/run/index.html",
      "Replacement": "    focalSlider.value = \"1.00\";\n    focalVal.textContent = \"86 mm\";\n  });",
      "Target": "    focalSlider.value = \"1.00\";\n    focalVal.textContent = \"110 mm\";\n  });"
    }

    result, 1 line

    Made 1 replacement in ~/run/index.html starting at line 2549 (+1/-1 lines).
  • edit_file{"Path":"~/run/index.html","Replacement":" function resizeCanvas() {\n const dpr = Math.min(window.devicePixelRatio || 1, 2.0);\n const w = Math.max(2, Math.floor(window.innerWidth * dpr));\n const h = Math.max(2, Math.floor(window.innerHeight * dpr));\n if (canvas.width !== w || canvas.height !== h) {\n canvas.width = w;\n canvas.height = h;\n }\n }\n\n // Cache uniform locations once for zero GC pressure\n const uCaustic = {\n lightOpt: gl.getUniformLocation(progCaustic, \"uLightOpt\"),\n focalZ: gl.getUniformLocation(progCaustic, \"uFocalZ\"),\n tGlass: gl.getUniformLocation(progCaustic, \"uTGlass\"),\n baseIOR: gl.getUniformLocation(progCaustic, \"uBaseIOR\"),\n disp: gl.getUniformLocation(progCaustic, \"uDispersion\"),\n expScale: gl.getUniformLocation(progCaustic, \"uExposureScale\"),\n numBands: gl.getUniformLocation(progCaustic, \"uNumBands\"),\n heightTex: gl.getUniformLocation(progCaustic, \"uHeightTex\")\n };\n const uBloom = {\n tex: gl.getUniformLocation(progBloom, \"uTex\"),\n texel: gl.getUniformLocation(progBloom, \"uTexel\"),\n radius: gl.getUniformLocation(progBloom, \"uRadius\")\n };\n const uStage = {\n vp: gl.getUniformLocation(progStage, \"uVP\"),\n causticTex: gl.getUniformLocation(progStage, \"uCausticTex\"),\n bloomTex: gl.getUniformLocation(progStage, \"uBloomTex\"),\n targetTex: gl.getUniformLocation(progStage, \"uTargetTex\"),\n camPos: gl.getUniformLocation(progStage, \"uCamPos\"),\n lightWorld: gl.getUniformLocation(progStage, \"uLightWorld\"),\n focalZ: gl.getUniformLocation(progStage, \"uFocalZ\"),\n causticScale: gl.getUniformLocation(progStage, \"uCausticScale\"),\n compareMask: gl.getUniformLocation(progStage, \"uCompareMask\")\n };\n const uGlass = {\n vp: gl.getUniformLocation(progGlass, \"uVP\"),\n focalZ: gl.getUniformLocation(progGlass, \"uFocalZ\"),\n tGlass: gl.getUniformLocation(progGlass, \"uTGlass\"),\n heightTex: gl.getUniformLocation(progGlass, \"uHeightTex\"),\n causticTex: gl.getUniformLocation(progGlass, \"uCausticTex\"),\n bloomTex: gl.getUniformLocation(progGlass, \"uBloomTex\"),\n causticScale: gl.getUniformLocation(progGlass, \"uCausticScale\"),\n camPos: gl.getUniformLocation(progGlass, \"uCamPos\"),\n lightWorld: gl.getUniformLocation(progGlass, \"uLightWorld\"),\n baseIOR: gl.getUniformLocation(progGlass, \"uBaseIOR\"),\n glassTint: gl.getUniformLocation(progGlass, \"uGlassTint\"),\n showInterf: gl.getUniformLocation(progGlass, \"uShowInterf\")\n };","Target":" function resizeCanvas() {\n const dpr = Math.min(window.devicePixelRatio || 1, 2.0);\n const w = Math.max(2, Math.floor(window.innerWidth * dpr));\n const h = Math.max(2, Math.floor(window.innerHeight * dpr));\n if (canvas.width !== w || canvas.height !== h) {\n canvas.width = w;\n canvas.height = h;\n }\n ensureSceneCopyTex(w, h);\n }\n\n // Cache uniform locations once for zero GC pressure\n const uCaustic = {\n lightOpt: gl.getUniformLocation(progCaustic, \"uLightOpt\"),\n focalZ: gl.getUniformLocation(progCaustic, \"uFocalZ\"),\n tGlass: gl.getUniformLocation(progCaustic, \"uTGlass\"),\n baseIOR: gl.getUniformLocation(progCaustic, \"uBaseIOR\"),\n disp: gl.getUniformLocation(progCaustic, \"uDispersion\"),\n expScale: gl.getUniformLocation(progCaustic, \"uExposureScale\"),\n numBands: gl.getUniformLocation(progCaustic, \"uNumBands\"),\n heightTex: gl.getUniformLocation(progCaustic, \"uHeightTex\")\n };\n const uBloom = {\n tex: gl.getUniformLocation(progBloom, \"uTex\"),\n texel: gl.getUniformLocation(progBloom, \"uTexel\"),\n radius: gl.getUniformLocation(progBloom, \"uRadius\")\n };\n const uStage = {\n vp: gl.getUniformLocation(progStage, \"uVP\"),\n causticTex: gl.getUniformLocation(progStage, \"uCausticTex\"),\n bloomTex: gl.getUniformLocation(progStage, \"uBloomTex\"),\n targetTex: gl.getUniformLocation(progStage, \"uTargetTex\"),\n camPos: gl.getUniformLocation(progStage, \"uCamPos\"),\n lightWorld: gl.getUniformLocation(progStage, \"uLightWorld\"),\n focalZ: gl.getUniformLocation(progStage, \"uFocalZ\"),\n causticScale: gl.getUniformLocation(progStage, \"uCausticScale\"),\n compareMask: gl.getUniformLocation(progStage, \"uCompareMask\")\n };\n const uGlass = {\n vp: gl.getUniformLocation(progGlass, \"uVP\"),\n focalZ: gl.getUniformLocation(progGlass, \"uFocalZ\"),\n tGlass: gl.getUniformLocation(progGlass, \"uTGlass\"),\n heightTex: gl.getUniformLocation(progGlass, \"uHeightTex\"),\n sceneCopy: gl.getUniformLocation(progGlass, \"uSceneCopyTex\"),\n viewport: gl.getUniformLocation(progGlass, \"uViewport\"),\n camPos: gl.getUniformLocation(progGlass, \"uCamPos\"),\n lightWorld: gl.getUniformLocation(progGlass, \"uLightWorld\"),\n baseIOR: gl.getUniformLocation(progGlass, \"uBaseIOR\"),\n glassTint: gl.getUniformLocation(progGlass, \"uGlassTint\"),\n showInterf: gl.getUniformLocation(progGlass, \"uShowInterf\")\n };"}

    input

    {
      "Path": "~/run/index.html",
      "Replacement": "  function resizeCanvas() {\n    const dpr = Math.min(window.devicePixelRatio || 1, 2.0);\n    const w = Math.max(2, Math.floor(window.innerWidth * dpr));\n    const h = Math.max(2, Math.floor(window.innerHeight * dpr));\n    if (canvas.width !== w || canvas.height !== h) {\n      canvas.width = w;\n      canvas.height = h;\n    }\n  }\n\n  // Cache uniform locations once for zero GC pressure\n  const uCaustic = {\n    lightOpt: gl.getUniformLocation(progCaustic, \"uLightOpt\"),\n    focalZ: gl.getUniformLocation(progCaustic, \"uFocalZ\"),\n    tGlass: gl.getUniformLocation(progCaustic, \"uTGlass\"),\n    baseIOR: gl.getUniformLocation(progCaustic, \"uBaseIOR\"),\n    disp: gl.getUniformLocation(progCaustic, \"uDispersion\"),\n    expScale: gl.getUniformLocation(progCaustic, \"uExposureScale\"),\n    numBands: gl.getUniformLocation(progCaustic, \"uNumBands\"),\n    heightTex: gl.getUniformLocation(progCaustic, \"uHeightTex\")\n  };\n  const uBloom = {\n    tex: gl.getUniformLocation(progBloom, \"uTex\"),\n    texel: gl.getUniformLocation(progBloom, \"uTexel\"),\n    radius: gl.getUniformLocation(progBloom, \"uRadius\")\n  };\n  const uStage = {\n    vp: gl.getUniformLocation(progStage, \"uVP\"),\n    causticTex: gl.getUniformLocation(progStage, \"uCausticTex\"),\n    bloomTex: gl.getUniformLocation(progStage, \"uBloomTex\"),\n    targetTex: gl.getUniformLocation(progStage, \"uTargetTex\"),\n    camPos: gl.getUniformLocation(progStage, \"uCamPos\"),\n    lightWorld: gl.getUniformLocation(progStage, \"uLightWorld\"),\n    focalZ: gl.getUniformLocation(progStage, \"uFocalZ\"),\n    causticScale: gl.getUniformLocation(progStage, \"uCausticScale\"),\n    compareMask: gl.getUniformLocation(progStage, \"uCompareMask\")\n  };\n  const uGlass = {\n    vp: gl.getUniformLocation(progGlass, \"uVP\"),\n    focalZ: gl.getUniformLocation(progGlass, \"uFocalZ\"),\n    tGlass: gl.getUniformLocation(progGlass, \"uTGlass\"),\n    heightTex: gl.getUniformLocation(progGlass, \"uHeightTex\"),\n    causticTex: gl.getUniformLocation(progGlass, \"uCausticTex\"),\n    bloomTex: gl.getUniformLocation(progGlass, \"uBloomTex\"),\n    causticScale: gl.getUniformLocation(progGlass, \"uCausticScale\"),\n    camPos: gl.getUniformLocation(progGlass, \"uCamPos\"),\n    lightWorld: gl.getUniformLocation(progGlass, \"uLightWorld\"),\n    baseIOR: gl.getUniformLocation(progGlass, \"uBaseIOR\"),\n    glassTint: gl.getUniformLocation(progGlass, \"uGlassTint\"),\n    showInterf: gl.getUniformLocation(progGlass, \"uShowInterf\")\n  };",
      "Target": "  function resizeCanvas() {\n    const dpr = Math.min(window.devicePixelRatio || 1, 2.0);\n    const w = Math.max(2, Math.floor(window.innerWidth * dpr));\n    const h = Math.max(2, Math.floor(window.innerHeight * dpr));\n    if (canvas.width !== w || canvas.height !== h) {\n      canvas.width = w;\n      canvas.height = h;\n    }\n    ensureSceneCopyTex(w, h);\n  }\n\n  // Cache uniform locations once for zero GC pressure\n  const uCaustic = {\n    lightOpt: gl.getUniformLocation(progCaustic, \"uLightOpt\"),\n    focalZ: gl.getUniformLocation(progCaustic, \"uFocalZ\"),\n    tGlass: gl.getUniformLocation(progCaustic, \"uTGlass\"),\n    baseIOR: gl.getUniformLocation(progCaustic, \"uBaseIOR\"),\n    disp: gl.getUniformLocation(progCaustic, \"uDispersion\"),\n    expScale: gl.getUniformLocation(progCaustic, \"uExposureScale\"),\n    numBands: gl.getUniformLocation(progCaustic, \"uNumBands\"),\n    heightTex: gl.getUniformLocation(progCaustic, \"uHeightTex\")\n  };\n  const uBloom = {\n    tex: gl.getUniformLocation(progBloom, \"uTex\"),\n    texel: gl.getUniformLocation(progBloom, \"uTexel\"),\n    radius: gl.getUniformLocation(progBloom, \"uRadius\")\n  };\n  const uStage = {\n    vp: gl.getUniformLocation(progStage, \"uVP\"),\n    causticTex: gl.getUniformLocation(progStage, \"uCausticTex\"),\n    bloomTex: gl.getUniformLocation(progStage, \"uBloomTex\"),\n    targetTex: gl.getUniformLocation(progStage, \"uTargetTex\"),\n    camPos: gl.getUniformLocation(progStage, \"uCamPos\"),\n    lightWorld: gl.getUniformLocation(progStage, \"uLightWorld\"),\n    focalZ: gl.getUniformLocation(progStage, \"uFocalZ\"),\n    causticScale: gl.getUniformLocation(progStage, \"uCausticScale\"),\n    compareMask: gl.getUniformLocation(progStage, \"uCompareMask\")\n  };\n  const uGlass = {\n    vp: gl.getUniformLocation(progGlass, \"uVP\"),\n    focalZ: gl.getUniformLocation(progGlass, \"uFocalZ\"),\n    tGlass: gl.getUniformLocation(progGlass, \"uTGlass\"),\n    heightTex: gl.getUniformLocation(progGlass, \"uHeightTex\"),\n    sceneCopy: gl.getUniformLocation(progGlass, \"uSceneCopyTex\"),\n    viewport: gl.getUniformLocation(progGlass, \"uViewport\"),\n    camPos: gl.getUniformLocation(progGlass, \"uCamPos\"),\n    lightWorld: gl.getUniformLocation(progGlass, \"uLightWorld\"),\n    baseIOR: gl.getUniformLocation(progGlass, \"uBaseIOR\"),\n    glassTint: gl.getUniformLocation(progGlass, \"uGlassTint\"),\n    showInterf: gl.getUniformLocation(progGlass, \"uShowInterf\")\n  };"
    }

    result, 1 line

    Made 1 replacement in ~/run/index.html starting at line 2846 (+3/-3 lines).
  • edit_file{"Path":"~/run/index.html","Replacement":" // Scale exposure slightly down when using 8-bit fallback FBO so highlights never clip before tone-mapping\n const fboScale = useFloatCausticFBO ? 0.054 : 0.012;\n const stageRecoverScale = useFloatCausticFBO ? 1.0 : (0.054 / 0.012);\n gl.uniform1f(uCaustic.expScale, fboScale);\n gl.uniform1i(uCaustic.numBands, state.numSpectralBands);\n\n gl.bindVertexArray(beamVAO);\n gl.drawElementsInstanced(gl.TRIANGLES, beamIndices.length, gl.UNSIGNED_INT, 0, state.numSpectralBands);\n\n // --------------------------------------------------------------------------\n // PASS 2: DUAL-KAWASE PHYSICALLY SOFT HDR CAUSTIC HALATION / BLOOM\n // --------------------------------------------------------------------------\n gl.disable(gl.BLEND);\n gl.useProgram(progBloom);\n gl.bindVertexArray(emptyVAO);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomA.fbo);\n gl.viewport(0, 0, fboBloomA.w, fboBloomA.h);\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, fboCaustic.tex);\n gl.uniform1i(uBloom.tex, 0);\n gl.uniform2f(uBloom.texel, 1 / fboCaustic.w, 1 / fboCaustic.h);\n gl.uniform1f(uBloom.radius, 1.5);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomB.fbo);\n gl.viewport(0, 0, fboBloomB.w, fboBloomB.h);\n gl.bindTexture(gl.TEXTURE_2D, fboBloomA.tex);\n gl.uniform2f(uBloom.texel, 1 / fboBloomA.w, 1 / fboBloomA.h);\n gl.uniform1f(uBloom.radius, 2.2);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomA.fbo);\n gl.viewport(0, 0, fboBloomA.w, fboBloomA.h);\n gl.bindTexture(gl.TEXTURE_2D, fboBloomB.tex);\n gl.uniform2f(uBloom.texel, 1 / fboBloomB.w, 1 / fboBloomB.h);\n gl.uniform1f(uBloom.radius, 1.8);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n // --------------------------------------------------------------------------\n // PASS 3: UNIFIED 3D ATELIER OPTICAL BENCH SCENE\n // --------------------------------------------------------------------------\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n const W = canvas.width, H = canvas.height;\n gl.viewport(0, 0, W, H);\n gl.clearColor(0.018, 0.021, 0.032, 1.0);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n gl.enable(gl.DEPTH_TEST);\n gl.depthMask(true);\n\n const cosP = Math.cos(state.camPitch), sinP = Math.sin(state.camPitch);\n const cosY = Math.cos(state.camYaw), sinY = Math.sin(state.camYaw);\n const camPos = [\n state.camDist * cosP * sinY,\n state.camCenterY + state.camDist * sinP,\n state.camDist * cosP * cosY\n ];\n const center = [0, state.camCenterY * 0.85, 0];\n const proj = mat4Perspective(40 * Math.PI / 180, W / H, 0.15, 40.0);\n const view = mat4LookAt(camPos, center, [0, 1, 0]);\n currentVP = mat4Mul(proj, view);\n const lightWorld = [state.lampX, state.lampZ, -state.lampS];\n\n // 3A: Obsidian Receiver Stage + Live Caustics\n gl.useProgram(progStage);\n gl.uniformMatrix4fv(uStage.vp, false, currentVP);\n gl.uniform3fv(uStage.camPos, camPos);\n gl.uniform3fv(uStage.lightWorld, lightWorld);\n gl.uniform1f(uStage.focalZ, focalZ);\n gl.uniform1f(uStage.causticScale, stageRecoverScale);\n gl.uniform1i(uStage.compareMask, state.compareMask ? 1 : 0);\n\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, fboCaustic.tex);\n gl.uniform1i(uStage.causticTex, 0);\n gl.activeTexture(gl.TEXTURE1);\n gl.bindTexture(gl.TEXTURE_2D, fboBloomA.tex);\n gl.uniform1i(uStage.bloomTex, 1);\n gl.activeTexture(gl.TEXTURE2);\n gl.bindTexture(gl.TEXTURE_2D, targetTex);\n gl.uniform1i(uStage.targetTex, 2);\n\n gl.bindVertexArray(stageVAO);\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n\n // 3B: Render 3D Sculpted Optical Crystal Block (Back faces then Front faces for true depth!)\n gl.useProgram(progGlass);\n gl.uniformMatrix4fv(uGlass.vp, false, currentVP);\n gl.uniform1f(uGlass.focalZ, focalZ);\n gl.uniform1f(uGlass.tGlass, T_GLASS);\n gl.uniform1f(uGlass.causticScale, stageRecoverScale);\n gl.uniform3fv(uGlass.camPos, camPos);\n gl.uniform3fv(uGlass.lightWorld, lightWorld);\n gl.uniform1f(uGlass.baseIOR, mat.nD);\n gl.uniform3fv(uGlass.glassTint, mat.tint);\n gl.uniform1i(uGlass.showInterf, state.showInterf ? 1 : 0);\n\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, heightTex);\n gl.uniform1i(uGlass.heightTex, 0);\n gl.activeTexture(gl.TEXTURE1);\n gl.bindTexture(gl.TEXTURE_2D, fboCaustic.tex);\n gl.uniform1i(uGlass.causticTex, 1);\n gl.activeTexture(gl.TEXTURE2);\n gl.bindTexture(gl.TEXTURE_2D, fboBloomA.tex);\n gl.uniform1i(uGlass.bloomTex, 2);","Target":" // Scale exposure slightly down when using 8-bit fallback FBO so highlights never clip before tone-mapping\n const fboScale = useFloatCausticFBO ? 0.145 : 0.022;\n const stageRecoverScale = useFloatCausticFBO ? 1.0 : (0.145 / 0.022);\n gl.uniform1f(uCaustic.expScale, fboScale);\n gl.uniform1i(uCaustic.numBands, state.numSpectralBands);\n\n gl.bindVertexArray(beamVAO);\n gl.drawElementsInstanced(gl.TRIANGLES, beamIndices.length, gl.UNSIGNED_INT, 0, state.numSpectralBands);\n\n // --------------------------------------------------------------------------\n // PASS 2: DUAL-KAWASE PHYSICALLY SOFT HDR CAUSTIC HALATION / BLOOM\n // --------------------------------------------------------------------------\n gl.disable(gl.BLEND);\n gl.useProgram(progBloom);\n gl.bindVertexArray(emptyVAO);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomA.fbo);\n gl.viewport(0, 0, fboBloomA.w, fboBloomA.h);\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, fboCaustic.tex);\n gl.uniform1i(uBloom.tex, 0);\n gl.uniform2f(uBloom.texel, 1 / fboCaustic.w, 1 / fboCaustic.h);\n gl.uniform1f(uBloom.radius, 1.5);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomB.fbo);\n gl.viewport(0, 0, fboBloomB.w, fboBloomB.h);\n gl.bindTexture(gl.TEXTURE_2D, fboBloomA.tex);\n gl.uniform2f(uBloom.texel, 1 / fboBloomA.w, 1 / fboBloomA.h);\n gl.uniform1f(uBloom.radius, 2.2);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomA.fbo);\n gl.viewport(0, 0, fboBloomA.w, fboBloomA.h);\n gl.bindTexture(gl.TEXTURE_2D, fboBloomB.tex);\n gl.uniform2f(uBloom.texel, 1 / fboBloomB.w, 1 / fboBloomB.h);\n gl.uniform1f(uBloom.radius, 1.8);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n // --------------------------------------------------------------------------\n // PASS 3: UNIFIED 3D ATELIER OPTICAL BENCH SCENE\n // --------------------------------------------------------------------------\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n const W = canvas.width, H = canvas.height;\n gl.viewport(0, 0, W, H);\n gl.clearColor(0.027, 0.031, 0.045, 1.0);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n gl.enable(gl.DEPTH_TEST);\n gl.depthMask(true);\n\n const cosP = Math.cos(state.camPitch), sinP = Math.sin(state.camPitch);\n const cosY = Math.cos(state.camYaw), sinY = Math.sin(state.camYaw);\n const camPos = [\n state.camDist * cosP * sinY,\n state.camCenterY + state.camDist * sinP,\n state.camDist * cosP * cosY\n ];\n const center = [0, state.camCenterY * 0.52, 0];\n const proj = mat4Perspective(39 * Math.PI / 180, W / H, 0.15, 40.0);\n const view = mat4LookAt(camPos, center, [0, 1, 0]);\n currentVP = mat4Mul(proj, view);\n const lightWorld = [state.lampX, state.lampZ, -state.lampS];\n\n // 3A: Obsidian Receiver Stage + Live Caustics\n gl.useProgram(progStage);\n gl.uniformMatrix4fv(uStage.vp, false, currentVP);\n gl.uniform3fv(uStage.camPos, camPos);\n gl.uniform3fv(uStage.lightWorld, lightWorld);\n gl.uniform1f(uStage.focalZ, focalZ);\n gl.uniform1f(uStage.causticScale, stageRecoverScale);\n gl.uniform1i(uStage.compareMask, state.compareMask ? 1 : 0);\n\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, fboCaustic.tex);\n gl.uniform1i(uStage.causticTex, 0);\n gl.activeTexture(gl.TEXTURE1);\n gl.bindTexture(gl.TEXTURE_2D, fboBloomA.tex);\n gl.uniform1i(uStage.bloomTex, 1);\n gl.activeTexture(gl.TEXTURE2);\n gl.bindTexture(gl.TEXTURE_2D, targetTex);\n gl.uniform1i(uStage.targetTex, 2);\n\n gl.bindVertexArray(stageVAO);\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n\n // Copy rendered stage into sceneCopyTex so the 3D crystal block refracts the live caustic tabletop!\n gl.bindTexture(gl.TEXTURE_2D, sceneCopyTex);\n gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, W, H);\n\n // 3B: Render 3D Sculpted Optical Crystal Block (Back faces then Front faces for true depth!)\n gl.useProgram(progGlass);\n gl.uniformMatrix4fv(uGlass.vp, false, currentVP);\n gl.uniform1f(uGlass.focalZ, focalZ);\n gl.uniform1f(uGlass.tGlass, T_GLASS);\n gl.uniform2f(uGlass.viewport, W, H);\n gl.uniform3fv(uGlass.camPos, camPos);\n gl.uniform3fv(uGlass.lightWorld, lightWorld);\n gl.uniform1f(uGlass.baseIOR, mat.nD);\n gl.uniform3fv(uGlass.glassTint, mat.tint);\n gl.uniform1i(uGlass.showInterf, state.showInterf ? 1 : 0);\n\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, heightTex);\n gl.uniform1i(uGlass.heightTex, 0);\n gl.activeTexture(gl.TEXTURE1);\n gl.bindTexture(gl.TEXTURE_2D, sceneCopyTex);\n gl.uniform1i(uGlass.sceneCopy, 1);"}

    input

    {
      "Path": "~/run/index.html",
      "Replacement": "    // Scale exposure slightly down when using 8-bit fallback FBO so highlights never clip before tone-mapping\n    const fboScale = useFloatCausticFBO ? 0.054 : 0.012;\n    const stageRecoverScale = useFloatCausticFBO ? 1.0 : (0.054 / 0.012);\n    gl.uniform1f(uCaustic.expScale, fboScale);\n    gl.uniform1i(uCaustic.numBands, state.numSpectralBands);\n\n    gl.bindVertexArray(beamVAO);\n    gl.drawElementsInstanced(gl.TRIANGLES, beamIndices.length, gl.UNSIGNED_INT, 0, state.numSpectralBands);\n\n    // --------------------------------------------------------------------------\n    // PASS 2: DUAL-KAWASE PHYSICALLY SOFT HDR CAUSTIC HALATION / BLOOM\n    // --------------------------------------------------------------------------\n    gl.disable(gl.BLEND);\n    gl.useProgram(progBloom);\n    gl.bindVertexArray(emptyVAO);\n\n    gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomA.fbo);\n    gl.viewport(0, 0, fboBloomA.w, fboBloomA.h);\n    gl.activeTexture(gl.TEXTURE0);\n    gl.bindTexture(gl.TEXTURE_2D, fboCaustic.tex);\n    gl.uniform1i(uBloom.tex, 0);\n    gl.uniform2f(uBloom.texel, 1 / fboCaustic.w, 1 / fboCaustic.h);\n    gl.uniform1f(uBloom.radius, 1.5);\n    gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n    gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomB.fbo);\n    gl.viewport(0, 0, fboBloomB.w, fboBloomB.h);\n    gl.bindTexture(gl.TEXTURE_2D, fboBloomA.tex);\n    gl.uniform2f(uBloom.texel, 1 / fboBloomA.w, 1 / fboBloomA.h);\n    gl.uniform1f(uBloom.radius, 2.2);\n    gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n    gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomA.fbo);\n    gl.viewport(0, 0, fboBloomA.w, fboBloomA.h);\n    gl.bindTexture(gl.TEXTURE_2D, fboBloomB.tex);\n    gl.uniform2f(uBloom.texel, 1 / fboBloomB.w, 1 / fboBloomB.h);\n    gl.uniform1f(uBloom.radius, 1.8);\n    gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n    // --------------------------------------------------------------------------\n    // PASS 3: UNIFIED 3D ATELIER OPTICAL BENCH SCENE\n    // --------------------------------------------------------------------------\n    gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n    const W = canvas.width, H = canvas.height;\n    gl.viewport(0, 0, W, H);\n    gl.clearColor(0.018, 0.021, 0.032, 1.0);\n    gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n    gl.enable(gl.DEPTH_TEST);\n    gl.depthMask(true);\n\n    const cosP = Math.cos(state.camPitch), sinP = Math.sin(state.camPitch);\n    const cosY = Math.cos(state.camYaw),   sinY = Math.sin(state.camYaw);\n    const camPos = [\n      state.camDist * cosP * sinY,\n      state.camCenterY + state.camDist * sinP,\n      state.camDist * cosP * cosY\n    ];\n    const center = [0, state.camCenterY * 0.85, 0];\n    const proj = mat4Perspective(40 * Math.PI / 180, W / H, 0.15, 40.0);\n    const view = mat4LookAt(camPos, center, [0, 1, 0]);\n    currentVP = mat4Mul(proj, view);\n    const lightWorld = [state.lampX, state.lampZ, -state.lampS];\n\n    // 3A: Obsidian Receiver Stage + Live Caustics\n    gl.useProgram(progStage);\n    gl.uniformMatrix4fv(uStage.vp, false, currentVP);\n    gl.uniform3fv(uStage.camPos, camPos);\n    gl.uniform3fv(uStage.lightWorld, lightWorld);\n    gl.uniform1f(uStage.focalZ, focalZ);\n    gl.uniform1f(uStage.causticScale, stageRecoverScale);\n    gl.uniform1i(uStage.compareMask, state.compareMask ? 1 : 0);\n\n    gl.activeTexture(gl.TEXTURE0);\n    gl.bindTexture(gl.TEXTURE_2D, fboCaustic.tex);\n    gl.uniform1i(uStage.causticTex, 0);\n    gl.activeTexture(gl.TEXTURE1);\n    gl.bindTexture(gl.TEXTURE_2D, fboBloomA.tex);\n    gl.uniform1i(uStage.bloomTex, 1);\n    gl.activeTexture(gl.TEXTURE2);\n    gl.bindTexture(gl.TEXTURE_2D, targetTex);\n    gl.uniform1i(uStage.targetTex, 2);\n\n    gl.bindVertexArray(stageVAO);\n    gl.drawArrays(gl.TRIANGLES, 0, 6);\n\n    // 3B: Render 3D Sculpted Optical Crystal Block (Back faces then Front faces for true depth!)\n    gl.useProgram(progGlass);\n    gl.uniformMatrix4fv(uGlass.vp, false, currentVP);\n    gl.uniform1f(uGlass.focalZ, focalZ);\n    gl.uniform1f(uGlass.tGlass, T_GLASS);\n    gl.uniform1f(uGlass.causticScale, stageRecoverScale);\n    gl.uniform3fv(uGlass.camPos, camPos);\n    gl.uniform3fv(uGlass.lightWorld, lightWorld);\n    gl.uniform1f(uGlass.baseIOR, mat.nD);\n    gl.uniform3fv(uGlass.glassTint, mat.tint);\n    gl.uniform1i(uGlass.showInterf, state.showInterf ? 1 : 0);\n\n    gl.activeTexture(gl.TEXTURE0);\n    gl.bindTexture(gl.TEXTURE_2D, heightTex);\n    gl.uniform1i(uGlass.heightTex, 0);\n    gl.activeTexture(gl.TEXTURE1);\n    gl.bindTexture(gl.TEXTURE_2D, fboCaustic.tex);\n    gl.uniform1i(uGlass.causticTex, 1);\n    gl.activeTexture(gl.TEXTURE2);\n    gl.bindTexture(gl.TEXTURE_2D, fboBloomA.tex);\n    gl.uniform1i(uGlass.bloomTex, 2);",
      "Target": "    // Scale exposure slightly down when using 8-bit fallback FBO so highlights never clip before tone-mapping\n    const fboScale = useFloatCausticFBO ? 0.145 : 0.022;\n    const stageRecoverScale = useFloatCausticFBO ? 1.0 : (0.145 / 0.022);\n    gl.uniform1f(uCaustic.expScale, fboScale);\n    gl.uniform1i(uCaustic.numBands, state.numSpectralBands);\n\n    gl.bindVertexArray(beamVAO);\n    gl.drawElementsInstanced(gl.TRIANGLES, beamIndices.length, gl.UNSIGNED_INT, 0, state.numSpectralBands);\n\n    // --------------------------------------------------------------------------\n    // PASS 2: DUAL-KAWASE PHYSICALLY SOFT HDR CAUSTIC HALATION / BLOOM\n    // --------------------------------------------------------------------------\n    gl.disable(gl.BLEND);\n    gl.useProgram(progBloom);\n    gl.bindVertexArray(emptyVAO);\n\n    gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomA.fbo);\n    gl.viewport(0, 0, fboBloomA.w, fboBloomA.h);\n    gl.activeTexture(gl.TEXTURE0);\n    gl.bindTexture(gl.TEXTURE_2D, fboCaustic.tex);\n    gl.uniform1i(uBloom.tex, 0);\n    gl.uniform2f(uBloom.texel, 1 / fboCaustic.w, 1 / fboCaustic.h);\n    gl.uniform1f(uBloom.radius, 1.5);\n    gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n    gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomB.fbo);\n    gl.viewport(0, 0, fboBloomB.w, fboBloomB.h);\n    gl.bindTexture(gl.TEXTURE_2D, fboBloomA.tex);\n    gl.uniform2f(uBloom.texel, 1 / fboBloomA.w, 1 / fboBloomA.h);\n    gl.uniform1f(uBloom.radius, 2.2);\n    gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n    gl.bindFramebuffer(gl.FRAMEBUFFER, fboBloomA.fbo);\n    gl.viewport(0, 0, fboBloomA.w, fboBloomA.h);\n    gl.bindTexture(gl.TEXTURE_2D, fboBloomB.tex);\n    gl.uniform2f(uBloom.texel, 1 / fboBloomB.w, 1 / fboBloomB.h);\n    gl.uniform1f(uBloom.radius, 1.8);\n    gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n    // --------------------------------------------------------------------------\n    // PASS 3: UNIFIED 3D ATELIER OPTICAL BENCH SCENE\n    // --------------------------------------------------------------------------\n    gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n    const W = canvas.width, H = canvas.height;\n    gl.viewport(0, 0, W, H);\n    gl.clearColor(0.027, 0.031, 0.045, 1.0);\n    gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n    gl.enable(gl.DEPTH_TEST);\n    gl.depthMask(true);\n\n    const cosP = Math.cos(state.camPitch), sinP = Math.sin(state.camPitch);\n    const cosY = Math.cos(state.camYaw),   sinY = Math.sin(state.camYaw);\n    const camPos = [\n      state.camDist * cosP * sinY,\n      state.camCenterY + state.camDist * sinP,\n      state.camDist * cosP * cosY\n    ];\n    const center = [0, state.camCenterY * 0.52, 0];\n    const proj = mat4Perspective(39 * Math.PI / 180, W / H, 0.15, 40.0);\n    const view = mat4LookAt(camPos, center, [0, 1, 0]);\n    currentVP = mat4Mul(proj, view);\n    const lightWorld = [state.lampX, state.lampZ, -state.lampS];\n\n    // 3A: Obsidian Receiver Stage + Live Caustics\n    gl.useProgram(progStage);\n    gl.uniformMatrix4fv(uStage.vp, false, currentVP);\n    gl.uniform3fv(uStage.camPos, camPos);\n    gl.uniform3fv(uStage.lightWorld, lightWorld);\n    gl.uniform1f(uStage.focalZ, focalZ);\n    gl.uniform1f(uStage.causticScale, stageRecoverScale);\n    gl.uniform1i(uStage.compareMask, state.compareMask ? 1 : 0);\n\n    gl.activeTexture(gl.TEXTURE0);\n    gl.bindTexture(gl.TEXTURE_2D, fboCaustic.tex);\n    gl.uniform1i(uStage.causticTex, 0);\n    gl.activeTexture(gl.TEXTURE1);\n    gl.bindTexture(gl.TEXTURE_2D, fboBloomA.tex);\n    gl.uniform1i(uStage.bloomTex, 1);\n    gl.activeTexture(gl.TEXTURE2);\n    gl.bindTexture(gl.TEXTURE_2D, targetTex);\n    gl.uniform1i(uStage.targetTex, 2);\n\n    gl.bindVertexArray(stageVAO);\n    gl.drawArrays(gl.TRIANGLES, 0, 6);\n\n    // Copy rendered stage into sceneCopyTex so the 3D crystal block refracts the live caustic tabletop!\n    gl.bindTexture(gl.TEXTURE_2D, sceneCopyTex);\n    gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, W, H);\n\n    // 3B: Render 3D Sculpted Optical Crystal Block (Back faces then Front faces for true depth!)\n    gl.useProgram(progGlass);\n    gl.uniformMatrix4fv(uGlass.vp, false, currentVP);\n    gl.uniform1f(uGlass.focalZ, focalZ);\n    gl.uniform1f(uGlass.tGlass, T_GLASS);\n    gl.uniform2f(uGlass.viewport, W, H);\n    gl.uniform3fv(uGlass.camPos, camPos);\n    gl.uniform3fv(uGlass.lightWorld, lightWorld);\n    gl.uniform1f(uGlass.baseIOR, mat.nD);\n    gl.uniform3fv(uGlass.glassTint, mat.tint);\n    gl.uniform1i(uGlass.showInterf, state.showInterf ? 1 : 0);\n\n    gl.activeTexture(gl.TEXTURE0);\n    gl.bindTexture(gl.TEXTURE_2D, heightTex);\n    gl.uniform1i(uGlass.heightTex, 0);\n    gl.activeTexture(gl.TEXTURE1);\n    gl.bindTexture(gl.TEXTURE_2D, sceneCopyTex);\n    gl.uniform1i(uGlass.sceneCopy, 1);"
    }

    result, 1 line

    Made 1 replacement in ~/run/index.html starting at line 3016 (+11/-12 lines).
  • run_command{"CommandLine":"/opt/node/bin/node ~/.gemini/antigravity-cli/brain/57c10734-2a82-45f0-9144-4789a69869c1/scratch/inspect_playwright.js","WaitMsBeforeAsync":10000,"toolSummary":"Run Playwright 6-view visual and console audit"}error

    input

    {
      "CommandLine": "/opt/node/bin/node ~/.gemini/antigravity-cli/brain/57c10734-2a82-45f0-9144-4789a69869c1/scratch/inspect_playwright.js",
      "WaitMsBeforeAsync": 10000,
      "toolSummary": "Run Playwright 6-view visual and console audit"
    }

    result, error, 29 lines

    Command exited with code 1.
    
    Command output:
    node:internal/modules/cjs/loader:1386
      throw err;
      ^
    
    Error: Cannot find module 'playwright-core'
    Require stack:
    - /usr/local/share/.cache/yarn/v6/npm-playwright-1.47.2-155688aa06491ee21fb3e7555b748b525f86eb20-integrity/node_modules/playwright/index.js
    - ~/.gemini/antigravity-cli/brain/57c10734-2a82-45f0-9144-4789a69869c1/scratch/inspect_playwright.js
        at Function._resolveFilename (node:internal/modules/cjs/loader:1383:15)
        at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19)
        at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22)
        at Function._load (node:internal/modules/cjs/loader:1192:37)
        at TracingChannel.traceSync (node:diagnostics_channel:328:14)
        at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
        at Module.require (node:internal/modules/cjs/loader:1463:12)
        at require (node:internal/modules/helpers:147:16)
        at Object.<anonymous> (/usr/local/share/.cache/yarn/v6/npm-playwright-1.47.2-155688aa06491ee21fb3e7555b748b525f86eb20-integrity/node_modules/playwright/index.js:17:18)
        at Module._compile (node:internal/modules/cjs/loader:1706:14) {
      code: 'MODULE_NOT_FOUND',
      requireStack: [
        '/usr/local/share/.cache/yarn/v6/npm-playwright-1.47.2-155688aa06491ee21fb3e7555b748b525f86eb20-integrity/node_modules/playwright/index.js',
        '~/.gemini/antigravity-cli/brain/57c10734-2a82-45f0-9144-4789a69869c1/scratch/inspect_playwright.js'
      ]
    }
    
    Node.js v22.21.1