shaders 2.2.10 → 2.2.12
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/dist/core/DiffuseBlur-Dq_vFrB1.js +70 -0
- package/dist/core/Godrays-D3VnYrAm.js +106 -0
- package/dist/core/Spherize-CqjZj4yV.js +104 -0
- package/dist/core/index.js +127 -125
- package/dist/core/shaderRegistry.d.ts.map +1 -1
- package/dist/core/shaders/DiffuseBlur/index.d.ts +7 -0
- package/dist/core/shaders/DiffuseBlur/index.d.ts.map +1 -1
- package/dist/core/shaders/DiffuseBlur/index.js +3 -1
- package/dist/core/shaders/Godrays/index.d.ts.map +1 -1
- package/dist/core/shaders/Godrays/index.js +1 -1
- package/dist/core/shaders/Spherize/index.d.ts +62 -0
- package/dist/core/shaders/Spherize/index.d.ts.map +1 -0
- package/dist/core/shaders/Spherize/index.js +7 -0
- package/dist/core/shaders/Spiral/index.js +1 -1
- package/dist/core/shaders/Strands/index.js +1 -1
- package/dist/core/shaders/Stretch/index.js +1 -1
- package/dist/core/shaders/Swirl/index.js +1 -1
- package/dist/core/shaders/TiltShift/index.js +1 -1
- package/dist/core/shaders/Tritone/index.js +1 -1
- package/dist/core/shaders/Twirl/index.js +1 -1
- package/dist/core/shaders/Vibrance/index.js +1 -1
- package/dist/core/shaders/WaveDistortion/index.js +1 -1
- package/dist/core/shaders/ZoomBlur/index.js +1 -1
- package/dist/react/{generatePresetCode-CbulNGo3.js → generatePresetCode-BXrrE8g5.js} +9 -4
- package/dist/react/{generatePresetCode-ClK4i9O1.cjs → generatePresetCode-DWBlTzlt.cjs} +2 -2
- package/dist/react/index.cjs +84 -84
- package/dist/react/index.js +10964 -10715
- package/dist/react/utils/generatePresetCode.cjs +1 -1
- package/dist/react/utils/generatePresetCode.js +1 -1
- package/dist/registry.js +220 -2
- package/dist/svelte/components/Spherize.svelte.d.ts +19 -0
- package/dist/svelte/{generatePresetCode-CbulNGo3.js → generatePresetCode-BXrrE8g5.js} +9 -4
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +11152 -10944
- package/dist/svelte/utils/generatePresetCode.js +1 -1
- package/dist/vue/{generatePresetCode-Baa8DyZE.js → generatePresetCode-nej_B_Ke.js} +30 -25
- package/dist/vue/index.js +10418 -10187
- package/dist/vue/utils/generatePresetCode.js +1 -1
- package/package.json +6 -1
- package/dist/core/DiffuseBlur-BdGvOoBw.js +0 -40
- package/dist/core/Godrays-cUzAKVXn.js +0 -106
- /package/dist/core/{Spiral-CcyI8azF.js → Spiral-BRrismPI.js} +0 -0
- /package/dist/core/{Strands-Co4fkc05.js → Strands-DyrV6zDO.js} +0 -0
- /package/dist/core/{Stretch-C8iYAgNS.js → Stretch-DeBlJ-NH.js} +0 -0
- /package/dist/core/{Swirl-BpMwkNcm.js → Swirl-PxpHzkdC.js} +0 -0
- /package/dist/core/{TiltShift-D31nakFq.js → TiltShift-DiArippe.js} +0 -0
- /package/dist/core/{Tritone-Dx48G3b1.js → Tritone-KtJgZviA.js} +0 -0
- /package/dist/core/{Twirl-ng6pwyl2.js → Twirl-C6xj1p52.js} +0 -0
- /package/dist/core/{Vibrance-D0ArL0qp.js → Vibrance-C6lNgpWH.js} +0 -0
- /package/dist/core/{WaveDistortion-DGKrpUdb.js → WaveDistortion-DcXxPZ2w.js} +0 -0
- /package/dist/core/{ZoomBlur-uQyy5yko.js → ZoomBlur-_feIVJs6.js} +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { k as v, m as _ } from "./three.tsl-BqgDcRt9.js";
|
|
2
|
+
import { t as w } from "./edges-B-tVdqcI.js";
|
|
3
|
+
import { a as S } from "./transformations-DBjTkQ5b.js";
|
|
4
|
+
_();
|
|
5
|
+
const z = {
|
|
6
|
+
name: "DiffuseBlur",
|
|
7
|
+
category: "Blurs",
|
|
8
|
+
description: "Grain-like pixel displacement at random",
|
|
9
|
+
requiresRTT: !0,
|
|
10
|
+
requiresChild: !0,
|
|
11
|
+
props: {
|
|
12
|
+
intensity: {
|
|
13
|
+
default: 30,
|
|
14
|
+
description: "Intensity of the diffuse blur effect",
|
|
15
|
+
ui: {
|
|
16
|
+
type: "range",
|
|
17
|
+
min: 0,
|
|
18
|
+
max: 100,
|
|
19
|
+
step: 1,
|
|
20
|
+
label: "Intensity"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
edges: {
|
|
24
|
+
default: "stretch",
|
|
25
|
+
description: "How to handle edges when distortion pushes content out of bounds",
|
|
26
|
+
transform: S,
|
|
27
|
+
ui: {
|
|
28
|
+
type: "select",
|
|
29
|
+
options: [
|
|
30
|
+
{
|
|
31
|
+
label: "Stretch",
|
|
32
|
+
value: "stretch"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: "Transparent",
|
|
36
|
+
value: "transparent"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: "Mirror",
|
|
40
|
+
value: "mirror"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "Wrap",
|
|
44
|
+
value: "wrap"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
label: "Edges"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
uvTransformNode: ({ uv: r, uniforms: s, viewportSize: l }) => {
|
|
52
|
+
const { vec2: e, fract: u, sin: d, dot: c } = v, n = (i) => u(d(c(i, e(12.9898, 78.233).mul(2))).mul(43758.5453)), m = e(1).div(l), o = r.mul(1e3), f = n(o), t = n(o.add(e(73.2, 41.9))), a = e(f.mul(2).sub(1), t.mul(2).sub(1)).mul(s.intensity.uniform).mul(m);
|
|
53
|
+
return r.add(a);
|
|
54
|
+
},
|
|
55
|
+
fragmentNode: ({ uniforms: r, childNode: s, onCleanup: l }) => {
|
|
56
|
+
const { vec2: e, vec4: u, screenUV: d, convertToTexture: c, viewportSize: n, fract: m, sin: o, dot: f } = v;
|
|
57
|
+
if (!s) return u(0, 0, 0, 0);
|
|
58
|
+
const t = c(s);
|
|
59
|
+
l(() => {
|
|
60
|
+
t?.renderTarget?.dispose && t.renderTarget.dispose();
|
|
61
|
+
});
|
|
62
|
+
const a = (x) => m(o(f(x, e(12.9898, 78.233).mul(2))).mul(43758.5453)), i = d, b = e(1).div(n), p = i.mul(1e3), g = a(p), y = a(p.add(e(73.2, 41.9))), T = e(g.mul(2).sub(1), y.mul(2).sub(1)).mul(r.intensity.uniform).mul(b), h = i.add(T);
|
|
63
|
+
return w(h, t.sample(h), t, r.edges.uniform);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var k = z;
|
|
67
|
+
export {
|
|
68
|
+
z as n,
|
|
69
|
+
k as t
|
|
70
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { k as K, m as O, t as Q } from "./three.tsl-BqgDcRt9.js";
|
|
2
|
+
import { o as W, r as v } from "./transformations-DBjTkQ5b.js";
|
|
3
|
+
O();
|
|
4
|
+
const X = {
|
|
5
|
+
name: "Godrays",
|
|
6
|
+
category: "Base Layers",
|
|
7
|
+
description: "Volumetric light rays emanating from a point",
|
|
8
|
+
requiresRTT: !1,
|
|
9
|
+
acceptsUVContext: !0,
|
|
10
|
+
props: {
|
|
11
|
+
center: {
|
|
12
|
+
default: {
|
|
13
|
+
x: 0,
|
|
14
|
+
y: 0
|
|
15
|
+
},
|
|
16
|
+
transform: W,
|
|
17
|
+
description: "The center point of the god rays",
|
|
18
|
+
ui: {
|
|
19
|
+
type: "position",
|
|
20
|
+
label: "Center"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
density: {
|
|
24
|
+
default: 0.3,
|
|
25
|
+
description: "Frequency of ray sectors",
|
|
26
|
+
ui: {
|
|
27
|
+
type: "range",
|
|
28
|
+
min: 0,
|
|
29
|
+
max: 1,
|
|
30
|
+
step: 0.01,
|
|
31
|
+
label: "Density"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
intensity: {
|
|
35
|
+
default: 0.8,
|
|
36
|
+
description: "Ray visibility within sectors",
|
|
37
|
+
ui: {
|
|
38
|
+
type: "range",
|
|
39
|
+
min: 0,
|
|
40
|
+
max: 1,
|
|
41
|
+
step: 0.01,
|
|
42
|
+
label: "Intensity"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
spotty: {
|
|
46
|
+
default: 1,
|
|
47
|
+
description: "Density of spots on rays (higher = more spots)",
|
|
48
|
+
ui: {
|
|
49
|
+
type: "range",
|
|
50
|
+
min: 0,
|
|
51
|
+
max: 1,
|
|
52
|
+
step: 0.01,
|
|
53
|
+
label: "Spotty"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
speed: {
|
|
57
|
+
default: 0.5,
|
|
58
|
+
description: "Animation speed of the rays",
|
|
59
|
+
ui: {
|
|
60
|
+
type: "range",
|
|
61
|
+
min: 0,
|
|
62
|
+
max: 2,
|
|
63
|
+
step: 0.01,
|
|
64
|
+
label: "Speed"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
rayColor: {
|
|
68
|
+
default: "#4283fb",
|
|
69
|
+
transform: v,
|
|
70
|
+
description: "Color of the light rays",
|
|
71
|
+
ui: {
|
|
72
|
+
type: "color",
|
|
73
|
+
label: "Ray Color"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
backgroundColor: {
|
|
77
|
+
default: "transparent",
|
|
78
|
+
transform: v,
|
|
79
|
+
description: "Background color",
|
|
80
|
+
ui: {
|
|
81
|
+
type: "color",
|
|
82
|
+
label: "Background Color"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
fragmentNode: ({ uniforms: s, uvContext: B }) => {
|
|
87
|
+
const { vec2: i, vec4: _, float: r, sin: G, atan2: T, length: D, pow: x, smoothstep: P, mix: p, clamp: g, screenUV: S, time: U, PI: w, Fn: h } = K, F = B ?? S, I = i(s.center.uniform.x, s.center.uniform.y.oneMinus()), m = F.sub(I), V = h(([n]) => {
|
|
88
|
+
const t = n.floor(), e = n.fract(), o = (u) => G(u.x.mul(127.1).add(u.y.mul(311.7))).mul(43758.5453).fract(), l = o(t), a = o(t.add(i(1, 0))), d = o(t.add(i(0, 1))), y = o(t.add(i(1, 1))), c = e.mul(e).mul(e.mul(-2).add(3));
|
|
89
|
+
return p(p(l, a, c.x), p(d, y, c.x), c.y);
|
|
90
|
+
}), f = h(([n, t, e, o]) => {
|
|
91
|
+
const l = T(n.y, n.x), a = i(l.mul(e), t), d = i(l.mod(w.mul(2)).mul(e), t), y = x(V(a), o);
|
|
92
|
+
return p(x(V(d), o), y, P(-0.15, 0.15, n.x));
|
|
93
|
+
}), L = h(() => {
|
|
94
|
+
const n = U.mul(s.speed.uniform).mul(0.2), t = D(m), e = r(6.5).mul(Q(s.spotty.uniform)), o = r(4).sub(r(3).mul(g(s.intensity.uniform, 0, 1))), l = r(6).mul(s.density.uniform), a = r(0).toVar(), d = t.mul(1).sub(n.mul(3)), y = t.mul(0.5).mul(r(1).add(e)).sub(n.mul(2)), c = l.mul(5), u = f(m, d, c, o).toVar();
|
|
95
|
+
u.assign(u.mul(f(m, y, c.mul(4), o))), a.assign(a.add(u));
|
|
96
|
+
const H = t.mul(1.4).sub(n.mul(2.5)), J = t.mul(0.7).mul(r(1).add(e)).sub(n.mul(1.8)), R = l.mul(4.5), C = f(m, H, R, o).toVar();
|
|
97
|
+
return C.assign(C.mul(f(m, J, R.mul(3.5), o))), a.assign(a.add(C.mul(0.7))), g(a, 0, 1);
|
|
98
|
+
})(), N = s.rayColor.uniform.rgb, q = s.rayColor.uniform.a, E = s.backgroundColor.uniform.rgb, k = s.backgroundColor.uniform.a, b = L.mul(q), A = b.add(k.mul(r(1).sub(b))), M = g(A, 1e-3, 1), j = N.mul(b), z = E.mul(k).mul(r(1).sub(b));
|
|
99
|
+
return _(j.add(z).div(M), A);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
var $ = X;
|
|
103
|
+
export {
|
|
104
|
+
X as n,
|
|
105
|
+
$ as t
|
|
106
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { k as O, m as Q } from "./three.tsl-BqgDcRt9.js";
|
|
2
|
+
import { o as z, r as W } from "./transformations-DBjTkQ5b.js";
|
|
3
|
+
Q();
|
|
4
|
+
const X = {
|
|
5
|
+
name: "Spherize",
|
|
6
|
+
category: "Distortions",
|
|
7
|
+
description: "Map content onto a 3D sphere surface with depth distortion",
|
|
8
|
+
requiresRTT: !0,
|
|
9
|
+
requiresChild: !0,
|
|
10
|
+
props: {
|
|
11
|
+
radius: {
|
|
12
|
+
default: 1,
|
|
13
|
+
description: "Radius of the sphere (1 = half viewport height)",
|
|
14
|
+
ui: {
|
|
15
|
+
type: "range",
|
|
16
|
+
min: 0.1,
|
|
17
|
+
max: 3,
|
|
18
|
+
step: 0.01,
|
|
19
|
+
label: "Radius"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
depth: {
|
|
23
|
+
default: 1,
|
|
24
|
+
description: "How much the sphere bulges toward viewer (0 = flat, higher = more bulge)",
|
|
25
|
+
ui: {
|
|
26
|
+
type: "range",
|
|
27
|
+
min: 0,
|
|
28
|
+
max: 3,
|
|
29
|
+
step: 0.01,
|
|
30
|
+
label: "Depth"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
center: {
|
|
34
|
+
default: {
|
|
35
|
+
x: 0.5,
|
|
36
|
+
y: 0.5
|
|
37
|
+
},
|
|
38
|
+
transform: z,
|
|
39
|
+
description: "The center point of the sphere",
|
|
40
|
+
ui: {
|
|
41
|
+
type: "position",
|
|
42
|
+
label: "Center"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
lightPosition: {
|
|
46
|
+
default: {
|
|
47
|
+
x: 0.3,
|
|
48
|
+
y: 0.3
|
|
49
|
+
},
|
|
50
|
+
transform: z,
|
|
51
|
+
description: "Position of the specular light source",
|
|
52
|
+
ui: {
|
|
53
|
+
type: "position",
|
|
54
|
+
label: "Light Position"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
lightIntensity: {
|
|
58
|
+
default: 0.5,
|
|
59
|
+
description: "Intensity of the rim light (0 = off)",
|
|
60
|
+
ui: {
|
|
61
|
+
type: "range",
|
|
62
|
+
min: 0,
|
|
63
|
+
max: 1,
|
|
64
|
+
step: 0.01,
|
|
65
|
+
label: "Light Intensity"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
lightSoftness: {
|
|
69
|
+
default: 0.5,
|
|
70
|
+
description: "Softness of the rim light falloff (0 = hard edge, 1 = soft glow)",
|
|
71
|
+
ui: {
|
|
72
|
+
type: "range",
|
|
73
|
+
min: 0,
|
|
74
|
+
max: 1,
|
|
75
|
+
step: 0.01,
|
|
76
|
+
label: "Light Softness"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
lightColor: {
|
|
80
|
+
default: "#ffffff",
|
|
81
|
+
transform: W,
|
|
82
|
+
description: "Color of the specular highlight",
|
|
83
|
+
ui: {
|
|
84
|
+
type: "color",
|
|
85
|
+
label: "Light Color"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
fragmentNode: ({ uniforms: e, childNode: m, onCleanup: T }) => {
|
|
90
|
+
const { vec2: o, vec3: l, vec4: p, float: t, screenUV: I, convertToTexture: L, viewportSize: g, sqrt: _, max: a, smoothstep: q, pow: y, normalize: u, dot: x } = O;
|
|
91
|
+
if (!m) return p(0, 0, 0, 0);
|
|
92
|
+
const d = L(m);
|
|
93
|
+
T(() => {
|
|
94
|
+
d?.renderTarget?.dispose && d.renderTarget.dispose();
|
|
95
|
+
});
|
|
96
|
+
const b = I, v = g.x.div(g.y), s = o(e.center.uniform.x, e.center.uniform.y.oneMinus()), w = e.radius.uniform, i = o(b.x.sub(s.x).mul(v), b.y.sub(s.y)).mul(2).div(w), C = i.x.mul(i.x).add(i.y.mul(i.y)), R = t(1).sub(q(t(0.98), t(1), C)), D = _(a(t(0), t(1).sub(C))), U = t(1).add(D.mul(e.depth.uniform)), P = i.div(U).mul(w).div(2), V = o(P.x.div(v).add(s.x), P.y.add(s.y)), n = d.sample(V), S = o(e.lightPosition.uniform.x, e.lightPosition.uniform.y.oneMinus()), M = e.lightIntensity.uniform, A = e.lightSoftness.uniform, c = l(e.lightColor.uniform.x, e.lightColor.uniform.y, e.lightColor.uniform.z), h = u(l(i.x, i.y, D)), B = l(0, 0, 1), k = t(1).add(t(4).mul(t(1).sub(A))), F = y(t(1).sub(a(x(h, B), t(0))), k), G = o(S.x.sub(t(0.5)).mul(2), S.y.sub(t(0.5)).mul(2)), H = u(o(h.x, h.y).add(o(1e-4, 1e-4))), N = u(G.add(o(1e-4, 1e-4))), j = y(a(t(0), x(H, N)), t(2)), f = F.mul(j).mul(M).mul(t(2)), E = n.x.add(c.x.mul(f)), J = n.y.add(c.y.mul(f)), K = n.z.add(c.z.mul(f)), r = n.w.mul(R);
|
|
97
|
+
return p(E.mul(r), J.mul(r), K.mul(r), r);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var $ = X;
|
|
101
|
+
export {
|
|
102
|
+
X as n,
|
|
103
|
+
$ as t
|
|
104
|
+
};
|