radiance: snow-globe containment — tangential cursor push, glass wall, radius cap

This commit is contained in:
dangrubbb
2026-10-24 09:32:17 -04:00
parent a900c5f750
commit aac2bdf2e6

View File

@ -382,7 +382,11 @@ void main() {
vec3 push = viewToBody(vec3(flow, 0.0)) * uGain * front; vec3 push = viewToBody(vec3(flow, 0.0)) * uGain * front;
// hard stirring also tumbles particles through depth, so the volume churns instead of sliding sideways // hard stirring also tumbles particles through depth, so the volume churns instead of sliding sideways
vec3 tumble = curlNoise(pos * 4.0 + vec3(0.0, 0.0, t * 0.9)) * fm * 0.7 * front; vec3 tumble = curlNoise(pos * 4.0 + vec3(0.0, 0.0, t * 0.9)) * fm * 0.7 * front;
vec3 depth = n * (h01(idx * 8u + 7u) - 0.5) * fm * 0.9 * front; vec3 depth = n * (h01(idx * 8u + 7u) - 0.5) * fm * 0.9 * front * (1.0 - surf);
// snow globe: a push is felt along the glass, not through it. Near the limb that slides the particle
// around to the far side instead of out of the ball.
push -= n * dot(push, n);
tumble -= n * dot(tumble, n) * 0.7;
// idle: slow broad currents plus finer eddies, kept mostly along the skin so streaks pile up and shear // idle: slow broad currents plus finer eddies, kept mostly along the skin so streaks pile up and shear
vec3 amb = curlNoise(pos * 1.35 + vec3(0.0, 0.0, t * 0.35)) vec3 amb = curlNoise(pos * 1.35 + vec3(0.0, 0.0, t * 0.35))
@ -394,11 +398,12 @@ void main() {
vel += (target - vel) * (1.0 - exp(-uDt * 3.0)); vel += (target - vel) * (1.0 - exp(-uDt * 3.0));
pos += vel * uDt; pos += vel * uDt;
// soft restoring pull to its layer // the glass wall: no outward velocity at the shell, a hard radius cap, and a soft pull back to its layer
r = length(pos); r = length(pos);
n = pos / max(r, 1e-4); n = pos / max(r, 1e-4);
vel -= n * max(dot(vel, n), 0.0) * smoothstep(rt - 0.05, rt + 0.01, r);
r = mix(r, rt, 1.0 - exp(-uDt * 1.6)); r = mix(r, rt, 1.0 - exp(-uDt * 1.6));
pos = n * r; pos = n * min(r, 0.985);
stir = max(stir * exp(-uDt * 1.2), clamp(fm * front * 1.5, 0.0, 1.5)); stir = max(stir * exp(-uDt * 1.2), clamp(fm * front * 1.5, 0.0, 1.5));
oPos = vec4(pos, stir); oPos = vec4(pos, stir);