gl-transitions 3.0.0 → 3.2.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 +80 -0
- package/compatibility.json +455 -11
- package/gl-transitions.js +1 -1
- package/gl-transitions.json +1 -1
- package/glsl3/BookFlip.glsl +124 -21
- package/glsl3/CircleBurst.glsl +77 -0
- package/glsl3/Clothesline.glsl +217 -0
- package/glsl3/CodeRain.glsl +114 -0
- package/glsl3/ComicPanels.glsl +174 -0
- package/glsl3/Cube.glsl +105 -52
- package/glsl3/CurtainRise.glsl +71 -0
- package/glsl3/DominoFall.glsl +114 -0
- package/glsl3/Doorway.glsl +74 -38
- package/glsl3/Drape.glsl +186 -0
- package/glsl3/DuotoneFade.glsl +58 -0
- package/glsl3/FacetedGlass.glsl +137 -0
- package/glsl3/FrostWipe.glsl +176 -0
- package/glsl3/Funnel.glsl +71 -0
- package/glsl3/GlitterDissolve.glsl +171 -0
- package/glsl3/GravityLens.glsl +66 -0
- package/glsl3/GridFlip.glsl +151 -56
- package/glsl3/HeartWipe.glsl +71 -11
- package/glsl3/InsideCube.glsl +114 -0
- package/glsl3/KeyholeWipe.glsl +104 -0
- package/glsl3/LedWall.glsl +127 -0
- package/glsl3/MoireWipe.glsl +75 -0
- package/glsl3/PaperFold.glsl +168 -0
- package/glsl3/PuzzleCube.glsl +205 -0
- package/glsl3/RibbonTwist.glsl +53 -0
- package/glsl3/RingSpin.glsl +112 -0
- package/glsl3/Shatter.glsl +231 -35
- package/glsl3/SketchDissolve.glsl +100 -0
- package/glsl3/SlotReels.glsl +118 -0
- package/glsl3/SplitFlap.glsl +124 -0
- package/glsl3/SpotlightWipe.glsl +63 -0
- package/glsl3/Swirl.glsl +52 -21
- package/glsl3/TruchetWipe.glsl +80 -0
- package/glsl3/Tumble.glsl +113 -0
- package/glsl3/WaterDrop.glsl +69 -13
- package/glsl3/WaveWipe.glsl +154 -0
- package/index.js +1 -1
- package/layouts.json +1232 -29
- package/llms-full.txt +890 -403
- package/llms.txt +225 -197
- package/msl/BookFlip.metal +575 -114
- package/msl/CircleBurst.metal +351 -0
- package/msl/Clothesline.metal +828 -0
- package/msl/CodeRain.metal +451 -0
- package/msl/ComicPanels.metal +959 -0
- package/msl/Cube.metal +466 -170
- package/msl/CurtainRise.metal +263 -0
- package/msl/DominoFall.metal +510 -0
- package/msl/Doorway.metal +350 -124
- package/msl/Drape.metal +767 -0
- package/msl/DuotoneFade.metal +218 -0
- package/msl/FacetedGlass.metal +529 -0
- package/msl/FrostWipe.metal +677 -0
- package/msl/Funnel.metal +276 -0
- package/msl/GlitterDissolve.metal +637 -0
- package/msl/GravityLens.metal +236 -0
- package/msl/GridFlip.metal +548 -191
- package/msl/HeartWipe.metal +230 -58
- package/msl/InsideCube.metal +537 -0
- package/msl/KeyholeWipe.metal +370 -0
- package/msl/LedWall.metal +437 -0
- package/msl/MoireWipe.metal +252 -0
- package/msl/PaperFold.metal +762 -0
- package/msl/PuzzleCube.metal +1179 -0
- package/msl/RibbonTwist.metal +235 -0
- package/msl/RingSpin.metal +474 -0
- package/msl/Shatter.metal +1136 -160
- package/msl/SketchDissolve.metal +446 -0
- package/msl/SlotReels.metal +436 -0
- package/msl/SplitFlap.metal +589 -0
- package/msl/SpotlightWipe.metal +217 -0
- package/msl/Swirl.metal +144 -77
- package/msl/TruchetWipe.metal +285 -0
- package/msl/Tumble.metal +466 -0
- package/msl/WaterDrop.metal +258 -49
- package/msl/WaveWipe.metal +618 -0
- package/package.json +1 -1
- package/skills/gl-transitions/references/catalog.md +115 -57
- package/sksl/BookFlip.sksl +117 -20
- package/sksl/CircleBurst.sksl +84 -0
- package/sksl/Clothesline.sksl +217 -0
- package/sksl/CodeRain.sksl +124 -0
- package/sksl/ComicPanels.sksl +176 -0
- package/sksl/Cube.sksl +99 -46
- package/sksl/CurtainRise.sksl +84 -0
- package/sksl/DominoFall.sksl +122 -0
- package/sksl/Doorway.sksl +65 -35
- package/sksl/Drape.sksl +192 -0
- package/sksl/DuotoneFade.sksl +71 -0
- package/sksl/FacetedGlass.sksl +148 -0
- package/sksl/FrostWipe.sksl +183 -0
- package/sksl/Funnel.sksl +83 -0
- package/sksl/GlitterDissolve.sksl +175 -0
- package/sksl/GravityLens.sksl +77 -0
- package/sksl/GridFlip.sksl +141 -52
- package/sksl/HeartWipe.sksl +60 -11
- package/sksl/InsideCube.sksl +123 -0
- package/sksl/KeyholeWipe.sksl +109 -0
- package/sksl/LedWall.sksl +137 -0
- package/sksl/MoireWipe.sksl +85 -0
- package/sksl/PaperFold.sksl +170 -0
- package/sksl/PuzzleCube.sksl +203 -0
- package/sksl/RibbonTwist.sksl +66 -0
- package/sksl/RingSpin.sksl +121 -0
- package/sksl/Shatter.sksl +218 -33
- package/sksl/SketchDissolve.sksl +111 -0
- package/sksl/SlotReels.sksl +127 -0
- package/sksl/SplitFlap.sksl +131 -0
- package/sksl/SpotlightWipe.sksl +74 -0
- package/sksl/Swirl.sksl +49 -20
- package/sksl/TruchetWipe.sksl +92 -0
- package/sksl/Tumble.sksl +122 -0
- package/sksl/WaterDrop.sksl +64 -10
- package/sksl/WaveWipe.sksl +165 -0
- package/sksl/index.js +1 -1
- package/transitions/BookFlip.glsl +124 -21
- package/transitions/CircleBurst.glsl +76 -0
- package/transitions/Clothesline.glsl +216 -0
- package/transitions/CodeRain.glsl +113 -0
- package/transitions/ComicPanels.glsl +173 -0
- package/transitions/Cube.glsl +105 -52
- package/transitions/CurtainRise.glsl +70 -0
- package/transitions/DominoFall.glsl +113 -0
- package/transitions/Doorway.glsl +74 -38
- package/transitions/Drape.glsl +185 -0
- package/transitions/DuotoneFade.glsl +57 -0
- package/transitions/FacetedGlass.glsl +136 -0
- package/transitions/FrostWipe.glsl +175 -0
- package/transitions/Funnel.glsl +70 -0
- package/transitions/GlitterDissolve.glsl +170 -0
- package/transitions/GravityLens.glsl +65 -0
- package/transitions/GridFlip.glsl +151 -56
- package/transitions/HeartWipe.glsl +71 -11
- package/transitions/InsideCube.glsl +113 -0
- package/transitions/KeyholeWipe.glsl +103 -0
- package/transitions/LedWall.glsl +126 -0
- package/transitions/MoireWipe.glsl +74 -0
- package/transitions/PaperFold.glsl +167 -0
- package/transitions/PuzzleCube.glsl +204 -0
- package/transitions/RibbonTwist.glsl +52 -0
- package/transitions/RingSpin.glsl +111 -0
- package/transitions/Shatter.glsl +231 -35
- package/transitions/SketchDissolve.glsl +99 -0
- package/transitions/SlotReels.glsl +117 -0
- package/transitions/SplitFlap.glsl +123 -0
- package/transitions/SpotlightWipe.glsl +62 -0
- package/transitions/Swirl.glsl +52 -21
- package/transitions/TruchetWipe.glsl +79 -0
- package/transitions/Tumble.glsl +112 -0
- package/transitions/WaterDrop.glsl +69 -13
- package/transitions/WaveWipe.glsl +153 -0
- package/wgsl/BookFlip.wgsl +552 -105
- package/wgsl/CircleBurst.wgsl +310 -0
- package/wgsl/Clothesline.wgsl +756 -0
- package/wgsl/CodeRain.wgsl +415 -0
- package/wgsl/ComicPanels.wgsl +886 -0
- package/wgsl/Cube.wgsl +461 -156
- package/wgsl/CurtainRise.wgsl +235 -0
- package/wgsl/DominoFall.wgsl +461 -0
- package/wgsl/Doorway.wgsl +333 -117
- package/wgsl/Drape.wgsl +715 -0
- package/wgsl/DuotoneFade.wgsl +185 -0
- package/wgsl/FacetedGlass.wgsl +476 -0
- package/wgsl/FrostWipe.wgsl +617 -0
- package/wgsl/Funnel.wgsl +248 -0
- package/wgsl/GlitterDissolve.wgsl +582 -0
- package/wgsl/GravityLens.wgsl +206 -0
- package/wgsl/GridFlip.wgsl +523 -188
- package/wgsl/HeartWipe.wgsl +225 -55
- package/wgsl/InsideCube.wgsl +496 -0
- package/wgsl/KeyholeWipe.wgsl +337 -0
- package/wgsl/LedWall.wgsl +397 -0
- package/wgsl/MoireWipe.wgsl +222 -0
- package/wgsl/PaperFold.wgsl +700 -0
- package/wgsl/PuzzleCube.wgsl +1087 -0
- package/wgsl/RibbonTwist.wgsl +206 -0
- package/wgsl/RingSpin.wgsl +426 -0
- package/wgsl/Shatter.wgsl +1091 -148
- package/wgsl/SketchDissolve.wgsl +409 -0
- package/wgsl/SlotReels.wgsl +391 -0
- package/wgsl/SplitFlap.wgsl +533 -0
- package/wgsl/SpotlightWipe.wgsl +186 -0
- package/wgsl/Swirl.wgsl +138 -77
- package/wgsl/TruchetWipe.wgsl +255 -0
- package/wgsl/Tumble.wgsl +424 -0
- package/wgsl/WaterDrop.wgsl +251 -49
- package/wgsl/WaveWipe.wgsl +581 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Author: gre
|
|
2
|
+
// License: MIT
|
|
3
|
+
// Description: The frame becomes a split-flap board: in each cell the top half of the outgoing image flips down on a hinge across the middle, cell after cell, its back bringing the bottom half of the incoming image
|
|
4
|
+
// Tags: 3d, flip, grid
|
|
5
|
+
|
|
6
|
+
// @param Number of cells (columns, rows)
|
|
7
|
+
uniform ivec2 size; // = ivec2(8, 6)
|
|
8
|
+
// @range(0, 0.9) Delay of the last cell's flip, as a part of the transition
|
|
9
|
+
uniform float stagger; // = 0.6
|
|
10
|
+
// @range(0, 1) How much the order of the cells is shuffled, from a wave across the board to random
|
|
11
|
+
uniform float randomness; // = 0.3
|
|
12
|
+
// @range(1, 4, 1) Number of flaps that fall in each cell, the ones before the last showing other parts of the incoming image
|
|
13
|
+
uniform int flaps; // = 1
|
|
14
|
+
// @range(0, 0.05) Width of the gaps between the cells, as a part of the frame's shorter side (the hinges get half of it)
|
|
15
|
+
uniform float gap; // = 0.004
|
|
16
|
+
// @range(0, 1) Amount of perspective: the falling flaps grow as they come toward the viewer
|
|
17
|
+
uniform float perspective; // = 0.35
|
|
18
|
+
// @range(0, 1) How much the flaps darken as they turn away from the light, and the shadows they cast
|
|
19
|
+
uniform float shading; // = 0.4
|
|
20
|
+
// @color Color seen in the gaps between the cells
|
|
21
|
+
uniform vec4 background; // = vec4(0.0, 0.0, 0.0, 1.0)
|
|
22
|
+
|
|
23
|
+
const float PI = 3.141592653589793;
|
|
24
|
+
// width of the anti-aliased edges, as a part of the frame's shorter side
|
|
25
|
+
const float EDGE = 0.001;
|
|
26
|
+
|
|
27
|
+
float hash12(vec2 v) {
|
|
28
|
+
vec3 v3 = fract(vec3(v.xyx) * 0.1031);
|
|
29
|
+
v3 += dot(v3, v3.yzx + 33.33);
|
|
30
|
+
return fract((v3.x + v3.y) * v3.z);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// the cell's flip, 0 to 1
|
|
34
|
+
float cellTime(vec2 cell, vec2 grid) {
|
|
35
|
+
float wave = (cell.x + 0.5 * (grid.y - 1.0 - cell.y)) / max(grid.x - 1.0 + 0.5 * (grid.y - 1.0), 1.0);
|
|
36
|
+
float order = mix(wave, hash12(cell + 17.0), randomness);
|
|
37
|
+
float delay = clamp(stagger, 0.0, 0.99);
|
|
38
|
+
return clamp((progress - order * delay) / (1.0 - delay), 0.0, 1.0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// the card on the front of the falling flap, at the cell's flip t
|
|
42
|
+
float flapIndex(float t, float n) {
|
|
43
|
+
return min(floor(t * n), n - 1.0);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// the falling flap's angle, 0 upright to PI down: it starts gently and lands fast
|
|
47
|
+
float flapAngle(float t, float n) {
|
|
48
|
+
float u = t * n - flapIndex(t, n);
|
|
49
|
+
return PI * u * (0.3 + 0.7 * u);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// card i of a cell at the point lc of the card: the outgoing image first, the incoming one last,
|
|
53
|
+
// and in between the incoming image of another cell
|
|
54
|
+
vec4 card(float i, float n, vec2 cell, vec2 grid, vec2 lc) {
|
|
55
|
+
if (i < 0.5) return getFromColor((cell + lc) / grid);
|
|
56
|
+
vec2 src = cell;
|
|
57
|
+
if (i < n - 0.5) src = floor(vec2(hash12(cell * 3.7 + i * 11.3), hash12(cell * 5.3 + i * 7.9 + 1.7)) * grid);
|
|
58
|
+
return getToColor((src + lc) / grid);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// 1 inside a half card, 0 in the gaps: x across the card and f the distance from the hinge, in cell sizes
|
|
62
|
+
float cardMask(float x, float f, vec2 cellSize, float g) {
|
|
63
|
+
if (g <= 0.0) return 1.0;
|
|
64
|
+
float e = EDGE * min(1.0, g / max(gap, 1e-4));
|
|
65
|
+
// the gap at the hinge is half as wide as the one between the cells
|
|
66
|
+
float d = min(min(x, 1.0 - x) * cellSize.x, min(2.0 * f, 0.5 - f) * cellSize.y);
|
|
67
|
+
return smoothstep(0.5 * g - e, 0.5 * g + e, d);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
vec4 transition (vec2 uv) {
|
|
71
|
+
vec2 grid = max(vec2(size), 1.0);
|
|
72
|
+
float n = max(float(flaps), 1.0);
|
|
73
|
+
vec2 cellSize = vec2(ratio, 1.0) / grid / min(ratio, 1.0);
|
|
74
|
+
vec2 cell = floor(uv * grid);
|
|
75
|
+
vec2 l = uv * grid - cell;
|
|
76
|
+
// the gaps open at the start and close at the end
|
|
77
|
+
float g = gap * smoothstep(0.0, 0.12, progress) * (1.0 - smoothstep(0.88, 1.0, progress));
|
|
78
|
+
// w: height above the hinge, in cell heights
|
|
79
|
+
float w = l.y - 0.5;
|
|
80
|
+
bool upper = w >= 0.0;
|
|
81
|
+
|
|
82
|
+
// the board behind the falling flaps: the top half of the next card once the flap has left it,
|
|
83
|
+
// the bottom half of the current card until the flap has landed on it
|
|
84
|
+
float t = cellTime(cell, grid);
|
|
85
|
+
float k = flapIndex(t, n);
|
|
86
|
+
float a = flapAngle(t, n);
|
|
87
|
+
bool started = t * n > k;
|
|
88
|
+
bool landed = t >= 1.0;
|
|
89
|
+
vec4 color = card(k + (upper ? (started ? 1.0 : 0.0) : (landed ? 1.0 : 0.0)), n, cell, grid, l);
|
|
90
|
+
// shadows of the flap leaning over the top half, then falling onto the bottom half
|
|
91
|
+
if (started && !landed) color.rgb *= 1.0 - 0.45 * shading * max(upper ? cos(a) : -cos(a), 0.0);
|
|
92
|
+
color = mix(background, color, cardMask(l.x, abs(w), cellSize, g));
|
|
93
|
+
|
|
94
|
+
// the falling flaps of this cell and of its neighbors, which grow beyond their cells as they come closer
|
|
95
|
+
float nearest = -1.0;
|
|
96
|
+
for (int d = -1; d <= 1; d++) {
|
|
97
|
+
vec2 nc = cell + vec2(float(d), 0.0);
|
|
98
|
+
if (nc.x < 0.0 || nc.x > grid.x - 1.0) continue;
|
|
99
|
+
float nt = d == 0 ? t : cellTime(nc, grid);
|
|
100
|
+
float na = d == 0 ? a : flapAngle(nt, n);
|
|
101
|
+
float fc = cos(na);
|
|
102
|
+
float fs = sin(na);
|
|
103
|
+
// a point at distance f from the hinge is at height f * fc and depth f * fs, nearer points look wider
|
|
104
|
+
if (abs(fc) < 1e-5 || (w >= 0.0) != (fc > 0.0)) continue;
|
|
105
|
+
float f = w / fc;
|
|
106
|
+
if (f > 0.5) continue;
|
|
107
|
+
float z = f * fs;
|
|
108
|
+
if (z <= nearest) continue;
|
|
109
|
+
float lx = 0.5 + (l.x - float(d) - 0.5) * (1.0 - perspective * z);
|
|
110
|
+
if (lx < 0.0 || lx > 1.0) continue;
|
|
111
|
+
bool front = fc > 0.0;
|
|
112
|
+
vec2 lc = vec2(lx, front ? 0.5 + f : 0.5 - f);
|
|
113
|
+
float m = cardMask(lx, f, cellSize, g);
|
|
114
|
+
if (m <= 0.0) continue;
|
|
115
|
+
vec4 img = card(flapIndex(nt, n) + (front ? 0.0 : 1.0), n, nc, grid, lc);
|
|
116
|
+
// lit from above the viewer: the front darkens as it turns down, the back brightens as it lands
|
|
117
|
+
float lambert = (front ? 0.92 * fc - 0.4 * fs : 0.4 * fs - 0.92 * fc) / 0.92;
|
|
118
|
+
img.rgb *= mix(1.0 - shading, 1.0, clamp(lambert, 0.0, 1.0));
|
|
119
|
+
color = mix(color, img, m);
|
|
120
|
+
nearest = z;
|
|
121
|
+
}
|
|
122
|
+
return color;
|
|
123
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Author: gre
|
|
2
|
+
// License: MIT
|
|
3
|
+
// Description: The stage lights go down on the outgoing image and a soft oval spotlight searches across it along a curved path, comes to rest and lights the incoming image inside it, then widens until the stage lights come back up on the incoming image
|
|
4
|
+
// Tags: light, spotlight, stage, iris, reveal
|
|
5
|
+
|
|
6
|
+
// @param Point where the spotlight comes to rest and opens from
|
|
7
|
+
uniform vec2 center; // = vec2(0.5, 0.5)
|
|
8
|
+
// @range(0.08, 0.45) Width of the spotlight while it searches, in frame heights
|
|
9
|
+
uniform float size; // = 0.3
|
|
10
|
+
// @range(0, 1) How dark the stage gets around the spotlight
|
|
11
|
+
uniform float darkness; // = 0.85
|
|
12
|
+
// @color Tint of the spotlight
|
|
13
|
+
uniform vec3 warmth; // = vec3(1.0, 0.93, 0.8)
|
|
14
|
+
|
|
15
|
+
// height of the oval over its width: a cone of light hitting a stage seen at an angle
|
|
16
|
+
const float FLAT = 0.72;
|
|
17
|
+
// distance to the spotlight's center, in oval radii, inside which the incoming image is fully lit
|
|
18
|
+
const float LIT = 0.74;
|
|
19
|
+
|
|
20
|
+
// a point of the curved path the spotlight searches along, from the lower left to its resting point
|
|
21
|
+
vec2 path(float t, vec2 c) {
|
|
22
|
+
vec2 a = vec2(0.08, 0.3);
|
|
23
|
+
vec2 b = vec2(0.35, 1.15);
|
|
24
|
+
vec2 d = vec2(1.05, 0.95);
|
|
25
|
+
float s = 1.0 - t;
|
|
26
|
+
return s * s * s * a + 3.0 * s * s * t * b + 3.0 * s * t * t * d + t * t * t * c;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
vec4 transition(vec2 uv) {
|
|
30
|
+
vec2 asp = vec2(ratio, 1.0);
|
|
31
|
+
float p = progress;
|
|
32
|
+
|
|
33
|
+
// the spotlight slides along its path and eases to rest, its last few steps overlapping the start
|
|
34
|
+
// of its widening so the motion never stops
|
|
35
|
+
float t = clamp(p / 0.5, 0.0, 1.0);
|
|
36
|
+
t = t * t * (3.0 - 2.0 * t);
|
|
37
|
+
vec2 c = path(t, center);
|
|
38
|
+
|
|
39
|
+
// it widens until its lit core covers the farthest corner of the frame
|
|
40
|
+
vec2 far = max(center, 1.0 - center) * asp;
|
|
41
|
+
float full = length(vec2(far.x, far.y / FLAT)) / LIT;
|
|
42
|
+
float g = smoothstep(0.44, 1.0, p);
|
|
43
|
+
float radius = mix(0.5 * size, full, g * (0.3 + 0.7 * g));
|
|
44
|
+
|
|
45
|
+
// distance to the spotlight's center, 1 on the oval's edge
|
|
46
|
+
vec2 q = (uv - c) * asp;
|
|
47
|
+
float r = length(vec2(q.x, q.y / FLAT)) / radius;
|
|
48
|
+
|
|
49
|
+
// light of the spotlight: a flat core, a soft penumbra, a slightly brighter rim and a faint spill
|
|
50
|
+
float core = 1.0 - smoothstep(0.72, 1.08, r);
|
|
51
|
+
float ring = (r - 0.9) / 0.09;
|
|
52
|
+
float spot = max(core * (1.0 - 0.1 * r * r), 0.12 * (1.0 - smoothstep(0.9, 2.4, r))) + 0.16 * exp(-ring * ring);
|
|
53
|
+
|
|
54
|
+
// the stage lights go down at the start and come back up at the end
|
|
55
|
+
float s = darkness * smoothstep(0.0, 0.18, p) * (1.0 - smoothstep(0.72, 1.0, p));
|
|
56
|
+
vec3 light = 1.0 - s + s * spot * warmth;
|
|
57
|
+
|
|
58
|
+
// as it comes to rest, the spotlight lights the incoming image inside it
|
|
59
|
+
float lit = smoothstep(0.42, 0.58, p) * (1.0 - smoothstep(LIT, 1.0, r));
|
|
60
|
+
vec4 col = mix(getFromColor(uv), getToColor(uv), lit);
|
|
61
|
+
return vec4(col.rgb * light, col.a);
|
|
62
|
+
}
|
package/transitions/Swirl.glsl
CHANGED
|
@@ -1,33 +1,64 @@
|
|
|
1
1
|
// License: MIT
|
|
2
2
|
// Author: Sergey Kosarevsky
|
|
3
|
-
// Description:
|
|
3
|
+
// Description: The image twists into a round swirl around the center that peaks mid-way, where the outgoing image dissolves into the incoming one, then untwists
|
|
4
4
|
// Tags: swirl, rotate, blend
|
|
5
5
|
// ( http://www.linderdaum.com )
|
|
6
6
|
// ported by gre from https://gist.github.com/corporateshark/cacfedb8cca0f5ce3f7c
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
// @range(-3, 3) Turns of the swirl at its center at the peak (negative turns clockwise)
|
|
9
|
+
uniform float strength; // = 1.0
|
|
10
|
+
// @range(0.1, 2) Radius of the swirl, in frame heights
|
|
11
|
+
uniform float radius; // = 0.9
|
|
12
|
+
// Center of the swirl
|
|
13
|
+
uniform vec2 center; // = vec2(0.5, 0.5)
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
const float PI = 3.141592653589793;
|
|
16
|
+
const float TAU = 6.283185307179586;
|
|
17
|
+
// how much the swirl pulls the image toward its center at the peak
|
|
18
|
+
const float ZOOM = 0.12;
|
|
19
|
+
// spread of the motion blur, as a fraction of the swirl's speed
|
|
20
|
+
const float BLUR = 0.05;
|
|
21
|
+
const int TAPS = 12;
|
|
13
22
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
// fold the coordinates back into the frame, so the image stays filled without smearing its border
|
|
24
|
+
vec2 mirrored(vec2 v) {
|
|
25
|
+
vec2 m = mod(v, 2.0);
|
|
26
|
+
return mix(m, 2.0 - m, step(1.0, m));
|
|
27
|
+
}
|
|
17
28
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
UV += vec2( 0.5, 0.5 );
|
|
29
|
+
vec4 transition(vec2 uv) {
|
|
30
|
+
// the swirl eases in and out, and is exactly 0 at both ends
|
|
31
|
+
float s = sin(PI * progress);
|
|
32
|
+
float amount = s * s;
|
|
33
|
+
// its speed, used for the motion blur, also 0 at both ends
|
|
34
|
+
float speed = PI * sin(TAU * progress);
|
|
35
|
+
// the switch from the outgoing to the incoming image happens around the peak
|
|
36
|
+
float reveal = smoothstep(0.3, 0.7, progress);
|
|
28
37
|
|
|
29
|
-
|
|
30
|
-
|
|
38
|
+
// measured in frame heights, so the swirl is round
|
|
39
|
+
vec2 aspect = vec2(ratio, 1.0);
|
|
40
|
+
vec2 d = (uv - center) * aspect;
|
|
41
|
+
float x = clamp(length(d) / max(radius, 1e-3), 0.0, 1.0);
|
|
42
|
+
// the twist fades out smoothly toward the edge of the swirl
|
|
43
|
+
float falloff = (1.0 - x) * (1.0 - x);
|
|
44
|
+
float twist = strength * TAU * falloff;
|
|
45
|
+
float angle = twist * amount;
|
|
46
|
+
// capped so the blur taps never spread apart into visible streaks
|
|
47
|
+
float spread = clamp(twist * speed * BLUR, -1.2, 1.2);
|
|
48
|
+
// the swirl also slightly pulls the image toward its center
|
|
49
|
+
d *= 1.0 - ZOOM * amount * falloff;
|
|
31
50
|
|
|
32
|
-
|
|
51
|
+
vec4 col = vec4(0.0);
|
|
52
|
+
float total = 0.0;
|
|
53
|
+
for (int i = 0; i < TAPS; i++) {
|
|
54
|
+
float k = float(i) / float(TAPS - 1) - 0.5;
|
|
55
|
+
float w = 1.0 - abs(k);
|
|
56
|
+
float a = angle + spread * k;
|
|
57
|
+
float c = cos(a);
|
|
58
|
+
float sn = sin(a);
|
|
59
|
+
vec2 q = mirrored(center + vec2(c * d.x - sn * d.y, sn * d.x + c * d.y) / aspect);
|
|
60
|
+
col += mix(getFromColor(q), getToColor(q), reveal) * w;
|
|
61
|
+
total += w;
|
|
62
|
+
}
|
|
63
|
+
return col / total;
|
|
33
64
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Author: gre
|
|
2
|
+
// License: MIT
|
|
3
|
+
// Description: A grid of square tiles, each holding two quarter-circle arcs, links into long winding paths; starting from the middle and spreading outward, the paths are drawn as thin lines of the incoming image, then thicken into bands with a dark outline and a soft shadow until they merge over the whole frame
|
|
4
|
+
// Tags: truchet, pattern, tiles, paths, graphic, reveal
|
|
5
|
+
|
|
6
|
+
// @range(3, 20, 1) Number of tiles across the frame's height
|
|
7
|
+
uniform float cells; // = 8.0
|
|
8
|
+
// @range(0, 1) Strength of the dark outline and of the shadow along the bands
|
|
9
|
+
uniform float outline; // = 0.6
|
|
10
|
+
// @range(0, 1) How much the paths are staggered from the middle outward: 0 draws them all at once
|
|
11
|
+
uniform float spread; // = 0.75
|
|
12
|
+
|
|
13
|
+
// half width of the antialiased edges, in frame heights
|
|
14
|
+
const float AA = 0.0012;
|
|
15
|
+
// width of the outline, in frame heights
|
|
16
|
+
const float LINE = 0.003;
|
|
17
|
+
// how far the shadow reaches outside a band, in frame heights
|
|
18
|
+
const float SHADOW = 0.025;
|
|
19
|
+
// half width of the thin line a path is first drawn as, in tiles
|
|
20
|
+
const float STROKE = 0.08;
|
|
21
|
+
|
|
22
|
+
float hash12(vec2 v) {
|
|
23
|
+
vec3 v3 = fract(vec3(v.xyx) * 0.1031);
|
|
24
|
+
v3 += dot(v3, v3.yzx + 33.33);
|
|
25
|
+
return fract((v3.x + v3.y) * v3.z);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
float vnoise(vec2 v) {
|
|
29
|
+
vec2 i = floor(v);
|
|
30
|
+
vec2 f = fract(v);
|
|
31
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
32
|
+
return mix(
|
|
33
|
+
mix(hash12(i), hash12(i + vec2(1.0, 0.0)), f.x),
|
|
34
|
+
mix(hash12(i + vec2(0.0, 1.0)), hash12(i + vec2(1.0, 1.0)), f.x),
|
|
35
|
+
f.y
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
vec4 transition(vec2 uv) {
|
|
40
|
+
if (progress <= 0.0) return getFromColor(uv);
|
|
41
|
+
if (progress >= 1.0) return getToColor(uv);
|
|
42
|
+
|
|
43
|
+
float n = max(floor(cells + 0.5), 1.0);
|
|
44
|
+
// aspect-correct square tiles, centered on the frame
|
|
45
|
+
vec2 p = (uv - 0.5) * vec2(ratio, 1.0);
|
|
46
|
+
vec2 g = p * n + 0.5;
|
|
47
|
+
vec2 cell = floor(g);
|
|
48
|
+
vec2 q = fract(g);
|
|
49
|
+
// each tile is mirrored at random, so its two arcs (centered on opposite corners) link up with its neighbors' in two ways
|
|
50
|
+
if (hash12(cell + 17.0) > 0.5) q.x = 1.0 - q.x;
|
|
51
|
+
// distance to the nearest arc, in tiles: continuous across the tiles' edges, at most 0.5 (at the corners)
|
|
52
|
+
float d = min(abs(length(q) - 0.5), abs(length(q - 1.0) - 0.5));
|
|
53
|
+
|
|
54
|
+
// when the paths reach this point: from the middle outward, made irregular by a noise
|
|
55
|
+
float T = clamp(length(p) / (0.5 * length(vec2(ratio, 1.0))) + 0.4 * (vnoise(p * 3.0 + 4.0) - 0.5), 0.0, 1.0);
|
|
56
|
+
float lag = 0.8 * clamp(spread, 0.0, 1.0);
|
|
57
|
+
// every point is fully covered at progress 0.95
|
|
58
|
+
float s = clamp((progress - lag * T) / (0.95 - lag), 0.0, 1.0);
|
|
59
|
+
// in tiles: the paths are first drawn as thin lines, then the bands widen past the tiles' corners
|
|
60
|
+
float aa = AA * n;
|
|
61
|
+
float k = clamp((s - 0.25) / 0.75, 0.0, 1.0);
|
|
62
|
+
float w = STROKE * smoothstep(0.0, 0.3, s) + (0.5 + LINE * n + 3.0 * aa - STROKE) * k * k;
|
|
63
|
+
// signed distance to the edge of the bands (negative inside), in tiles
|
|
64
|
+
float e = d - w;
|
|
65
|
+
|
|
66
|
+
float band = 1.0 - smoothstep(-2.0 * aa, 0.0, e);
|
|
67
|
+
// outside the bands: a thin outline on their edge and a soft shadow, fading in with the line
|
|
68
|
+
float gap = max(e + aa, 0.0);
|
|
69
|
+
float fall = 1.0 - smoothstep(0.0, SHADOW * n, gap);
|
|
70
|
+
float edge = max(0.8 * (1.0 - smoothstep(LINE * n, LINE * n + 2.0 * aa, gap)), 0.4 * fall * fall);
|
|
71
|
+
float shade = clamp(outline, 0.0, 1.0) * smoothstep(0.0, STROKE, w) * edge;
|
|
72
|
+
|
|
73
|
+
vec4 a = getFromColor(uv);
|
|
74
|
+
a.rgb *= 1.0 - shade;
|
|
75
|
+
vec4 b = getToColor(uv);
|
|
76
|
+
// mixed premultiplied, so transparent images do not bleed their color
|
|
77
|
+
vec4 o = mix(vec4(a.rgb * a.a, a.a), vec4(b.rgb * b.a, b.a), band);
|
|
78
|
+
return o.a > 0.0 ? vec4(o.rgb / o.a, o.a) : vec4(0.0);
|
|
79
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// Author: gre
|
|
2
|
+
// License: MIT
|
|
3
|
+
// Description: The outgoing image is thrown away like a rigid card, tumbling end over end with a slight spin as it flies off into the distance in perspective, its darker back showing on every flip and its soft shadow shrinking on the incoming image behind it
|
|
4
|
+
// Tags: 3d, rotate, flip, card, perspective
|
|
5
|
+
|
|
6
|
+
// @range(-4, 4) Number of turns end over end, negative to tumble the other way
|
|
7
|
+
uniform float flips; // = 2.0
|
|
8
|
+
// @range(-1, 1) Turns of the secondary spin around the line of sight
|
|
9
|
+
uniform float spin; // = 0.15
|
|
10
|
+
// @param Where the card flies toward on screen, in frame heights from the center
|
|
11
|
+
uniform vec2 direction; // = vec2(0.0, 0.3)
|
|
12
|
+
// @range(0.1, 1) Strength of the perspective
|
|
13
|
+
uniform float perspective; // = 0.6
|
|
14
|
+
// @range(0, 1) Shading of the card as it turns, darkness of its back and of its shadow
|
|
15
|
+
uniform float shading; // = 0.7
|
|
16
|
+
|
|
17
|
+
const float PI = 3.141592653589793;
|
|
18
|
+
// width of the anti-aliased card edges, in frame heights
|
|
19
|
+
const float EDGE = 0.0015;
|
|
20
|
+
// direction toward the light: above, to the right, in front
|
|
21
|
+
const vec3 LIGHT = vec3(0.348, 0.696, -0.628);
|
|
22
|
+
|
|
23
|
+
// rotates v around the line of sight
|
|
24
|
+
vec3 roll(vec3 v, float c, float s) {
|
|
25
|
+
return vec3(c * v.x - s * v.y, s * v.x + c * v.y, v.z);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// signed distance to the card's rectangle, in its plane
|
|
29
|
+
float cardDistance(vec2 q) {
|
|
30
|
+
vec2 e = abs(q) - vec2(0.5 * ratio, 0.5);
|
|
31
|
+
return max(e.x, e.y);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// casts the ray d from the eye onto the card's plane, rel being the card's center from the eye:
|
|
35
|
+
// (the point hit in the card's axes, the distance along d), or a negative distance when it misses
|
|
36
|
+
vec3 castOnCard(vec3 d, vec3 rel, vec3 U, vec3 V, vec3 N) {
|
|
37
|
+
float dn = dot(d, N);
|
|
38
|
+
if (abs(dn) < 1e-6) return vec3(0.0, 0.0, -1.0);
|
|
39
|
+
float k = dot(rel, N) / dn;
|
|
40
|
+
vec3 h = k * d - rel;
|
|
41
|
+
return vec3(dot(h, U), dot(h, V), k);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
vec2 cardUv(vec2 q) {
|
|
45
|
+
return clamp(vec2(q.x / ratio, q.y) + 0.5, 0.0, 1.0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
vec4 transition(vec2 uv) {
|
|
49
|
+
// the card is gone a little before the end
|
|
50
|
+
float t = clamp(progress / 0.95, 0.0, 1.0);
|
|
51
|
+
// its size on screen shrinks faster and faster, down to a few percent
|
|
52
|
+
float size = exp(-2.8 * t * t * (0.4 + 0.6 * t));
|
|
53
|
+
float away = 1.0 - size;
|
|
54
|
+
// it spins at its own pace, starting smoothly
|
|
55
|
+
float turn = t * t * (3.0 - 2.0 * t);
|
|
56
|
+
float a = 2.0 * PI * flips * turn;
|
|
57
|
+
float r = 2.0 * PI * spin * turn;
|
|
58
|
+
float cr = cos(r), sr = sin(r);
|
|
59
|
+
// end over end around its horizontal axis, then around the line of sight
|
|
60
|
+
vec3 U = roll(vec3(1.0, 0.0, 0.0), cr, sr);
|
|
61
|
+
vec3 V = roll(vec3(0.0, cos(a), sin(a)), cr, sr);
|
|
62
|
+
vec3 N = roll(vec3(0.0, -sin(a), cos(a)), cr, sr);
|
|
63
|
+
|
|
64
|
+
// the camera, at dist in front of the plane z = 0, sees the frame at rest on it
|
|
65
|
+
float dist = 1.0 / clamp(perspective, 0.1, 1.0);
|
|
66
|
+
// the card's center, seen at direction * away on screen while it goes away, with a slight rise
|
|
67
|
+
vec2 seen = direction * away + vec2(0.0, 0.12 * t * (1.0 - t));
|
|
68
|
+
vec3 rel = vec3(seen / size, dist / size);
|
|
69
|
+
float fade = 1.0 - smoothstep(0.8, 1.0, t);
|
|
70
|
+
float shadowAmount = 0.6 * shading * sqrt(size) * fade;
|
|
71
|
+
|
|
72
|
+
vec2 p = vec2((uv.x - 0.5) * ratio, uv.y - 0.5);
|
|
73
|
+
vec4 color = getToColor(uv);
|
|
74
|
+
|
|
75
|
+
// the soft shadow on the incoming image, cast down and to the left, shrinking with the card
|
|
76
|
+
if (shadowAmount > 0.0) {
|
|
77
|
+
vec3 ds = vec3(p - vec2(-0.05, -0.08) * min(4.0 * t, 1.0) * size, dist);
|
|
78
|
+
vec3 hs = castOnCard(ds, rel, U, V, N);
|
|
79
|
+
if (hs.z > 0.0) {
|
|
80
|
+
float blur = 0.005 + 0.06 * min(3.0 * t, 1.0) * size;
|
|
81
|
+
float sd = cardDistance(hs.xy) * max(abs(dot(ds, N)) / length(ds), 0.05) / hs.z;
|
|
82
|
+
float sh = (1.0 - smoothstep(-blur, blur, sd)) * getFromColor(cardUv(hs.xy)).a;
|
|
83
|
+
color.rgb *= 1.0 - shadowAmount * sh;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// cast the ray onto the card
|
|
88
|
+
vec3 d = vec3(p, dist);
|
|
89
|
+
vec3 hit = castOnCard(d, rel, U, V, N);
|
|
90
|
+
if (hit.z <= 0.0) return color;
|
|
91
|
+
float dn = dot(d, N);
|
|
92
|
+
// anti-aliased edges: a screen pixel covers more of the card when it is far or seen at a grazing angle
|
|
93
|
+
float grazing = max(abs(dn) / length(d), 0.05);
|
|
94
|
+
float e = EDGE * min(20.0 * t, 1.0) * hit.z / grazing;
|
|
95
|
+
float m = clamp(0.5 - cardDistance(hit.xy) / max(e, 1e-6), 0.0, 1.0) * fade;
|
|
96
|
+
if (m <= 0.0) return color;
|
|
97
|
+
|
|
98
|
+
vec4 card = getFromColor(cardUv(hit.xy));
|
|
99
|
+
// the side facing the camera: the front, or the back which shows the image through, darker and duller
|
|
100
|
+
bool front = dn > 0.0;
|
|
101
|
+
vec3 facing = front ? -N : N;
|
|
102
|
+
float lit = min((0.35 + 0.65 * max(dot(facing, LIGHT), 0.0)) / (0.35 + 0.65 * -LIGHT.z), 1.0);
|
|
103
|
+
float shade = mix(1.0, lit * (front ? 1.0 : 0.55), shading);
|
|
104
|
+
if (!front) card.rgb = mix(card.rgb, vec3(dot(card.rgb, vec3(0.299, 0.587, 0.114))), 0.4 * shading);
|
|
105
|
+
// a glint as the card turns through the light, a light added to the image
|
|
106
|
+
float glint = pow(max(dot(facing, normalize(LIGHT - normalize(d))), 0.0), 60.0);
|
|
107
|
+
card.rgb = card.rgb * shade + 0.35 * shading * glint * smoothstep(0.0, 0.2, t);
|
|
108
|
+
if (m >= 1.0) return card;
|
|
109
|
+
// blend premultiplied, so that a transparent layer gives no color to the other one
|
|
110
|
+
vec4 mixed = mix(vec4(color.rgb * color.a, color.a), vec4(card.rgb * card.a, card.a), m);
|
|
111
|
+
return mixed.a > 0.0 ? vec4(mixed.rgb / mixed.a, mixed.a) : vec4(0.0);
|
|
112
|
+
}
|
|
@@ -1,20 +1,76 @@
|
|
|
1
1
|
// Author: Paweł Płóciennik
|
|
2
2
|
// License: MIT
|
|
3
|
-
// Description:
|
|
4
|
-
// Tags: ripple, water,
|
|
5
|
-
// @
|
|
3
|
+
// Description: A drop falls into the image like into still water: round ripples spread out from where it hits, bending the image with glints on their slopes, the incoming image shows up inside the leading ripple, and the water calms down
|
|
4
|
+
// Tags: ripple, water, refraction, circle
|
|
5
|
+
// @range(10, 80) Frequency of the ripples: higher makes them closer together
|
|
6
6
|
uniform float amplitude; // = 30
|
|
7
|
-
// @
|
|
7
|
+
// @range(0, 80) Speed of the ripples as they run outward through the spreading rings
|
|
8
8
|
uniform float speed; // = 30
|
|
9
|
+
// @param Where the drop falls, in texture coordinates
|
|
10
|
+
uniform vec2 center; // = vec2(0.5, 0.5)
|
|
11
|
+
// @range(0, 0.08) How far the ripples bend the image, in frame heights
|
|
12
|
+
uniform float refraction; // = 0.015
|
|
13
|
+
// @range(0, 1) Brightness of the glints on the ripples
|
|
14
|
+
uniform float highlight; // = 0.5
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
// mirror the coordinates back into the frame
|
|
17
|
+
vec2 mirror(vec2 v) {
|
|
18
|
+
return 1.0 - abs(1.0 - mod(v, 2.0));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// height of the water, from -1 to 1, at a distance s inside the front
|
|
22
|
+
float wave(float s, float k, float lambda, float t) {
|
|
23
|
+
// it rises just ahead of the front and dies out a few ripples behind it
|
|
24
|
+
float env = smoothstep(-0.3 * lambda, 0.6 * lambda, s) * exp(-s / (3.5 * lambda));
|
|
25
|
+
// the ripples run out through the train, faster than the train itself spreads
|
|
26
|
+
return env * sin(k * s + speed * t);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
vec4 transition(vec2 uv) {
|
|
30
|
+
if (progress <= 0.0) return getFromColor(uv);
|
|
31
|
+
if (progress >= 1.0) return getToColor(uv);
|
|
32
|
+
|
|
33
|
+
float k = 2.0 * max(amplitude, 1.0);
|
|
34
|
+
float lambda = 6.2831853 / k;
|
|
35
|
+
// measured in square pixels, so the ripples are round
|
|
36
|
+
vec2 q = (uv - center) * vec2(ratio, 1.0);
|
|
37
|
+
float r = length(q);
|
|
38
|
+
vec2 dir = r > 0.0 ? q / r : vec2(0.0);
|
|
39
|
+
// the farthest corner of the frame
|
|
40
|
+
vec2 far = max(center, 1.0 - center) * vec2(ratio, 1.0);
|
|
41
|
+
float R = length(far);
|
|
42
|
+
|
|
43
|
+
// the incoming image shows from a little behind the front, with a soft edge
|
|
44
|
+
float edge = 0.35 * lambda;
|
|
45
|
+
float soft = 0.1 * lambda;
|
|
46
|
+
// the front spreads out, slowing down a little, from just before the drop hits until
|
|
47
|
+
// its revealed area is past the farthest corner
|
|
48
|
+
float t = progress;
|
|
49
|
+
float e = mix(t, 1.0 - (1.0 - t) * (1.0 - t), 0.4);
|
|
50
|
+
float front = mix(-0.3 * lambda, R + edge + soft + 0.01, e);
|
|
51
|
+
float s = front - r;
|
|
52
|
+
|
|
53
|
+
// the water calms down at the end
|
|
54
|
+
float calm = 1.0 - smoothstep(0.55, 1.0, t);
|
|
55
|
+
calm *= calm;
|
|
56
|
+
// slope of the water along the radius, normalized to at most about 1
|
|
57
|
+
// (one-sided at the very center)
|
|
58
|
+
float d = 0.02 * lambda;
|
|
59
|
+
float r0 = max(r - d, 0.0);
|
|
60
|
+
float slope = calm * (wave(front - r - d, k, lambda, t) - wave(front - r0, k, lambda, t)) / ((r + d - r0) * k);
|
|
61
|
+
vec2 offset = dir * slope * refraction / vec2(ratio, 1.0);
|
|
62
|
+
|
|
63
|
+
vec4 ca = getFromColor(mirror(uv - offset));
|
|
64
|
+
vec4 cb = getToColor(mirror(uv - offset));
|
|
65
|
+
float m = smoothstep(edge - soft, edge + soft, s);
|
|
66
|
+
// mixed premultiplied, so transparent images do not bleed their color
|
|
67
|
+
vec4 c = mix(vec4(ca.rgb * ca.a, ca.a), vec4(cb.rgb * cb.a, cb.a), m);
|
|
13
68
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
69
|
+
// the slopes facing the light glint, the ones facing away darken a little,
|
|
70
|
+
// and the crests are a little brighter than the troughs
|
|
71
|
+
float h = calm * wave(s, k, lambda, t);
|
|
72
|
+
float lit = -dot(dir, normalize(vec2(-0.6, 0.8))) * slope;
|
|
73
|
+
float glint = highlight * (0.2 * h + 0.6 * smoothstep(0.2, 0.9, lit) - 0.3 * smoothstep(0.2, 0.9, -lit));
|
|
74
|
+
c.rgb = clamp(c.rgb + glint * c.a, 0.0, c.a);
|
|
75
|
+
return c.a > 0.0 ? vec4(c.rgb / c.a, c.a) : vec4(0.0);
|
|
20
76
|
}
|