From 8712c2e01ff9c76d33ed1f7954e9791f1d38eaa0 Mon Sep 17 00:00:00 2001 From: Carlos Alcaraz <193642530+calcarazgre646@users.noreply.github.com> Date: Thu, 18 Jun 2026 22:27:08 -0300 Subject: [PATCH] fix(shader-transitions): show the from-scene at gravitational-lens start The gravitational-lens frag multiplied the lensed color by a horizon term that darkens the center to black, but the term was not gated by progress. At progress 0 (a paused seek at the transition start, and the first rendered frame) the from-scene rendered as a black-hole vignette instead of the clean outgoing frame. Every other shader in the file collapses cleanly to the from-scene at progress 0. Ramp the horizon darkening in from progress 0 (mix(1., horizon, smoothstep(0., .3, u_progress))) so lensed == from-scene at the start. The progress-1 endpoint is unchanged (the outer mix already selects the to-scene there). --- packages/shader-transitions/src/shaders/registry.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/shader-transitions/src/shaders/registry.ts b/packages/shader-transitions/src/shaders/registry.ts index 26bfac777c..2357e69765 100644 --- a/packages/shader-transitions/src/shaders/registry.ts +++ b/packages/shader-transitions/src/shaders/registry.ts @@ -98,7 +98,13 @@ const shaders: Record = { "float shift=pull*.02/(dist+.2);" + "float r=texture2D(u_from,clamp(v_uv-uv*(warpStr+shift),0.,1.)).r;" + "float b=texture2D(u_from,clamp(v_uv-uv*(warpStr-shift),0.,1.)).b;" + - "vec3 lensed=vec3(r,A.g,b)*horizon;" + + // The horizon term darkens the center to black, but it is not gated by + // progress, so at progress 0 the from-scene rendered as a black-hole + // vignette instead of the clean outgoing frame. Ramp the darkening in from + // progress 0 so lensed == from-scene at the transition start, matching + // every other shader in this file. + "float horizonRamp=smoothstep(0.,.3,u_progress);" + + "vec3 lensed=vec3(r,A.g,b)*mix(1.,horizon,horizonRamp);" + "gl_FragColor=vec4(mix(lensed,B.rgb,smoothstep(.3,.9,u_progress)),1.);}", },