gl-transitions 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/compatibility.json +210 -0
- package/gl-transitions.js +1 -1
- package/gl-transitions.json +1 -1
- package/glsl3/CardDeal.glsl +146 -0
- package/glsl3/EchoSlide.glsl +93 -0
- package/glsl3/GeometricCollage.glsl +241 -0
- package/glsl3/HingedSquares.glsl +121 -0
- package/glsl3/HorizontalHold.glsl +62 -0
- package/glsl3/LayoutGrid.glsl +147 -0
- package/glsl3/ProjectorThrow.glsl +75 -0
- package/glsl3/Reassemble.glsl +156 -0
- package/glsl3/Shockwave.glsl +103 -0
- package/glsl3/ShoreWash.glsl +150 -0
- package/glsl3/ShutterWipe.glsl +68 -0
- package/glsl3/StopMotion.glsl +118 -0
- package/glsl3/Vaporize.glsl +125 -0
- package/index.js +1 -1
- package/layouts.json +493 -0
- package/llms-full.txt +647 -434
- package/llms.txt +238 -225
- package/msl/CardDeal.metal +539 -0
- package/msl/EchoSlide.metal +438 -0
- package/msl/GeometricCollage.metal +1188 -0
- package/msl/HingedSquares.metal +564 -0
- package/msl/HorizontalHold.metal +286 -0
- package/msl/LayoutGrid.metal +544 -0
- package/msl/ProjectorThrow.metal +313 -0
- package/msl/Reassemble.metal +667 -0
- package/msl/Shockwave.metal +256 -0
- package/msl/ShoreWash.metal +538 -0
- package/msl/ShutterWipe.metal +286 -0
- package/msl/StopMotion.metal +551 -0
- package/msl/Vaporize.metal +462 -0
- package/package.json +1 -1
- package/skills/gl-transitions/references/catalog.md +70 -32
- package/sksl/CardDeal.sksl +156 -0
- package/sksl/EchoSlide.sksl +99 -0
- package/sksl/GeometricCollage.sksl +242 -0
- package/sksl/HingedSquares.sksl +124 -0
- package/sksl/HorizontalHold.sksl +74 -0
- package/sksl/LayoutGrid.sksl +156 -0
- package/sksl/ProjectorThrow.sksl +85 -0
- package/sksl/Reassemble.sksl +166 -0
- package/sksl/Shockwave.sksl +116 -0
- package/sksl/ShoreWash.sksl +159 -0
- package/sksl/ShutterWipe.sksl +80 -0
- package/sksl/StopMotion.sksl +126 -0
- package/sksl/Vaporize.sksl +134 -0
- package/sksl/index.js +1 -1
- package/transitions/CardDeal.glsl +145 -0
- package/transitions/EchoSlide.glsl +92 -0
- package/transitions/GeometricCollage.glsl +240 -0
- package/transitions/HingedSquares.glsl +120 -0
- package/transitions/HorizontalHold.glsl +61 -0
- package/transitions/LayoutGrid.glsl +146 -0
- package/transitions/ProjectorThrow.glsl +74 -0
- package/transitions/Reassemble.glsl +155 -0
- package/transitions/Shockwave.glsl +102 -0
- package/transitions/ShoreWash.glsl +149 -0
- package/transitions/ShutterWipe.glsl +67 -0
- package/transitions/StopMotion.glsl +117 -0
- package/transitions/Vaporize.glsl +124 -0
- package/wgsl/CardDeal.wgsl +496 -0
- package/wgsl/EchoSlide.wgsl +386 -0
- package/wgsl/GeometricCollage.wgsl +1075 -0
- package/wgsl/HingedSquares.wgsl +506 -0
- package/wgsl/HorizontalHold.wgsl +243 -0
- package/wgsl/LayoutGrid.wgsl +495 -0
- package/wgsl/ProjectorThrow.wgsl +274 -0
- package/wgsl/Reassemble.wgsl +609 -0
- package/wgsl/Shockwave.wgsl +226 -0
- package/wgsl/ShoreWash.wgsl +492 -0
- package/wgsl/ShutterWipe.wgsl +252 -0
- package/wgsl/StopMotion.wgsl +496 -0
- package/wgsl/Vaporize.wgsl +420 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// ShutterWipe — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/ShutterWipe.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: A camera's focal-plane shutter fires across the frame, seen through the camera's gate: thin metal blades fan down from a tight stack above it until they overlap over the whole frame, then keep running down and stack below it, uncovering the incoming image from the top
|
|
5
|
+
// Tags: camera, shutter, wipe, metal
|
|
6
|
+
|
|
7
|
+
// @range(3, 10, 1) Number of metal blades
|
|
8
|
+
uniform int blades; // = 5
|
|
9
|
+
// @range(0, 0.2) How much the blades tilt on their arms while they travel
|
|
10
|
+
uniform float tilt; // = 0.06
|
|
11
|
+
// @range(0, 0.08) Width of the camera's gate framing the image while the shutter fires, in frame heights
|
|
12
|
+
uniform float gate; // = 0.035
|
|
13
|
+
// @color Color of the metal blades
|
|
14
|
+
uniform vec4 color; // = vec4(0.09, 0.09, 0.1, 1.0)
|
|
15
|
+
|
|
16
|
+
// spacing of the blades in their stacks, and how far the stacks rest outside the frame, in frame heights
|
|
17
|
+
const float STACK = 0.016;
|
|
18
|
+
const float REST = 0.05;
|
|
19
|
+
|
|
20
|
+
vec4 transition(vec2 uv) {
|
|
21
|
+
float n = clamp(float(blades), 3.0, 10.0);
|
|
22
|
+
// tall enough to still overlap, past their blurred edges, when they are spread the most
|
|
23
|
+
float h = 1.7 / n + 0.02;
|
|
24
|
+
float pile = (n - 1.0) * STACK;
|
|
25
|
+
// the bottoms of the blades run from a stack above the frame to a stack below it: the
|
|
26
|
+
// lowest blade leads, the highest one trails
|
|
27
|
+
float travel = 1.0 + 2.0 * REST + h + pile;
|
|
28
|
+
vec2 t = clamp((progress - vec2(0.0, 0.3)) / 0.7, 0.0, 1.0);
|
|
29
|
+
vec2 pos = 1.0 + REST + vec2(0.0, pile) - travel * t * t * (3.0 - 2.0 * t);
|
|
30
|
+
vec2 vel = travel * 6.0 * t * (1.0 - t) / 0.7;
|
|
31
|
+
|
|
32
|
+
float x = (uv.x - 0.5) * ratio;
|
|
33
|
+
// the images are swapped halfway, behind the closed shutter
|
|
34
|
+
vec4 col = progress < 0.5 ? getFromColor(uv) : getToColor(uv);
|
|
35
|
+
// painted from the lowest blade to the highest, each one over the top of the one below it
|
|
36
|
+
for (int i = 0; i < 10; i++) {
|
|
37
|
+
float k = float(i) / (n - 1.0);
|
|
38
|
+
if (k < 1.0001) {
|
|
39
|
+
float v = mix(vel.x, vel.y, k);
|
|
40
|
+
// the blades ride on arms, so the fast ones tilt a little, and their travel blurs their edges
|
|
41
|
+
float d = uv.y - mix(pos.x, pos.y, k) + tilt * 0.1 * v * x;
|
|
42
|
+
// contact shadow cast on what lies just below the leading edge
|
|
43
|
+
float aa = 0.002 + 0.005 * v;
|
|
44
|
+
float sh = (1.0 - smoothstep(0.0, 0.03 + 0.012 * v, -d)) * (1.0 - smoothstep(-aa, aa, d));
|
|
45
|
+
col.rgb *= 1.0 - 0.65 * color.a * sh * sh;
|
|
46
|
+
// matte metal, slightly curved: lighter toward the leading edge, which ends in a bright
|
|
47
|
+
// rolled lip, darker toward the top where it slides under the next blade, with a sheen
|
|
48
|
+
// that crosses each blade as it passes the light
|
|
49
|
+
float l = clamp(d / h, 0.0, 1.0);
|
|
50
|
+
float lip = smoothstep(0.003, 0.007, d) * (1.0 - smoothstep(0.007, 0.014, d));
|
|
51
|
+
float s = (uv.y - d - 0.55 + 0.3 * x) * 2.5;
|
|
52
|
+
float sheen = 0.3 * exp(-s * s) * (1.0 - l) * (1.0 - l);
|
|
53
|
+
vec3 metal = color.rgb * (1.3 - 0.75 * l) + (0.25 * lip + sheen) * (0.6 + 0.4 * color.rgb) * color.a;
|
|
54
|
+
metal *= 0.4 + 0.6 * smoothstep(0.0, 0.005, d);
|
|
55
|
+
float cover = smoothstep(-aa, aa, d) * (1.0 - smoothstep(h - aa, h + aa, d));
|
|
56
|
+
col = mix(col, vec4(clamp(metal, 0.0, 1.0), color.a), cover);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// the camera's gate frames the image while the shutter fires
|
|
60
|
+
float g = gate * smoothstep(0.0, 0.12, progress) * (1.0 - smoothstep(0.88, 1.0, progress));
|
|
61
|
+
vec2 c = abs(uv - 0.5) * vec2(ratio, 1.0) - vec2(0.5 * ratio, 0.5) + 1.5 * g;
|
|
62
|
+
float e = length(max(c, 0.0)) + min(max(c.x, c.y), 0.0) - 0.5 * g;
|
|
63
|
+
float on = smoothstep(0.0, 0.002, gate) * smoothstep(0.0, 0.04, progress) * (1.0 - smoothstep(0.96, 1.0, progress));
|
|
64
|
+
// it shades the image along its inner edge
|
|
65
|
+
col.rgb *= 1.0 - 0.5 * color.a * on * smoothstep(-0.4 * g - 0.001, 0.0, e);
|
|
66
|
+
vec3 housing = min(color.rgb * (1.5 - smoothstep(0.0, 0.2 * g + 0.001, e)), 1.0);
|
|
67
|
+
return mix(col, vec4(housing, color.a), on * smoothstep(-0.002, 0.002, e));
|
|
68
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// StopMotion — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/StopMotion.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The outgoing image is a paper cutout that jerks off the frame in choppy stop-motion steps, with a tiny new tilt and offset each step and a drop shadow, while the incoming cutout jerks in the same way and lands
|
|
5
|
+
// Tags: stop-motion, paper, cutout, slide, shadow, choppy
|
|
6
|
+
|
|
7
|
+
// @range(6, 30, 1) Number of held poses during the transition: fewer is choppier
|
|
8
|
+
uniform int steps; // = 12
|
|
9
|
+
// @range(0, 1) Size of the small random tilt and offset given to the cutouts at each step
|
|
10
|
+
uniform float jitter; // = 0.5
|
|
11
|
+
// @range(0, 1) Darkness of the drop shadow the cutouts cast
|
|
12
|
+
uniform float shadow; // = 0.5
|
|
13
|
+
// @color Color of the background behind the cutouts
|
|
14
|
+
uniform vec4 backColor; // = vec4(0.80, 0.71, 0.56, 1.0)
|
|
15
|
+
// @color Color of the paper rim around the cutouts
|
|
16
|
+
uniform vec4 rimColor; // = vec4(0.97, 0.96, 0.93, 1.0)
|
|
17
|
+
|
|
18
|
+
const float SHRINK = 0.2; // how much smaller the cutouts are than the frame while they move
|
|
19
|
+
const float RIM = 0.012; // width of the paper rim around the cutouts, in frame heights
|
|
20
|
+
const float RADIUS = 0.006; // corner radius of the cutouts, in frame heights
|
|
21
|
+
const float AA = 0.0015; // width of the antialiased edges, in frame heights
|
|
22
|
+
|
|
23
|
+
// Hoskins' hash of an integer step
|
|
24
|
+
float hash11(float p) {
|
|
25
|
+
p = fract(p * 0.1031);
|
|
26
|
+
p *= p + 33.33;
|
|
27
|
+
p *= p + p;
|
|
28
|
+
return fract(p);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// signed distance to a rounded box of half size b and corner radius r
|
|
32
|
+
float roundedBox(vec2 q, vec2 b, float r) {
|
|
33
|
+
vec2 d = abs(q) - b + r;
|
|
34
|
+
return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0) - r;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
vec4 premultiply(vec4 c) {
|
|
38
|
+
return vec4(c.rgb * c.a, c.a);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// distance from the center far enough for a cutout of half size h turned by a, and its shadow, to be out of the frame
|
|
42
|
+
float offFrame(vec2 h, float a) {
|
|
43
|
+
return 0.5 * ratio + abs(cos(a)) * h.x + abs(sin(a)) * h.y + 0.08;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// half size of a cutout scaled by s, with its rim for the lift l
|
|
47
|
+
vec2 cutoutSize(float s, float l) {
|
|
48
|
+
return (0.5 * vec2(ratio, 1.0) + RIM * l) * s;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// draws over col (premultiplied) a cutout of the outgoing or incoming image, centered at c, turned by a, scaled by s, lifted by l
|
|
52
|
+
vec4 drawCutout(vec4 col, vec2 q, vec2 c, float a, float s, float l, bool incoming) {
|
|
53
|
+
vec2 asp = vec2(ratio, 1.0);
|
|
54
|
+
vec2 halfImage = 0.5 * asp;
|
|
55
|
+
vec2 halfCut = halfImage + RIM * l;
|
|
56
|
+
float rad = RADIUS * l;
|
|
57
|
+
float ca = cos(a), sa = sin(a);
|
|
58
|
+
mat2 unrotate = mat2(ca, -sa, sa, ca);
|
|
59
|
+
|
|
60
|
+
// the drop shadow, cast down and to the right, softer and further as the cutout is lifted,
|
|
61
|
+
// as dark as the image casting it is opaque
|
|
62
|
+
vec2 rs = unrotate * (q - c - vec2(0.018, -0.026) * l) / s;
|
|
63
|
+
vec2 ss = clamp(rs / asp + 0.5, 0.0, 1.0);
|
|
64
|
+
float sAlpha = max(incoming ? getToColor(ss).a : getFromColor(ss).a, rimColor.a);
|
|
65
|
+
float ds = roundedBox(rs, halfCut, rad) * s;
|
|
66
|
+
float blur = 0.004 + 0.016 * l;
|
|
67
|
+
col.rgb *= 1.0 - clamp(shadow, 0.0, 1.0) * 0.75 * l * sAlpha * (1.0 - smoothstep(-blur, blur, ds));
|
|
68
|
+
|
|
69
|
+
vec2 r = unrotate * (q - c) / s;
|
|
70
|
+
float dCut = roundedBox(r, halfCut, rad) * s;
|
|
71
|
+
float dImage = roundedBox(r, halfImage, 0.0) * s;
|
|
72
|
+
float cutCover = clamp(0.5 - dCut / AA, 0.0, 1.0);
|
|
73
|
+
float imageCover = clamp(0.5 - dImage / AA, 0.0, 1.0);
|
|
74
|
+
vec2 st = clamp(r / asp + 0.5, 0.0, 1.0);
|
|
75
|
+
vec4 img = premultiply(incoming ? getToColor(st) : getFromColor(st));
|
|
76
|
+
// the image on its paper rim, laid over what is below
|
|
77
|
+
vec4 cut = mix(premultiply(rimColor), img, imageCover) * cutCover;
|
|
78
|
+
return cut + col * (1.0 - cut.a);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
vec4 transition(vec2 uv) {
|
|
82
|
+
float n = float(steps < 2 ? 2 : steps);
|
|
83
|
+
// the pose held at this time: the first and last are the full images, held half a step each
|
|
84
|
+
float k = floor(progress * n + 0.5);
|
|
85
|
+
if (k <= 0.0) return getFromColor(uv);
|
|
86
|
+
if (k >= n) return getToColor(uv);
|
|
87
|
+
|
|
88
|
+
vec2 q = (uv - 0.5) * vec2(ratio, 1.0);
|
|
89
|
+
float j = clamp(jitter, 0.0, 1.0);
|
|
90
|
+
|
|
91
|
+
// the outgoing cutout is picked up off the frame in two poses, then jerked out to the left, faster and faster
|
|
92
|
+
float l0 = min(k / 2.0, 1.0);
|
|
93
|
+
float m0 = clamp((k - 1.0) / (0.45 * n), 0.0, 1.0);
|
|
94
|
+
m0 = m0 * m0 * (0.4 + 0.6 * m0);
|
|
95
|
+
float s0 = 1.0 - SHRINK * l0;
|
|
96
|
+
float a0 = 0.22 * m0 + l0 * j * 0.2 * (hash11(k) - 0.5);
|
|
97
|
+
vec2 c0 = vec2(-offFrame(cutoutSize(s0, l0), a0) * m0, 0.05 * m0 * m0)
|
|
98
|
+
+ l0 * j * vec2(0.07 * (hash11(k + 100.0) - 0.5), 0.05 * (hash11(k + 200.0) - 0.5));
|
|
99
|
+
|
|
100
|
+
// the incoming cutout is jerked in from the right, slowing down, then laid flat onto the frame in two poses
|
|
101
|
+
float l1 = min((n - k) / 2.0, 1.0);
|
|
102
|
+
float m1 = clamp((n - 2.0 - k) / (0.45 * n), 0.0, 1.0);
|
|
103
|
+
m1 = m1 * m1 * (0.4 + 0.6 * m1);
|
|
104
|
+
float s1 = 1.0 - SHRINK * l1;
|
|
105
|
+
float a1 = -0.25 * m1 + l1 * j * 0.2 * (hash11(k + 300.0) - 0.5);
|
|
106
|
+
vec2 c1 = vec2(offFrame(cutoutSize(s1, l1), a1) * m1, -0.06 * m1 * m1)
|
|
107
|
+
+ l1 * j * vec2(0.07 * (hash11(k + 400.0) - 0.5), 0.05 * (hash11(k + 500.0) - 0.5));
|
|
108
|
+
|
|
109
|
+
// the background, then the outgoing cutout, then the incoming one on top
|
|
110
|
+
vec4 col = premultiply(backColor);
|
|
111
|
+
if (m0 < 1.0) col = drawCutout(col, q, c0, a0, s0, l0, false);
|
|
112
|
+
if (m1 < 1.0) col = drawCutout(col, q, c1, a1, s1, l1, true);
|
|
113
|
+
if (col.a <= 0.0) return vec4(0.0);
|
|
114
|
+
col.rgb /= col.a;
|
|
115
|
+
// the light dims a little from one shot to the next
|
|
116
|
+
col.rgb *= 1.0 - 0.04 * j * hash11(k + 600.0);
|
|
117
|
+
return col;
|
|
118
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Vaporize — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/Vaporize.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The outgoing image goes up in smoke: from one side, the picture itself turns to vapour that rises over what is still intact, curls into wisps and pales as it thins out, revealing the incoming image underneath
|
|
5
|
+
// Tags: smoke, organic, noise, directional, reveal
|
|
6
|
+
|
|
7
|
+
// @param Direction the vapour rises toward (the image starts turning to vapour on the opposite side)
|
|
8
|
+
uniform vec2 direction; // = vec2(0.0, 1.0)
|
|
9
|
+
// @range(0.1, 0.6) How high the vapour rises above the image before it is gone, in frame heights
|
|
10
|
+
uniform float rise; // = 0.4
|
|
11
|
+
// @range(0, 1) How much the vapour swirls and curls as it rises
|
|
12
|
+
uniform float swirl; // = 0.6
|
|
13
|
+
// @color Color the vapour pales to as it thins out
|
|
14
|
+
uniform vec4 color; // = vec4(0.92, 0.92, 0.94, 1.0)
|
|
15
|
+
|
|
16
|
+
// raggedness of the line where the image turns to vapour, and the width over which it dissolves
|
|
17
|
+
const float RAGGED = 0.09;
|
|
18
|
+
const float BAND = 0.12;
|
|
19
|
+
// how long the vapour lives, as a part of the transition
|
|
20
|
+
const float LIFE = 0.16;
|
|
21
|
+
const int TAPS = 6;
|
|
22
|
+
|
|
23
|
+
float hash12(vec2 p) {
|
|
24
|
+
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
|
|
25
|
+
p3 += dot(p3, p3.yzx + 33.33);
|
|
26
|
+
return fract((p3.x + p3.y) * p3.z);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
float vnoise(vec2 p) {
|
|
30
|
+
vec2 i = floor(p);
|
|
31
|
+
vec2 f = fract(p);
|
|
32
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
33
|
+
return mix(
|
|
34
|
+
mix(hash12(i), hash12(i + vec2(1.0, 0.0)), f.x),
|
|
35
|
+
mix(hash12(i + vec2(0.0, 1.0)), hash12(i + vec2(1.0, 1.0)), f.x),
|
|
36
|
+
f.y
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
float fbm(vec2 p) {
|
|
41
|
+
return 0.55 * vnoise(p) + 0.3 * vnoise(p * 2.03 + 5.1) + 0.15 * vnoise(p * 4.1 + 9.7);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// a swirling flow without sources or sinks: the curl of a noise field
|
|
45
|
+
vec2 curl(vec2 p) {
|
|
46
|
+
float e = 0.1;
|
|
47
|
+
float n = vnoise(p);
|
|
48
|
+
float nx = vnoise(p + vec2(e, 0.0));
|
|
49
|
+
float ny = vnoise(p + vec2(0.0, e));
|
|
50
|
+
return vec2(ny - n, n - nx) / e;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// where the line is at time t, as a part of its way across: quicker through the margins
|
|
54
|
+
// outside the frame, slower across it
|
|
55
|
+
float sweep(float t) {
|
|
56
|
+
return t + 0.6 * t * (1.0 - t) * (1.0 - 2.0 * t);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
vec2 mirror(vec2 v) {
|
|
60
|
+
return 1.0 - abs(1.0 - mod(v, 2.0));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
vec4 transition(vec2 uv) {
|
|
64
|
+
vec2 dir = length(direction) > 0.0 ? normalize(direction) : vec2(0.0, 1.0);
|
|
65
|
+
vec2 side = vec2(-dir.y, dir.x);
|
|
66
|
+
vec2 q = (uv - 0.5) * vec2(ratio, 1.0);
|
|
67
|
+
float along = dot(q, dir);
|
|
68
|
+
float across = dot(q, side);
|
|
69
|
+
float ext = 0.5 * (abs(dir.x) * ratio + abs(dir.y));
|
|
70
|
+
|
|
71
|
+
// the line where the image turns to vapour sweeps across the frame, ragged
|
|
72
|
+
float ragged = RAGGED * (2.0 * fbm(q * 2.5 + 1.3) - 1.0);
|
|
73
|
+
float start = -ext - RAGGED;
|
|
74
|
+
float travel = 2.0 * ext + 2.0 * RAGGED + BAND;
|
|
75
|
+
float front = start + travel * sweep(progress) + ragged;
|
|
76
|
+
|
|
77
|
+
// under the vapour: the outgoing image where it is still intact, dissolving into the
|
|
78
|
+
// incoming one just behind the line
|
|
79
|
+
float gone = smoothstep(0.0, BAND, front - along);
|
|
80
|
+
vec4 base = mix(getFromColor(uv), getToColor(uv), gone);
|
|
81
|
+
|
|
82
|
+
// the vapour above the line: the higher it is, the longer ago it left the image
|
|
83
|
+
float height = max(rise, 0.05) * (0.7 + 0.6 * vnoise(vec2(across * 3.0 + 2.7, 0.5)));
|
|
84
|
+
float age = (along - front) / height;
|
|
85
|
+
float released = progress - age * LIFE;
|
|
86
|
+
if (age <= 0.0 || age >= 1.0 || released <= 0.0) return base;
|
|
87
|
+
|
|
88
|
+
// where it came from: the line, back when it was released
|
|
89
|
+
float origin = start + travel * sweep(released) + ragged;
|
|
90
|
+
vec2 org = q - dir * (along - origin);
|
|
91
|
+
|
|
92
|
+
// it swirls and curls as it rises
|
|
93
|
+
vec2 sw = curl(org * 3.0 + dir * progress * 1.5) * (swirl * 0.08 * sqrt(age));
|
|
94
|
+
vec2 src = org - sw;
|
|
95
|
+
|
|
96
|
+
// and spreads out sideways, blurring as it rises
|
|
97
|
+
vec2 spreadOut = (side * 0.07 + dir * 0.02) * sqrt(age);
|
|
98
|
+
vec4 c = vec4(0.0);
|
|
99
|
+
for (int i = 0; i < TAPS; i++) {
|
|
100
|
+
float t = float(i) / float(TAPS - 1) - 0.5;
|
|
101
|
+
vec4 img = getFromColor(mirror((src + spreadOut * t) / vec2(ratio, 1.0) + 0.5));
|
|
102
|
+
c += vec4(img.rgb * img.a, img.a);
|
|
103
|
+
}
|
|
104
|
+
c = c.a > 0.0 ? vec4(c.rgb / c.a, c.a / float(TAPS)) : vec4(0.0);
|
|
105
|
+
|
|
106
|
+
// it breaks up into wisps that rise with it and thin out: thin parts go first
|
|
107
|
+
vec2 wq = (q - 0.6 * sw - dir * (progress * 2.5)) * 4.0;
|
|
108
|
+
float w = fbm(vec2(dot(wq, side), dot(wq, dir) * 0.6) + 2.0);
|
|
109
|
+
float density = smoothstep(1.2 * age - 0.2, 1.2 * age + 0.1, w);
|
|
110
|
+
density *= 1.0 - smoothstep(0.3, 1.0, age);
|
|
111
|
+
// (only the image turns to vapour, not what lies beyond its edge)
|
|
112
|
+
density *= smoothstep(-ext, -ext + 0.05, origin);
|
|
113
|
+
|
|
114
|
+
// it pales and loses its colour as it thins
|
|
115
|
+
float pale = smoothstep(0.0, 0.5, age);
|
|
116
|
+
float l = dot(c.rgb, vec3(0.299, 0.587, 0.114));
|
|
117
|
+
c = mix(c, vec4(mix(vec3(l), color.rgb, 0.7), c.a * color.a), pale * 0.85);
|
|
118
|
+
// the edges of the wisps catch the light
|
|
119
|
+
c.rgb = min(c.rgb + 0.12 * pale * density * (1.0 - density), vec3(1.0));
|
|
120
|
+
// laid over what is under it
|
|
121
|
+
float a = density * c.a;
|
|
122
|
+
float outA = a + base.a * (1.0 - a);
|
|
123
|
+
if (outA <= 0.0) return vec4(0.0);
|
|
124
|
+
return vec4((c.rgb * a + base.rgb * base.a * (1.0 - a)) / outA, outA);
|
|
125
|
+
}
|