Refine milky Dock and refract symbols beneath the moving lens

This commit is contained in:
david1465833828
2026-10-28 17:56:40 +08:00
parent dc71e411e9
commit 23c1a58ca3
10 changed files with 351 additions and 160 deletions
+5 -5
View File
@@ -26,12 +26,12 @@ void main() {
float distance = length(outward);
vec2 normal = outward / max(distance, 0.001);
float depth = radius - distance;
float rim = 1.0 - smoothstep(0.0, radius * 0.46, depth);
float rim = 1.0 - smoothstep(0.0, radius * 0.52, depth);
// Curved glass bends rays most at its edge, with subtle centre magnification.
vec2 ray = centre + local / (1.0 + u_strength * 0.075)
- normal * rim * rim * radius * u_strength * 0.23;
vec4 colour = texture(u_background, sampleUV(ray));
float dispersion = u_strength * rim * 0.65;
float dispersion = u_strength * rim * 0.80;
colour.r = texture(u_background, sampleUV(ray + normal * dispersion)).r;
colour.b = texture(u_background, sampleUV(ray - normal * dispersion)).b;
// The curved rim catches nearby background light as well as transmitting it.
@@ -40,11 +40,11 @@ void main() {
float edge_light = pow(rim, 4.0) * u_strength * facing;
vec4 reflected = texture(u_background,
sampleUV(point + normal * radius * 0.40));
colour = mix(colour, reflected, min(edge_light * 0.18, 0.22));
colour = mix(colour, reflected, min(edge_light * 0.22, 0.26));
// A grazing-angle white reflection gives the curved rim visible thickness;
// the broad centre continues to transmit the live, lightly softened scene.
colour.rgb = mix(colour.rgb, vec3(colour.a), min(edge_light * 0.15, 0.18));
float reflection = edge_light * 0.075;
colour.rgb = mix(colour.rgb, vec3(colour.a), min(edge_light * 0.19, 0.22));
float reflection = edge_light * 0.10;
colour.rgb = min(colour.rgb + reflection * colour.a, vec3(colour.a));
frag_color = colour;
}