gl-transitions 2.4.0 → 3.0.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.
Files changed (182) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +16 -1
  3. package/compatibility.json +251 -121
  4. package/gl-transitions.js +1 -1
  5. package/gl-transitions.json +1 -1
  6. package/glsl3/ArrowWipe.glsl +100 -0
  7. package/glsl3/BandWipe.glsl +67 -0
  8. package/glsl3/BlockSlide.glsl +87 -0
  9. package/glsl3/BowTie.glsl +1 -1
  10. package/glsl3/CellDissolve.glsl +91 -0
  11. package/glsl3/Crumple.glsl +173 -0
  12. package/glsl3/DirectionalWipe.glsl +1 -1
  13. package/glsl3/GlintDissolve.glsl +125 -0
  14. package/glsl3/HeatHaze.glsl +79 -0
  15. package/glsl3/Hologram.glsl +97 -0
  16. package/glsl3/InsetWipe.glsl +58 -0
  17. package/glsl3/LightningFlash.glsl +200 -0
  18. package/glsl3/LiquidFill.glsl +102 -0
  19. package/glsl3/PlasmaDissolve.glsl +51 -0
  20. package/glsl3/RingsWipe.glsl +106 -0
  21. package/glsl3/SawtoothWipe.glsl +73 -0
  22. package/glsl3/SnakeBlockWipe.glsl +40 -0
  23. package/glsl3/Snapshot.glsl +86 -0
  24. package/glsl3/Sphere.glsl +95 -0
  25. package/glsl3/SpiralBlockWipe.glsl +65 -0
  26. package/glsl3/Vortex.glsl +106 -0
  27. package/glsl3/WarpSpeed.glsl +120 -0
  28. package/index.js +1 -1
  29. package/layouts.json +846 -253
  30. package/llms-full.txt +665 -476
  31. package/llms.txt +197 -189
  32. package/msl/ArrowWipe.metal +391 -0
  33. package/msl/BandWipe.metal +353 -0
  34. package/msl/BlockSlide.metal +418 -0
  35. package/msl/BowTie.metal +1 -1
  36. package/msl/CellDissolve.metal +374 -0
  37. package/msl/Crumple.metal +766 -0
  38. package/msl/DirectionalWipe.metal +1 -1
  39. package/msl/GlintDissolve.metal +558 -0
  40. package/msl/HeatHaze.metal +320 -0
  41. package/msl/Hologram.metal +380 -0
  42. package/msl/InsetWipe.metal +232 -0
  43. package/msl/LightningFlash.metal +1038 -0
  44. package/msl/LiquidFill.metal +373 -0
  45. package/msl/PlasmaDissolve.metal +178 -0
  46. package/msl/RingsWipe.metal +437 -0
  47. package/msl/SawtoothWipe.metal +310 -0
  48. package/msl/SnakeBlockWipe.metal +216 -0
  49. package/msl/Snapshot.metal +321 -0
  50. package/msl/Sphere.metal +345 -0
  51. package/msl/SpiralBlockWipe.metal +281 -0
  52. package/msl/Vortex.metal +522 -0
  53. package/msl/WarpSpeed.metal +549 -0
  54. package/package.json +1 -1
  55. package/skills/gl-transitions/references/catalog.md +92 -59
  56. package/sksl/ArrowWipe.sksl +111 -0
  57. package/sksl/BandWipe.sksl +77 -0
  58. package/sksl/BlockSlide.sksl +99 -0
  59. package/sksl/BowTie.sksl +1 -1
  60. package/sksl/CellDissolve.sksl +103 -0
  61. package/sksl/Crumple.sksl +179 -0
  62. package/sksl/DirectionalWipe.sksl +1 -1
  63. package/sksl/GlintDissolve.sksl +136 -0
  64. package/sksl/HeatHaze.sksl +90 -0
  65. package/sksl/Hologram.sksl +108 -0
  66. package/sksl/InsetWipe.sksl +70 -0
  67. package/sksl/LightningFlash.sksl +202 -0
  68. package/sksl/LiquidFill.sksl +113 -0
  69. package/sksl/PlasmaDissolve.sksl +64 -0
  70. package/sksl/RingsWipe.sksl +115 -0
  71. package/sksl/SawtoothWipe.sksl +83 -0
  72. package/sksl/SnakeBlockWipe.sksl +53 -0
  73. package/sksl/Snapshot.sksl +98 -0
  74. package/sksl/Sphere.sksl +108 -0
  75. package/sksl/SpiralBlockWipe.sksl +76 -0
  76. package/sksl/Vortex.sksl +116 -0
  77. package/sksl/WarpSpeed.sksl +131 -0
  78. package/sksl/index.js +1 -1
  79. package/transitions/ArrowWipe.glsl +99 -0
  80. package/transitions/BandWipe.glsl +66 -0
  81. package/transitions/BlockSlide.glsl +86 -0
  82. package/transitions/BowTie.glsl +1 -1
  83. package/transitions/CellDissolve.glsl +90 -0
  84. package/transitions/Crumple.glsl +172 -0
  85. package/transitions/DirectionalWipe.glsl +1 -1
  86. package/transitions/GlintDissolve.glsl +124 -0
  87. package/transitions/HeatHaze.glsl +78 -0
  88. package/transitions/Hologram.glsl +96 -0
  89. package/transitions/InsetWipe.glsl +57 -0
  90. package/transitions/LightningFlash.glsl +199 -0
  91. package/transitions/LiquidFill.glsl +101 -0
  92. package/transitions/PlasmaDissolve.glsl +50 -0
  93. package/transitions/RingsWipe.glsl +105 -0
  94. package/transitions/SawtoothWipe.glsl +72 -0
  95. package/transitions/SnakeBlockWipe.glsl +39 -0
  96. package/transitions/Snapshot.glsl +85 -0
  97. package/transitions/Sphere.glsl +94 -0
  98. package/transitions/SpiralBlockWipe.glsl +64 -0
  99. package/transitions/Vortex.glsl +105 -0
  100. package/transitions/WarpSpeed.glsl +119 -0
  101. package/wgsl/ArrowWipe.wgsl +352 -0
  102. package/wgsl/BandWipe.wgsl +319 -0
  103. package/wgsl/BlockSlide.wgsl +384 -0
  104. package/wgsl/BowTie.wgsl +1 -1
  105. package/wgsl/CellDissolve.wgsl +323 -0
  106. package/wgsl/Crumple.wgsl +709 -0
  107. package/wgsl/DirectionalWipe.wgsl +1 -1
  108. package/wgsl/GlintDissolve.wgsl +519 -0
  109. package/wgsl/HeatHaze.wgsl +282 -0
  110. package/wgsl/Hologram.wgsl +339 -0
  111. package/wgsl/InsetWipe.wgsl +200 -0
  112. package/wgsl/LightningFlash.wgsl +964 -0
  113. package/wgsl/LiquidFill.wgsl +339 -0
  114. package/wgsl/PlasmaDissolve.wgsl +149 -0
  115. package/wgsl/RingsWipe.wgsl +394 -0
  116. package/wgsl/SawtoothWipe.wgsl +279 -0
  117. package/wgsl/SnakeBlockWipe.wgsl +188 -0
  118. package/wgsl/Snapshot.wgsl +287 -0
  119. package/wgsl/Sphere.wgsl +316 -0
  120. package/wgsl/SpiralBlockWipe.wgsl +250 -0
  121. package/wgsl/Vortex.wgsl +463 -0
  122. package/wgsl/WarpSpeed.wgsl +497 -0
  123. package/glsl3/BlockDissolve.glsl +0 -16
  124. package/glsl3/BowTieVertical.glsl +0 -117
  125. package/glsl3/Box.glsl +0 -33
  126. package/glsl3/LinearBlur.glsl +0 -30
  127. package/glsl3/MosaicBlend.glsl +0 -21
  128. package/glsl3/MosaicFade.glsl +0 -20
  129. package/glsl3/RotateFade.glsl +0 -22
  130. package/glsl3/ScaleIn.glsl +0 -18
  131. package/glsl3/WipeDown.glsl +0 -12
  132. package/glsl3/WipeLeft.glsl +0 -12
  133. package/glsl3/WipeRight.glsl +0 -12
  134. package/glsl3/WipeUp.glsl +0 -12
  135. package/msl/BlockDissolve.metal +0 -108
  136. package/msl/BowTieVertical.metal +0 -375
  137. package/msl/Box.metal +0 -204
  138. package/msl/LinearBlur.metal +0 -169
  139. package/msl/MosaicBlend.metal +0 -136
  140. package/msl/MosaicFade.metal +0 -137
  141. package/msl/RotateFade.metal +0 -116
  142. package/msl/ScaleIn.metal +0 -111
  143. package/msl/WipeDown.metal +0 -105
  144. package/msl/WipeLeft.metal +0 -105
  145. package/msl/WipeRight.metal +0 -105
  146. package/msl/WipeUp.metal +0 -105
  147. package/sksl/BlockDissolve.sksl +0 -29
  148. package/sksl/BowTieVertical.sksl +0 -130
  149. package/sksl/Box.sksl +0 -47
  150. package/sksl/LinearBlur.sksl +0 -44
  151. package/sksl/MosaicBlend.sksl +0 -34
  152. package/sksl/MosaicFade.sksl +0 -33
  153. package/sksl/RotateFade.sksl +0 -34
  154. package/sksl/ScaleIn.sksl +0 -32
  155. package/sksl/WipeDown.sksl +0 -26
  156. package/sksl/WipeLeft.sksl +0 -26
  157. package/sksl/WipeRight.sksl +0 -26
  158. package/sksl/WipeUp.sksl +0 -26
  159. package/transitions/BlockDissolve.glsl +0 -15
  160. package/transitions/BowTieVertical.glsl +0 -116
  161. package/transitions/Box.glsl +0 -32
  162. package/transitions/LinearBlur.glsl +0 -29
  163. package/transitions/MosaicBlend.glsl +0 -20
  164. package/transitions/MosaicFade.glsl +0 -19
  165. package/transitions/RotateFade.glsl +0 -21
  166. package/transitions/ScaleIn.glsl +0 -17
  167. package/transitions/WipeDown.glsl +0 -11
  168. package/transitions/WipeLeft.glsl +0 -11
  169. package/transitions/WipeRight.glsl +0 -11
  170. package/transitions/WipeUp.glsl +0 -11
  171. package/wgsl/BlockDissolve.wgsl +0 -78
  172. package/wgsl/BowTieVertical.wgsl +0 -331
  173. package/wgsl/Box.wgsl +0 -176
  174. package/wgsl/LinearBlur.wgsl +0 -131
  175. package/wgsl/MosaicBlend.wgsl +0 -108
  176. package/wgsl/MosaicFade.wgsl +0 -107
  177. package/wgsl/RotateFade.wgsl +0 -85
  178. package/wgsl/ScaleIn.wgsl +0 -79
  179. package/wgsl/WipeDown.wgsl +0 -77
  180. package/wgsl/WipeLeft.wgsl +0 -77
  181. package/wgsl/WipeRight.wgsl +0 -77
  182. package/wgsl/WipeUp.wgsl +0 -77
@@ -0,0 +1,99 @@
1
+ // Author: gre
2
+ // License: MIT
3
+ // Description: A notched arrowhead window onto the incoming image flies in from the edge behind it (or appears at the center), then swells until it fills the frame
4
+ // Tags: shape, wipe, arrow, chevron, directional
5
+
6
+ // @param Direction the arrow points and flies toward
7
+ uniform vec2 direction; // = vec2(1.0, 0.0)
8
+ // @range(0, 0.9) Depth of the notch at the back of the arrowhead (0 for a plain triangle)
9
+ uniform float notch; // = 0.4
10
+ // @range(20, 160) Opening angle of the arrowhead's tip, in degrees
11
+ uniform float width; // = 80.0
12
+ // @range(1, 3, 1) Number of nested chevrons flying in a row
13
+ uniform int count; // = 1
14
+ // @param Grow the arrow from the center of the frame instead of flying it in
15
+ uniform bool origin; // = false
16
+ // @range(0, 0.1) Softness of the arrow's edges
17
+ uniform float smoothness; // = 0.004
18
+
19
+ // Signed distance (in frame heights) to an arrowhead whose tip is at x = tip and whose notch
20
+ // reaches back to x = back, in the arrow's frame (x along the direction, y = |across|)
21
+ float arrow(vec2 q, float tip, float back, vec2 tipN, vec2 notchN) {
22
+ float front = dot(vec2(q.x - tip, q.y), tipN);
23
+ float rear = dot(vec2(back - q.x, -q.y), notchN);
24
+ return max(front, rear);
25
+ }
26
+
27
+ vec4 transition(vec2 uv) {
28
+ vec2 dir = length(direction) > 0.0 ? normalize(direction) : vec2(1.0, 0.0);
29
+ vec2 across = vec2(-dir.y, dir.x);
30
+ vec2 p = (uv - 0.5) * vec2(ratio, 1.0);
31
+ vec2 q = vec2(dot(p, dir), abs(dot(p, across)));
32
+
33
+ float s = max(smoothness, 0.001);
34
+ float n = clamp(notch, 0.0, 0.9);
35
+ float h = radians(0.5 * clamp(width, 20.0, 160.0));
36
+ float cot = cos(h) / sin(h);
37
+ // outward normals of the tip's edges and of the notch's edges
38
+ vec2 tipN = vec2(sin(h), cos(h));
39
+ float notchLen = length(vec2(1.0, n * cot));
40
+ vec2 notchN = vec2(1.0, n * cot) / notchLen;
41
+ // how far the tip must pass a point for the soft edge to clear it
42
+ float tipPad = s / sin(h);
43
+
44
+ // The frame's corners in the arrow's frame
45
+ vec2 c1 = vec2(0.5 * ratio, 0.5);
46
+ vec2 c2 = vec2(0.5 * ratio, -0.5);
47
+ vec2 k1 = vec2(abs(dot(c1, dir)), abs(dot(c1, across)));
48
+ vec2 k2 = vec2(abs(dot(c2, dir)), abs(dot(c2, across)));
49
+ // half extent of the frame along the direction, and where its back edge crosses the axis
50
+ float e = max(k1.x, k2.x);
51
+ float r = 0.5 / max(abs(dir.x) / ratio, abs(dir.y));
52
+ // To cover the frame, the tip must be ahead of every corner, and the notch behind every
53
+ // corner and behind the back edge's middle (with room for the soft edge)
54
+ float tipMin = max(k1.x + k1.y * cot, k2.x + k2.y * cot) + tipPad;
55
+ float notchMax = min(min(n * cot * k1.y - k1.x, n * cot * k2.y - k2.x), -r) - s * notchLen;
56
+
57
+ // The arrow (length 1 from tip to barbs) turns around the middle of its axis: its tip is
58
+ // half its body ahead of that point, its notch half its body behind
59
+ float body = 0.5 * (1.0 - n);
60
+ // The scale at which the arrow centered on the frame covers it
61
+ float cover = max(tipMin, -notchMax) / body;
62
+
63
+ float t = progress;
64
+ float o; // middle of the arrow
65
+ float l; // size of the arrow
66
+ if (origin) {
67
+ o = 0.0;
68
+ l = cover * t * (0.4 + 0.6 * t);
69
+ } else {
70
+ // while it flies, its larger side (length or span) is about the frame's smaller side
71
+ float l0 = 0.92 * min(1.0, ratio) / max(1.0, 2.0 * tan(h));
72
+ // starts just behind the frame, flies to the middle, then swells
73
+ float o0 = -e - 2.0 * tipPad - body * l0;
74
+ // it is already moving when it enters, and slows down as it starts to swell
75
+ float u = 1.0 - clamp(t / 0.65, 0.0, 1.0);
76
+ float fly = 1.0 - u * u * u;
77
+ // the swell speeds up and still moves at the end, so the last corners do not linger
78
+ float grow = clamp((t - 0.3) / 0.7, 0.0, 1.0);
79
+ o = mix(o0, 0.0, fly);
80
+ l = mix(l0, cover, grow * grow * (2.0 - grow));
81
+ }
82
+
83
+ // the nested chevrons follow the first one, each tucked behind the previous one's notch
84
+ float gap = (1.0 - n) * 1.35;
85
+ float d = arrow(q, o + body * l, o - body * l, tipN, notchN);
86
+ for (int i = 1; i < 3; i++) {
87
+ if (i < count) {
88
+ float back = o - float(i) * gap * l;
89
+ d = min(d, arrow(q, back + body * l, back - body * l, tipN, notchN));
90
+ }
91
+ }
92
+ // the soft edge slides from outside the arrow to inside it, so nothing shows at the start
93
+ float m = 1.0 - smoothstep(-s, s, d + 2.0 * s * (1.0 - t));
94
+
95
+ vec4 a = getFromColor(uv);
96
+ vec4 b = getToColor(uv);
97
+ vec4 c = mix(vec4(a.rgb * a.a, a.a), vec4(b.rgb * b.a, b.a), m);
98
+ return c.a > 0.0 ? vec4(c.rgb / c.a, c.a) : vec4(0.0);
99
+ }
@@ -0,0 +1,66 @@
1
+ // Author: gre
2
+ // License: MIT
3
+ // Description: Alternating bands wipe in from opposite sides together and interleave like fingers, while both images stay still
4
+ // Tags: wipe, stripes, interleave, horizontal
5
+
6
+ // @range(2, 40, 1) Number of bands
7
+ uniform int bands; // = 8
8
+ // @param Cut the frame into columns that wipe up and down instead of rows that wipe sideways
9
+ uniform bool vertical; // = false
10
+ // @range(0, 0.2) Softness of the bands' leading edges
11
+ uniform float smoothness; // = 0.02
12
+ // @range(0, 0.8) Delay between the first and the last band, so they cascade from the top (or the left)
13
+ uniform float stagger; // = 0.1
14
+
15
+ // half width of the antialiased edges, in frame heights
16
+ const float AA = 0.0015;
17
+
18
+ // how far band i has wiped in (0..1) at position a along the bands (0..l), alternate bands
19
+ // entering from opposite ends
20
+ float bandMask(float i, float n, float a, float l, float s) {
21
+ // each band takes the same time, starting a little after the one before it from the top
22
+ // (or the left)
23
+ float k = vertical ? i : n - 1.0 - i;
24
+ float g = clamp(stagger, 0.0, 0.95);
25
+ float t = clamp((progress - g * k / max(n - 1.0, 1.0)) / (1.0 - g), 0.0, 1.0);
26
+ t = mix(t, t * t * (3.0 - 2.0 * t), 0.5);
27
+ float x = mod(i, 2.0) > 0.5 ? l - a : a;
28
+ // the edge starts fully before the band and ends fully past it
29
+ float c = mix(-s, l + s, t);
30
+ return 1.0 - smoothstep(c - s, c + s, x);
31
+ }
32
+
33
+ vec4 transition(vec2 uv) {
34
+ if (progress <= 0.0) return getFromColor(uv);
35
+ if (progress >= 1.0) return getToColor(uv);
36
+
37
+ float n = float(bands < 1 ? 1 : bands);
38
+ // along: position along the bands, in frame heights; across: position across them (0..1)
39
+ float along = vertical ? uv.y : uv.x * ratio;
40
+ float across = vertical ? uv.x : uv.y;
41
+ float l = vertical ? 1.0 : ratio;
42
+ // the antialiasing across the bands, in units of across
43
+ float aaAcross = vertical ? AA / ratio : AA;
44
+ float s = max(smoothness, AA);
45
+
46
+ float f = across * n;
47
+ float i = clamp(floor(f), 0.0, n - 1.0);
48
+ float m = bandMask(i, n, along, l, s);
49
+
50
+ // near a cut between two bands, blend with the neighbor band over a pixel or so so the cut
51
+ // does not alias (at the frame's borders the neighbor is the band itself)
52
+ float fr = f - i;
53
+ float edge = min(fr, 1.0 - fr) / n;
54
+ if (edge < aaAcross) {
55
+ float j = clamp(fr < 0.5 ? i - 1.0 : i + 1.0, 0.0, n - 1.0);
56
+ m = mix(bandMask(j, n, along, l, s), m, 0.5 + 0.5 * smoothstep(0.0, aaAcross, edge));
57
+ }
58
+
59
+ if (m <= 0.0) return getFromColor(uv);
60
+ if (m >= 1.0) return getToColor(uv);
61
+ vec4 a = getFromColor(uv);
62
+ vec4 b = getToColor(uv);
63
+ // mixed premultiplied, so transparent images do not bleed their color
64
+ vec4 c = mix(vec4(a.rgb * a.a, a.a), vec4(b.rgb * b.a, b.a), m);
65
+ return c.a > 0.0 ? vec4(c.rgb / c.a, c.a) : vec4(0.0);
66
+ }
@@ -0,0 +1,86 @@
1
+ // Author: gre
2
+ // License: MIT
3
+ // Description: The frame is cut into a grid of blocks that slide out one after another in a staggered cascade, some of them shrinking as they go, while the blocks of the incoming image slide in behind them to take their place
4
+ // Tags: slide, blocks, grid, directional, zoom
5
+
6
+ // @param Number of blocks (columns, rows), at most 40 along the direction
7
+ uniform ivec2 grid; // = ivec2(5, 4)
8
+ // @param Direction the blocks slide toward (rounded to the nearest axis)
9
+ uniform vec2 direction; // = vec2(1.0, 0.0)
10
+ // @range(0, 0.95) Share of the transition over which the blocks set off one after another (0 slides them all together)
11
+ uniform float stagger; // = 0.6
12
+ // @range(0, 0.9) How much the zooming blocks shrink on their way, as a share of their size
13
+ uniform float zoom; // = 0.35
14
+ // @color Color seen in the gaps between the blocks
15
+ uniform vec4 background; // = vec4(0.0, 0.0, 0.0, 1.0)
16
+
17
+ // blocks per strip, at most
18
+ const int MAX_BLOCKS = 40;
19
+
20
+ float hash(vec2 p) {
21
+ vec3 p3 = fract(vec3(p.xyx) * 0.1031);
22
+ p3 += dot(p3, p3.yzx + 33.33);
23
+ return fract((p3.x + p3.y) * p3.z);
24
+ }
25
+
26
+ vec4 transition(vec2 uv) {
27
+ if (progress <= 0.0) return getFromColor(uv);
28
+ if (progress >= 1.0) return getToColor(uv);
29
+
30
+ bool vertical = abs(direction.y) > abs(direction.x);
31
+ bool backward = vertical ? direction.y < 0.0 : direction.x < 0.0;
32
+ vec2 g = max(vec2(grid), 1.0);
33
+ // a: position along the motion, toward which the blocks slide, b: across it
34
+ float a = vertical ? uv.y : uv.x;
35
+ float b = vertical ? uv.x : uv.y;
36
+ if (backward) a = 1.0 - a;
37
+ float n = min(vertical ? g.y : g.x, float(MAX_BLOCKS));
38
+ float strips = vertical ? g.x : g.y;
39
+ // every block of a strip slides along it, so a point can only show a block of its own strip
40
+ float r = min(floor(b * strips), strips - 1.0);
41
+ // the strips set off one after another, from the top (or the left)
42
+ float rowOrder = strips > 1.0 ? (vertical ? r : strips - 1.0 - r) / (strips - 1.0) : 0.0;
43
+ float st = clamp(stagger, 0.0, 0.95);
44
+ float z = clamp(zoom, 0.0, 0.9);
45
+ // in blocks
46
+ float an = a * n;
47
+ float bn = b * strips - r;
48
+
49
+ // the incoming blocks follow the last outgoing block to leave, the rear one: they all
50
+ // stay behind it, so no block ever overlaps another, and each one gets closer to the
51
+ // block ahead of it until they all arrive together
52
+ float rear = clamp((progress - st * mix(rowOrder, 1.0, 0.2)) / (1.0 - st), 0.0, 1.0);
53
+ rear = rear * rear * (3.0 - 2.0 * rear);
54
+
55
+ for (int k = 0; k < MAX_BLOCKS; k++) {
56
+ float i = float(k);
57
+ if (i >= n) break;
58
+ // the block at the front sets off first, so that the outgoing blocks move apart
59
+ float order = mix(rowOrder, n > 1.0 ? (n - 1.0 - i) / (n - 1.0) : 0.0, 0.2);
60
+ float p = clamp((progress - st * order) / (1.0 - st), 0.0, 1.0);
61
+ p = p * p * (3.0 - 2.0 * p);
62
+ float pin = max(0.0, 1.0 - (1.0 - rear) * (1.0 + (n - 1.0 - i) / n));
63
+ // about half of the blocks shrink as they leave, and their incoming blocks grow as they come
64
+ float zi = hash(vec2(i, r) + 3.7) < 0.5 ? z : 0.0;
65
+ // position in the block, from its corner, for the outgoing block (xy), which travels the
66
+ // frame's length to leave it, and the incoming one (zw), from one length behind; at rest,
67
+ // the blocks tile the frame exactly
68
+ float sFrom = 1.0 - zi * p * p;
69
+ float sTo = 1.0 - zi * (1.0 - pin) * (1.0 - pin);
70
+ vec4 l = vec4(
71
+ (an - i - p * n - 0.5 * (1.0 - sFrom)) / sFrom,
72
+ (bn - 0.5 * (1.0 - sFrom)) / sFrom,
73
+ (an - i - (pin - 1.0) * n - 0.5 * (1.0 - sTo)) / sTo,
74
+ (bn - 0.5 * (1.0 - sTo)) / sTo);
75
+ bool inFrom = all(greaterThanEqual(l.xy, vec2(0.0))) && all(lessThan(l.xy, vec2(1.0)));
76
+ bool inTo = all(greaterThanEqual(l.zw, vec2(0.0))) && all(lessThan(l.zw, vec2(1.0)));
77
+ if (inFrom || inTo) {
78
+ // back to the frame's coordinates
79
+ vec2 q = (vec2(i, r) + (inTo ? l.zw : l.xy)) / vec2(n, strips);
80
+ if (backward) q.x = 1.0 - q.x;
81
+ q = vertical ? q.yx : q;
82
+ return inTo ? getToColor(q) : getFromColor(q);
83
+ }
84
+ }
85
+ return background;
86
+ }
@@ -1,6 +1,6 @@
1
1
  // Author: KMojek
2
2
  // License: MIT
3
- // Description: A bow-tie wipe with an adjustable shape that can run in reverse
3
+ // Description: Two triangles grow from the top and bottom edges into a bow tie that reveals the incoming image, with an adjustable shape, and can run in reverse
4
4
  // Tags: wipe, shape
5
5
 
6
6
  uniform float adjust; // = 0.5
@@ -0,0 +1,90 @@
1
+ // Author: gre
2
+ // License: MIT
3
+ // Description: Irregular cells, like cracked mud or soap foam, switch to the incoming image one by one, with an optional bright border glowing along the cracks between them
4
+ // Tags: dissolve, cells, voronoi, random
5
+
6
+ // @range(1, 40) Number of cells across the height of the frame
7
+ uniform float cells; // = 8.0
8
+ // @range(0, 1) Duration of each cell's switch, as a fraction of the transition (0: each cell switches at once)
9
+ uniform float smoothness; // = 0.1
10
+ // @range(0, 0.05) Width of the border along the cell edges, in frame heights (0: no border)
11
+ uniform float border; // = 0.006
12
+ // @color Color of the border
13
+ uniform vec4 borderColor; // = vec4(1.0, 0.95, 0.8, 1.0)
14
+ // @param Random seed: another value gives other cells, switching in another order
15
+ uniform float seed; // = 0.0
16
+
17
+ // half width of the antialiased edges, in frame heights
18
+ const float AA = 0.0015;
19
+
20
+ vec2 hash22(vec2 p) {
21
+ vec3 p3 = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
22
+ p3 += dot(p3, p3.yzx + 33.33);
23
+ return fract((p3.xx + p3.yz) * p3.zy);
24
+ }
25
+
26
+ vec4 transition(vec2 uv) {
27
+ vec4 a = getFromColor(uv);
28
+ vec4 b = getToColor(uv);
29
+ if (progress <= 0.0) return a;
30
+ if (progress >= 1.0) return b;
31
+
32
+ float n = max(cells, 1.0);
33
+ // measured in square pixels, so the cells are not stretched
34
+ vec2 p = uv * vec2(ratio, 1.0) * n;
35
+ vec2 i = floor(p);
36
+ vec2 f = p - i;
37
+ vec2 offset = vec2(17.31, 41.97) * seed;
38
+
39
+ // nearest cell point
40
+ vec2 mg = vec2(0.0);
41
+ vec2 mr = vec2(0.0);
42
+ float md = 8.0;
43
+ for (int y = -1; y <= 1; y++) {
44
+ for (int x = -1; x <= 1; x++) {
45
+ vec2 g = vec2(float(x), float(y));
46
+ vec2 r = g + hash22(i + g + offset) - f;
47
+ float d = dot(r, r);
48
+ if (d < md) {
49
+ md = d;
50
+ mr = r;
51
+ mg = g;
52
+ }
53
+ }
54
+ }
55
+
56
+ // distance to the nearest cell edge: the bisector with the closest neighbor point,
57
+ // searched over 5x5 cells around the nearest one so that no edge is missed
58
+ float edge = 8.0;
59
+ for (int y = -2; y <= 2; y++) {
60
+ for (int x = -2; x <= 2; x++) {
61
+ vec2 g = mg + vec2(float(x), float(y));
62
+ vec2 r = g + hash22(i + g + offset) - f;
63
+ vec2 dr = r - mr;
64
+ if (dot(dr, dr) > 0.00001) {
65
+ edge = min(edge, dot(0.5 * (mr + r), normalize(dr)));
66
+ }
67
+ }
68
+ }
69
+ // in frame heights
70
+ edge /= n;
71
+
72
+ // the cell's own switch time, from its hash
73
+ float h = hash22(i + mg + offset + 97.13).x;
74
+ float w = clamp(smoothness, 0.0, 1.0);
75
+ float start = h * (1.0 - w);
76
+ float m = w > 0.0 ? smoothstep(start, start + w, progress) : step(start, progress);
77
+
78
+ // mixed premultiplied, so transparent images do not bleed their color
79
+ vec4 c = mix(vec4(a.rgb * a.a, a.a), vec4(b.rgb * b.a, b.a), m);
80
+
81
+ // the cracks open at the start and close at the end
82
+ float open = smoothstep(0.0, 0.2, progress) * (1.0 - smoothstep(0.8, 1.0, progress));
83
+ float bw = max(border, 0.0) * open;
84
+ if (bw > 0.0) {
85
+ float l = 1.0 - smoothstep(0.5 * bw - AA, 0.5 * bw + AA, edge);
86
+ float ba = borderColor.a * l * min(1.0, bw / (2.0 * AA));
87
+ c = vec4(borderColor.rgb * ba, ba) + c * (1.0 - ba);
88
+ }
89
+ return c.a > 0.0 ? vec4(c.rgb / c.a, c.a) : vec4(0.0);
90
+ }
@@ -0,0 +1,172 @@
1
+ // Author: gre
2
+ // License: MIT
3
+ // Description: The outgoing image crumples into a creased paper ball, shaded along its folds, which is then tossed away to reveal the incoming image
4
+ // Tags: paper, 3d, shrink, shadow
5
+
6
+ // @range(1, 32, 1) Number of folds creasing the paper
7
+ uniform int creases; // = 16
8
+ // @range(0.05, 0.4) Radius of the paper ball, relative to the image height
9
+ uniform float size; // = 0.2
10
+ // @param Direction the ball is tossed toward
11
+ uniform vec2 direction; // = vec2(1.0, 0.4)
12
+ // @color Color of the bare paper showing through the ink along the sharpest creases
13
+ uniform vec4 paper; // = vec4(0.96, 0.95, 0.91, 1.0)
14
+ // @color Color of the shadow cast on the incoming image
15
+ uniform vec4 shadow; // = vec4(0.0, 0.0, 0.0, 0.45)
16
+
17
+ const float PI = 3.14159265;
18
+
19
+ vec2 hash2(vec2 p) {
20
+ p = vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)));
21
+ return fract(sin(p) * 43758.5453);
22
+ }
23
+
24
+ mat2 rot(float a) {
25
+ float s = sin(a);
26
+ float c = cos(a);
27
+ return mat2(c, -s, s, c);
28
+ }
29
+
30
+ // distance from the center to the edge of the frame in the direction a (unit vector)
31
+ float frame(vec2 a) {
32
+ return min(0.5 * ratio / max(abs(a.x), 1e-4), 0.5 / max(abs(a.y), 1e-4));
33
+ }
34
+
35
+ // distance from the center to the edge of the paper in the direction a (unit vector):
36
+ // the frame shrinking and buckling while it crumples (c), turning into a lumpy ball (k)
37
+ float outline(vec2 a, float c, float k, float radius) {
38
+ float rect = frame(a);
39
+ float th = atan(a.y, a.x);
40
+ float buckle = 0.03 + 0.05 * abs(sin(4.0 * th + 0.7)) + 0.03 * abs(sin(9.0 * th + 2.0)) + 0.015 * abs(sin(23.0 * th + 1.3));
41
+ // the ball is a polygon with irregular corners
42
+ float i = floor((th / (2.0 * PI) + 0.5) * 9.0);
43
+ float a0 = i * 2.0 * PI / 9.0 - PI;
44
+ float a1 = a0 + 2.0 * PI / 9.0;
45
+ vec2 v0 = vec2(cos(a0), sin(a0)) * (0.78 + 0.27 * hash2(vec2(mod(i, 9.0), 3.0)).x);
46
+ vec2 v1 = vec2(cos(a1), sin(a1)) * (0.78 + 0.27 * hash2(vec2(mod(i + 1.0, 9.0), 3.0)).x);
47
+ vec2 e = v1 - v0;
48
+ float ball = radius * (v0.x * e.y - v0.y * e.x) / (a.x * e.y - a.y * e.x);
49
+ return mix(rect * mix(1.0, 0.75, c) * (1.0 - c * buckle), ball, k);
50
+ }
51
+
52
+ // n straight creases of random position, orientation and length, in a space where the
53
+ // paper spans about [-span, span]; each one tilts the paper on its two sides (a sharp ridge
54
+ // or valley between flat facets) and swallows a strip of the image. They come one after
55
+ // another as c grows; px is the half width of a crease line, in the units of x.
56
+ void fold(vec2 x, float seed, int n, vec2 span, float len, float c, float px, float weight,
57
+ inout vec2 grad, inout vec2 shift, inout float valley, inout float ridge) {
58
+ float tilt = 2.0 / sqrt(float(n));
59
+ for (int i = 0; i < 32; i++) {
60
+ if (i >= n) break;
61
+ float fi = float(i);
62
+ vec2 h = hash2(vec2(fi, seed));
63
+ vec2 g = hash2(vec2(fi, seed + 11.8));
64
+ vec2 o = (h - 0.5) * 2.0 * span;
65
+ vec2 nrm = vec2(cos(2.0 * PI * g.x), sin(2.0 * PI * g.x));
66
+ float d = dot(x - o, nrm);
67
+ float along = dot(x - o, vec2(-nrm.y, nrm.x));
68
+ float l = len * (0.5 + g.y);
69
+ float start = 0.4 * fi / float(n);
70
+ float act = weight * smoothstep(start, start + 0.3, c) * (1.0 - smoothstep(0.5 * l, l, abs(along)));
71
+ float amp = (h.x > 0.5 ? 1.0 : -1.0) * (0.5 + 0.5 * h.y);
72
+ float side = d / (abs(d) + px);
73
+ grad += act * amp * side * nrm * tilt;
74
+ shift += act * 0.03 * side * nrm;
75
+ float line = 1.0 - smoothstep(0.0, 2.0 * px, abs(d));
76
+ if (amp < 0.0) valley += act * line;
77
+ else ridge += act * line * amp;
78
+ }
79
+ }
80
+
81
+ vec4 transition(vec2 uv) {
82
+ if (progress <= 0.0) return getFromColor(uv);
83
+ vec4 b = getToColor(uv);
84
+ if (progress >= 1.0) return b;
85
+
86
+ // crumpling (c), balling up (k), then tossing (t)
87
+ float c = smoothstep(0.0, 0.6, progress);
88
+ float k = smoothstep(0.1, 0.62, progress);
89
+ float t = smoothstep(0.58, 1.0, progress);
90
+ t *= t;
91
+
92
+ vec2 dir = length(direction) > 0.0 ? normalize(direction) : vec2(1.0, 0.0);
93
+ float radius = max(size, 0.01) * mix(1.0, 0.6, t);
94
+ // far enough along the direction for the ball and its shadow (offset and blurred by up
95
+ // to about 0.09 each) to leave the frame
96
+ float reach = 0.5 * (abs(dir.x) * ratio + abs(dir.y)) + 1.2 * radius + 0.3;
97
+ float bend = dir.x < 0.0 ? -1.0 : 1.0;
98
+ vec2 center = dir * reach * t + vec2(-dir.y, dir.x) * 0.15 * bend * sin(PI * t);
99
+ float angle = 0.6 * c - 5.0 * bend * t;
100
+ // how high the paper is above the incoming image
101
+ float lift = 0.012 * c + 0.06 * t;
102
+
103
+ vec2 p = (uv - 0.5) * vec2(ratio, 1.0);
104
+
105
+ // soft shadow on the incoming image
106
+ vec2 sp = rot(angle) * (p - center - vec2(0.6, -1.0) * lift);
107
+ float sl = length(sp);
108
+ float sd = sl - outline(sl > 1e-5 ? sp / sl : vec2(1.0, 0.0), c, k, radius);
109
+ float blur = 0.005 + 1.2 * lift;
110
+ vec4 col = vec4(mix(b.rgb, shadow.rgb, shadow.a * c * (1.0 - smoothstep(-blur, blur, sd))), b.a);
111
+
112
+ vec2 q = rot(angle) * (p - center);
113
+ float l = length(q);
114
+ vec2 dq = l > 1e-5 ? q / l : vec2(1.0, 0.0);
115
+ float edge = outline(dq, c, k, radius);
116
+ // the edge (about a pixel at 300 px high) is antialiased only once the sheet has left the
117
+ // borders of the frame
118
+ float aa = 0.003 * smoothstep(0.0, 0.1, progress) + 1e-5;
119
+ float inside = 1.0 - smoothstep(-aa, aa, l - edge);
120
+ if (inside <= 0.0) return col;
121
+
122
+ // back onto the flat sheet: the outline is mapped onto the frame, the middle of the ball
123
+ // holds more of it, as if the edges were tucked under
124
+ float r = l / edge;
125
+ float rect = frame(dq);
126
+ vec2 s = dq * rect * mix(r, r * (0.6 + 0.4 * r), k);
127
+
128
+ // the creases of the sheet, then those of the ball, that crumpling adds over them
129
+ int count = creases < 1 ? 1 : creases;
130
+ vec2 grad = vec2(0.0);
131
+ vec2 shift = vec2(0.0);
132
+ float valley = 0.0;
133
+ float ridge = 0.0;
134
+ fold(s, 7.3, count, 0.45 * vec2(ratio, 1.0), 0.6, c, 0.003 * rect / edge, 1.0 - 0.8 * k, grad, shift, valley, ridge);
135
+ vec2 g2 = vec2(0.0);
136
+ vec2 s2 = vec2(0.0);
137
+ float v2 = 0.0;
138
+ float r2 = 0.0;
139
+ fold(q / radius, 2.9, count, vec2(0.7), 8.0, k, 0.003 / radius, k, g2, s2, v2, r2);
140
+ grad += g2 * 0.8;
141
+ vec2 piece = s + shift + s2 * 3.0;
142
+
143
+ // the facets over the volume of the ball, lit from the top left (the light does not turn
144
+ // with the ball)
145
+ float rr = clamp(l / (radius * 1.1), 0.0, 1.0);
146
+ vec3 sphere = vec3(q / (radius * 1.1) * k * 0.8, sqrt(1.0 - 0.64 * rr * rr * k));
147
+ vec3 n = normalize(sphere + vec3(grad, 0.0));
148
+ n.xy = rot(-angle) * n.xy;
149
+ vec3 light = normalize(vec3(-0.5, 0.6, 0.8));
150
+ float diffuse = max(dot(n, light), 0.0);
151
+ vec3 hv = normalize(light + vec3(0.0, 0.0, 1.0));
152
+ // only what facets add over the flat sheet
153
+ float spec = max(pow(max(dot(n, hv), 0.0), 20.0) - pow(hv.z, 20.0), 0.0);
154
+ float level = light.z;
155
+ float relief = min(2.0 * c, 1.0);
156
+ float shade = 1.0 + relief * ((0.12 + diffuse) / (0.12 + level) - 1.0) + 0.7 * spec * relief;
157
+ shade -= 0.2 * relief * min(valley, 1.0);
158
+ // occlusion toward the rim of the ball
159
+ shade *= 1.0 - 0.3 * k * smoothstep(0.6, 1.0, r);
160
+
161
+ // the edges of the sheet that the folds pull in are mirrored, as if folded back
162
+ vec2 f = piece / vec2(ratio, 1.0) + 0.5;
163
+ vec4 img = getFromColor(1.0 - abs(1.0 - mod(f, 2.0)));
164
+ // the ink cracks along the ridges
165
+ img.rgb = mix(img.rgb, paper.rgb, 0.6 * min(ridge, 1.0) * paper.a * c);
166
+ vec4 ball = vec4(img.rgb * shade, img.a);
167
+
168
+ // mixed premultiplied, so transparent images do not bleed their color
169
+ float m = inside * ball.a;
170
+ vec4 o = vec4(mix(col.rgb * col.a, ball.rgb, m), mix(col.a, 1.0, m));
171
+ return o.a > 0.0 ? vec4(o.rgb / o.a, o.a) : vec4(0.0);
172
+ }
@@ -1,6 +1,6 @@
1
1
  // Author: gre
2
2
  // License: MIT
3
- // Description: A soft-edged diagonal wipe
3
+ // Description: A straight wipe in any direction, diagonal and soft-edged by default; a smoothness of 0 gives a hard edge
4
4
  // Tags: wipe, directional
5
5
 
6
6
  // @param Direction of the wipe
@@ -0,0 +1,124 @@
1
+ // Author: gre
2
+ // License: MIT
3
+ // Description: The bright points of the outgoing image sparkle into crisp four-point star glints that swell and twinkle up to the cut, then shrink back into the highlights of the incoming image, which stays sharp
4
+ // Tags: light, glints, sparkle, dissolve
5
+
6
+ // @range(0.02, 0.3) Length of the longest rays of the glints at the peak, in frame heights
7
+ uniform float size; // = 0.15
8
+ // @range(0, 1) Brightness above which the image sparkles
9
+ uniform float threshold; // = 0.6
10
+ // @range(0, 4) Brightness of the glints
11
+ uniform float intensity; // = 2.0
12
+ // @param Add a shorter, softer pair of diagonal rays to each glint
13
+ uniform bool diagonals; // = false
14
+ // @range(-45, 45) Angle of the cross, in degrees
15
+ uniform float rotation; // = 0.0
16
+ // @range(0, 1) Rainbow fringes along the rays
17
+ uniform float rainbow; // = 0.35
18
+ // @color Tint of the glints, added as light
19
+ uniform vec3 tint; // = vec3(1.0, 0.95, 0.85)
20
+
21
+ // the long rays reach over this many cells of the glint grid
22
+ const float REACH = 6.0;
23
+
24
+ float hash12(vec2 v) {
25
+ vec3 v3 = fract(vec3(v.xyx) * 0.1031);
26
+ v3 += dot(v3, v3.yzx + 33.33);
27
+ return fract((v3.x + v3.y) * v3.z);
28
+ }
29
+
30
+ // one thin ray along x, from the glint center to its tip at x = len (in cells)
31
+ float ray(vec2 d, float len, float width) {
32
+ float a = abs(d.x) / len;
33
+ if (a >= 1.0) return 0.0;
34
+ float fall = (1.0 - a) * (1.0 - a);
35
+ float w = width * (1.0 - 0.7 * a);
36
+ return fall * exp(-d.y * d.y / (w * w));
37
+ }
38
+
39
+ vec3 spectrum(float a) {
40
+ return 0.5 + 0.5 * cos(6.2831853 * (a + vec3(0.0, 0.33, 0.67)));
41
+ }
42
+
43
+ vec4 transition(vec2 uv) {
44
+ float p = progress;
45
+ // the glints swell up to the cut, then shrink back: 0 at both ends
46
+ float t = 1.0 - abs(2.0 * p - 1.0);
47
+ float amount = t * (2.0 - t);
48
+ // a short crossfade under the glints at their brightest
49
+ float m = smoothstep(0.42, 0.58, p);
50
+ if (amount <= 0.0) return m < 0.5 ? getFromColor(uv) : getToColor(uv);
51
+
52
+ vec4 fromColor = getFromColor(uv);
53
+ vec4 toColor = getToColor(uv);
54
+ vec4 c = mix(vec4(fromColor.rgb * fromColor.a, fromColor.a), vec4(toColor.rgb * toColor.a, toColor.a), m);
55
+ if (c.a <= 0.0) return vec4(0.0);
56
+ vec3 base = c.rgb / c.a;
57
+
58
+ // a grid of glint cells, turned with the cross so that its long rays run along the rows and columns
59
+ float cell = size / REACH;
60
+ float ang = radians(rotation);
61
+ vec2 cs = vec2(cos(ang), sin(ang));
62
+ vec2 aspect = vec2(ratio, 1.0);
63
+ vec2 o = (uv - 0.5) * aspect;
64
+ vec2 q = vec2(o.x * cs.x + o.y * cs.y, o.y * cs.x - o.x * cs.y) / cell;
65
+ vec2 home = floor(q);
66
+ // thin rays, in cells, thin enough to vanish before the next row of cells
67
+ float width = min(0.0022 / cell, 0.07);
68
+
69
+ vec3 light = vec3(0.0);
70
+ // the glints of the own cell, of the cells along its row and column (whose long rays reach this
71
+ // pixel) and of its four diagonal neighbours (for their short diagonal rays and their cores)
72
+ for (int k = 0; k < 29; k++) {
73
+ float fk = float(k);
74
+ vec2 off = vec2(0.0);
75
+ if (k >= 1 && k <= 12) off = vec2(fk < 7.0 ? fk - 7.0 : fk - 6.0, 0.0);
76
+ else if (k >= 13 && k <= 24) off = vec2(0.0, fk < 19.0 ? fk - 19.0 : fk - 18.0);
77
+ else if (k >= 25) off = vec2(mod(fk, 2.0) * 2.0 - 1.0, fk < 27.0 ? -1.0 : 1.0);
78
+ // the rays are never longer than this, so farther glints cannot reach the pixel
79
+ if (max(abs(off.x), abs(off.y)) > REACH * amount + 1.0) continue;
80
+ vec2 id = home + off;
81
+ // only some of the cells hold a glint
82
+ if (hash12(id + 89.5) > 0.55) continue;
83
+ float h0 = hash12(id + 0.5);
84
+ float h1 = hash12(id + 19.5);
85
+ float h2 = hash12(id + 41.5);
86
+ float h3 = hash12(id + 67.5);
87
+ // the glint: somewhere in its cell, so that the grid never shows
88
+ vec2 center = id + 0.5 + 0.6 * (vec2(h0, h1) - 0.5);
89
+ vec2 cw = center * cell;
90
+ vec2 st = vec2(cw.x * cs.x - cw.y * cs.y, cw.x * cs.y + cw.y * cs.x) / aspect + 0.5;
91
+ if (st.x < 0.0 || st.x > 1.0 || st.y < 0.0 || st.y > 1.0) continue;
92
+ // each glint reads one image: it blinks out at its own moment of the crossfade and comes back
93
+ // on the incoming image
94
+ float turn = 0.15 + 0.7 * h3;
95
+ vec4 src = m < turn ? getFromColor(st) : getToColor(st);
96
+ float lum = dot(src.rgb, vec3(0.2126, 0.7152, 0.0722)) * src.a;
97
+ // the brighter the image, the more of its cells sparkle
98
+ float knee = threshold + 0.8 * (1.0 - threshold) * h2;
99
+ float b = smoothstep(knee, knee + 0.2 * (1.0 - threshold) + 1e-3, lum);
100
+ if (b <= 0.0) continue;
101
+ // each glint twinkles at its own pace
102
+ float twinkle = (0.6 + 0.4 * sin(6.2831853 * (h2 + (1.5 + h0) * p))) * smoothstep(0.0, 0.12, abs(m - turn));
103
+ float len = REACH * amount * (0.45 + 0.55 * b) * (0.3 + 0.7 * h1 * h1) * (0.85 + 0.15 * twinkle);
104
+ vec2 d = q - center;
105
+ float r = length(d);
106
+ float star = ray(d, len, width) + ray(d.yx, len, width);
107
+ if (diagonals) {
108
+ vec2 e = vec2(d.x + d.y, d.x - d.y) * 0.70710678;
109
+ star += 0.5 * (ray(e, 0.25 * len, width) + ray(e.yx, 0.25 * len, width));
110
+ }
111
+ // a bright core and a faint halo
112
+ float cr = r / (0.08 * len);
113
+ star += exp(-cr * cr) + 0.3 * exp(-r / 0.2);
114
+ // white light with the hue of the highlight, and rainbow fringes toward the tips
115
+ float along = r / len;
116
+ vec3 hue = mix(vec3(1.0), spectrum(1.3 * along + h0), rainbow * smoothstep(0.05, 0.4, along));
117
+ vec3 col = mix(src.rgb / max(max(src.r, max(src.g, src.b)), 1e-3), vec3(1.0), 0.6);
118
+ light += b * twinkle * star * hue * col;
119
+ }
120
+ light *= tint * intensity * amount * amount;
121
+ // compressed, so that crossing rays never flatten into white
122
+ light = 1.0 - exp(-light);
123
+ return vec4(clamp(base + light - base * light, 0.0, 1.0), c.a);
124
+ }