shaders 2.2.44 → 2.2.45
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/{AngularBlur-CuwAjUOA.js → AngularBlur-CQYutWxj.js} +6 -2
- package/dist/core/{Beam-CbG4MkLo.js → Beam-CZo-XeQ-.js} +4 -4
- package/dist/core/{Blob-Ck1tVOL_.js → Blob-D3PIrwWv.js} +7 -7
- package/dist/core/{BrightnessContrast-CaErceqR.js → BrightnessContrast-SC7HYw9z.js} +2 -2
- package/dist/core/{Bulge-BVcWo6On.js → Bulge-CbZA25NX.js} +3 -3
- package/dist/core/{CRTScreen-CcAYeqoI.js → CRTScreen-DV5Y2GRA.js} +34 -6
- package/dist/core/{Checkerboard-D_hGvoO7.js → Checkerboard-DBcVaYQv.js} +6 -9
- package/dist/core/{ChromaFlow-DizYQSgf.js → ChromaFlow-DcqnZ1wf.js} +5 -4
- package/dist/core/{ChromaticAberration-Bk_DMYJm.js → ChromaticAberration-Dgf83J6w.js} +4 -3
- package/dist/core/{Circle-BlVzkeyl.js → Circle-BWd84W7f.js} +2 -2
- package/dist/core/{CursorTrail-CxXWV7KH.js → CursorTrail-BKfdORYc.js} +5 -4
- package/dist/core/{Dither-C1KyBYuE.js → Dither-DWoCLL0e.js} +1 -1
- package/dist/core/{DotGrid-ll8XCA0p.js → DotGrid-BZVfqUZO.js} +2 -2
- package/dist/core/{Duotone-d2gQJr4M.js → Duotone-sjvdZBlx.js} +1 -1
- package/dist/core/{FilmGrain-3h6TIe1T.js → FilmGrain-Cr3qP38A.js} +1 -1
- package/dist/core/{FloatingParticles-D95-rj4h.js → FloatingParticles-CPsVFZJl.js} +5 -5
- package/dist/core/{GlassTiles-DqT67iqr.js → GlassTiles-C6LLjlnB.js} +9 -7
- package/dist/core/{Glow-BYNKuw0E.js → Glow-C2avDr73.js} +3 -3
- package/dist/core/{Godrays-DCk1c8sQ.js → Godrays-RVh5ylQ-.js} +8 -6
- package/dist/core/{GridDistortion-D-iiGELF.js → GridDistortion-fimECOse.js} +12 -23
- package/dist/core/{Halftone-CV0aFuRG.js → Halftone-Cb5yrPnj.js} +1 -1
- package/dist/core/{LinearBlur-CTXjolzL.js → LinearBlur-CfMT259a.js} +2 -1
- package/dist/core/{LinearGradient-CZo6e7r8.js → LinearGradient-Cn7w-umQ.js} +6 -2
- package/dist/core/{Liquify-BbfDBMNZ.js → Liquify-BCkIt0A1.js} +1 -18
- package/dist/core/{Perspective-CSP2Hb16.js → Perspective-CJOFHxEC.js} +1 -1
- package/dist/core/{Pixelate-BAoi-CSx.js → Pixelate-BhNAxBsT.js} +7 -3
- package/dist/core/{PolarCoordinates-BwN9HhFK.js → PolarCoordinates-DLs3K__1.js} +3 -3
- package/dist/core/{ProgressiveBlur-RuAm_BKx.js → ProgressiveBlur-BIZSnUjp.js} +5 -2
- package/dist/core/{RadialGradient-BfFuRbIl.js → RadialGradient-sQgXXXQk.js} +1 -1
- package/dist/core/{RectangularCoordinates-CiW3J4UT.js → RectangularCoordinates-CyarkXn0.js} +2 -2
- package/dist/core/{Ripples-DKBIp3Qq.js → Ripples-Djjw66Bn.js} +3 -3
- package/dist/core/{Saturation-DVVlpikK.js → Saturation-DLHW_GP6.js} +1 -1
- package/dist/core/{Sharpness-cw57bW0s.js → Sharpness-DkGuV_dy.js} +1 -1
- package/dist/core/{Shatter-COjV2jLy.js → Shatter-DVgj2Ea3.js} +3 -2
- package/dist/core/{SimplexNoise-Ce79jgYM.js → SimplexNoise-BXtLTcAr.js} +1 -1
- package/dist/core/{SineWave-Cv2gOU8a.js → SineWave-BxqFasFh.js} +3 -3
- package/dist/core/{Spherize-R-s4pX9t.js → Spherize-DIJ4c_EG.js} +4 -4
- package/dist/core/{Spiral-W4dALX1z.js → Spiral-BBtmU1Fv.js} +3 -3
- package/dist/core/{Strands-DtN5POfO.js → Strands-D6UOhX0L.js} +5 -5
- package/dist/core/{Stretch-BzvP_hdu.js → Stretch-DLpz8Ofm.js} +2 -2
- package/dist/core/{Stripes-BbNFX05u.js → Stripes-Bre3Z2m_.js} +5 -5
- package/dist/core/{TiltShift-B6gbm7Z8.js → TiltShift-BPpXBzBg.js} +6 -4
- package/dist/core/{Tint-CpnitsHw.js → Tint-BazvezVn.js} +1 -1
- package/dist/core/{Tritone-DzvSKVfR.js → Tritone-w0h2ebDB.js} +1 -1
- package/dist/core/{Twirl-BXH4uAd6.js → Twirl-dmfYS2Eo.js} +7 -5
- package/dist/core/{Vibrance-ByN9bRgU.js → Vibrance-BpWyAK9W.js} +1 -1
- package/dist/core/{WaveDistortion-BA1PyqYH.js → WaveDistortion-hWdvaZmT.js} +6 -4
- package/dist/core/{ZoomBlur-CIkkDBIo.js → ZoomBlur-DCI4uHOL.js} +5 -2
- package/dist/core/registry.js +48 -48
- package/dist/core/shaders/AngularBlur/index.d.ts.map +1 -1
- package/dist/core/shaders/AngularBlur/index.js +1 -1
- package/dist/core/shaders/Beam/index.js +1 -1
- package/dist/core/shaders/Blob/index.js +1 -1
- package/dist/core/shaders/BrightnessContrast/index.js +1 -1
- package/dist/core/shaders/Bulge/index.js +1 -1
- package/dist/core/shaders/CRTScreen/index.d.ts +14 -0
- package/dist/core/shaders/CRTScreen/index.d.ts.map +1 -1
- package/dist/core/shaders/CRTScreen/index.js +1 -1
- package/dist/core/shaders/Checkerboard/index.d.ts.map +1 -1
- package/dist/core/shaders/Checkerboard/index.js +1 -1
- package/dist/core/shaders/ChromaFlow/index.d.ts +1 -1
- package/dist/core/shaders/ChromaFlow/index.d.ts.map +1 -1
- package/dist/core/shaders/ChromaFlow/index.js +1 -1
- package/dist/core/shaders/ChromaticAberration/index.d.ts.map +1 -1
- package/dist/core/shaders/ChromaticAberration/index.js +1 -1
- package/dist/core/shaders/Circle/index.js +1 -1
- package/dist/core/shaders/CursorTrail/index.d.ts.map +1 -1
- package/dist/core/shaders/CursorTrail/index.js +1 -1
- package/dist/core/shaders/Dither/index.js +1 -1
- package/dist/core/shaders/DotGrid/index.js +1 -1
- package/dist/core/shaders/Duotone/index.js +1 -1
- package/dist/core/shaders/FilmGrain/index.js +1 -1
- package/dist/core/shaders/FloatingParticles/index.js +1 -1
- package/dist/core/shaders/GlassTiles/index.d.ts +1 -1
- package/dist/core/shaders/GlassTiles/index.d.ts.map +1 -1
- package/dist/core/shaders/GlassTiles/index.js +1 -1
- package/dist/core/shaders/Glow/index.js +1 -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/GridDistortion/index.d.ts +0 -7
- package/dist/core/shaders/GridDistortion/index.d.ts.map +1 -1
- package/dist/core/shaders/GridDistortion/index.js +1 -1
- package/dist/core/shaders/Halftone/index.js +1 -1
- package/dist/core/shaders/LinearBlur/index.d.ts.map +1 -1
- package/dist/core/shaders/LinearBlur/index.js +1 -1
- package/dist/core/shaders/LinearGradient/index.d.ts.map +1 -1
- package/dist/core/shaders/LinearGradient/index.js +1 -1
- package/dist/core/shaders/Liquify/index.d.ts +0 -7
- package/dist/core/shaders/Liquify/index.d.ts.map +1 -1
- package/dist/core/shaders/Liquify/index.js +1 -1
- package/dist/core/shaders/Perspective/index.js +1 -1
- package/dist/core/shaders/Pixelate/index.d.ts +1 -1
- package/dist/core/shaders/Pixelate/index.d.ts.map +1 -1
- package/dist/core/shaders/Pixelate/index.js +1 -1
- package/dist/core/shaders/PolarCoordinates/index.js +1 -1
- package/dist/core/shaders/ProgressiveBlur/index.d.ts.map +1 -1
- package/dist/core/shaders/ProgressiveBlur/index.js +1 -1
- package/dist/core/shaders/RadialGradient/index.js +1 -1
- package/dist/core/shaders/RectangularCoordinates/index.js +1 -1
- package/dist/core/shaders/Ripples/index.js +1 -1
- package/dist/core/shaders/Saturation/index.js +1 -1
- package/dist/core/shaders/Sharpness/index.js +1 -1
- package/dist/core/shaders/Shatter/index.d.ts.map +1 -1
- package/dist/core/shaders/Shatter/index.js +1 -1
- package/dist/core/shaders/SimplexNoise/index.js +1 -1
- package/dist/core/shaders/SineWave/index.js +1 -1
- package/dist/core/shaders/Spherize/index.js +1 -1
- package/dist/core/shaders/Spiral/index.js +1 -1
- package/dist/core/shaders/Strands/index.d.ts +1 -1
- package/dist/core/shaders/Strands/index.js +1 -1
- package/dist/core/shaders/Stretch/index.js +1 -1
- package/dist/core/shaders/Stripes/index.d.ts +1 -1
- package/dist/core/shaders/Stripes/index.js +1 -1
- package/dist/core/shaders/TiltShift/index.d.ts.map +1 -1
- package/dist/core/shaders/TiltShift/index.js +1 -1
- package/dist/core/shaders/Tint/index.js +1 -1
- package/dist/core/shaders/Tritone/index.js +1 -1
- package/dist/core/shaders/Twirl/index.d.ts.map +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.d.ts.map +1 -1
- package/dist/core/shaders/WaveDistortion/index.js +1 -1
- package/dist/core/shaders/ZoomBlur/index.d.ts.map +1 -1
- package/dist/core/shaders/ZoomBlur/index.js +1 -1
- package/dist/registry.js +228 -228
- package/dist/vue/CRTScreen.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/vue/GridDistortion.vue_vue_type_script_setup_true_lang.js +0 -1
- package/dist/vue/Liquify.vue_vue_type_script_setup_true_lang.js +0 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as transformPosition } from "./transformations-YbhRK-rd.js";
|
|
2
|
-
import { Fn, convertToTexture, cos, float, screenUV, sin, vec2, vec4 } from "three/tsl";
|
|
2
|
+
import { Fn, convertToTexture, cos, float, screenUV, sin, vec2, vec4, viewportSize } from "three/tsl";
|
|
3
3
|
const componentDefinition = {
|
|
4
4
|
name: "AngularBlur",
|
|
5
5
|
category: "Blurs",
|
|
@@ -39,8 +39,10 @@ const componentDefinition = {
|
|
|
39
39
|
});
|
|
40
40
|
const center = vec2(uniforms.center.uniform.x, uniforms.center.uniform.y.oneMinus());
|
|
41
41
|
const angle = uniforms.intensity.uniform.mul(.005);
|
|
42
|
+
const aspect = viewportSize.x.div(viewportSize.y);
|
|
42
43
|
return Fn(() => {
|
|
43
44
|
const initialCoord = screenUV.sub(center);
|
|
45
|
+
const aspectCorrectedCoord = vec2(initialCoord.x.mul(aspect), initialCoord.y);
|
|
44
46
|
const total = vec4(0).toVar();
|
|
45
47
|
const totalWeight = float(0).toVar();
|
|
46
48
|
const angleStep = angle.div(float(31));
|
|
@@ -50,7 +52,9 @@ const componentDefinition = {
|
|
|
50
52
|
const currentAngle = angleStep.mul(float(i));
|
|
51
53
|
const cosAngle = cos(currentAngle);
|
|
52
54
|
const sinAngle = sin(currentAngle);
|
|
53
|
-
const
|
|
55
|
+
const rotatedX = aspectCorrectedCoord.x.mul(cosAngle).sub(aspectCorrectedCoord.y.mul(sinAngle));
|
|
56
|
+
const rotatedY = aspectCorrectedCoord.x.mul(sinAngle).add(aspectCorrectedCoord.y.mul(cosAngle));
|
|
57
|
+
const sampleCoord = vec2(rotatedX.div(aspect), rotatedY).add(center);
|
|
54
58
|
const sample = childTexture.sample(sampleCoord).mul(weight);
|
|
55
59
|
total.assign(total.add(sample));
|
|
56
60
|
totalWeight.assign(totalWeight.add(weight));
|
|
@@ -37,7 +37,7 @@ const componentDefinition = {
|
|
|
37
37
|
type: "range",
|
|
38
38
|
min: 0,
|
|
39
39
|
max: 2,
|
|
40
|
-
step: .
|
|
40
|
+
step: .1,
|
|
41
41
|
label: "Start Thickness"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
@@ -48,7 +48,7 @@ const componentDefinition = {
|
|
|
48
48
|
type: "range",
|
|
49
49
|
min: 0,
|
|
50
50
|
max: 2,
|
|
51
|
-
step: .
|
|
51
|
+
step: .1,
|
|
52
52
|
label: "End Thickness"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
@@ -59,7 +59,7 @@ const componentDefinition = {
|
|
|
59
59
|
type: "range",
|
|
60
60
|
min: 0,
|
|
61
61
|
max: 50,
|
|
62
|
-
step: .
|
|
62
|
+
step: .1,
|
|
63
63
|
label: "Start Softness"
|
|
64
64
|
}
|
|
65
65
|
},
|
|
@@ -70,7 +70,7 @@ const componentDefinition = {
|
|
|
70
70
|
type: "range",
|
|
71
71
|
min: 0,
|
|
72
72
|
max: 20,
|
|
73
|
-
step: .
|
|
73
|
+
step: .1,
|
|
74
74
|
label: "End Softness"
|
|
75
75
|
}
|
|
76
76
|
},
|
|
@@ -32,7 +32,7 @@ const componentDefinition = {
|
|
|
32
32
|
type: "range",
|
|
33
33
|
min: 0,
|
|
34
34
|
max: 1,
|
|
35
|
-
step: .
|
|
35
|
+
step: .1,
|
|
36
36
|
label: "Size"
|
|
37
37
|
}
|
|
38
38
|
},
|
|
@@ -43,7 +43,7 @@ const componentDefinition = {
|
|
|
43
43
|
type: "range",
|
|
44
44
|
min: 0,
|
|
45
45
|
max: 1,
|
|
46
|
-
step: .
|
|
46
|
+
step: .1,
|
|
47
47
|
label: "Deformation"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
@@ -54,7 +54,7 @@ const componentDefinition = {
|
|
|
54
54
|
type: "range",
|
|
55
55
|
min: 0,
|
|
56
56
|
max: 1,
|
|
57
|
-
step: .
|
|
57
|
+
step: .1,
|
|
58
58
|
label: "Softness"
|
|
59
59
|
}
|
|
60
60
|
},
|
|
@@ -65,7 +65,7 @@ const componentDefinition = {
|
|
|
65
65
|
type: "range",
|
|
66
66
|
min: 0,
|
|
67
67
|
max: 1,
|
|
68
|
-
step: .
|
|
68
|
+
step: .1,
|
|
69
69
|
label: "Highlight Intensity"
|
|
70
70
|
}
|
|
71
71
|
},
|
|
@@ -76,7 +76,7 @@ const componentDefinition = {
|
|
|
76
76
|
type: "range",
|
|
77
77
|
min: -1,
|
|
78
78
|
max: 1,
|
|
79
|
-
step: .
|
|
79
|
+
step: .1,
|
|
80
80
|
label: "Highlight X"
|
|
81
81
|
}
|
|
82
82
|
},
|
|
@@ -87,7 +87,7 @@ const componentDefinition = {
|
|
|
87
87
|
type: "range",
|
|
88
88
|
min: -1,
|
|
89
89
|
max: 1,
|
|
90
|
-
step: .
|
|
90
|
+
step: .1,
|
|
91
91
|
label: "Highlight Y"
|
|
92
92
|
}
|
|
93
93
|
},
|
|
@@ -98,7 +98,7 @@ const componentDefinition = {
|
|
|
98
98
|
type: "range",
|
|
99
99
|
min: -1,
|
|
100
100
|
max: 1,
|
|
101
|
-
step: .
|
|
101
|
+
step: .1,
|
|
102
102
|
label: "Highlight Z"
|
|
103
103
|
}
|
|
104
104
|
},
|
|
@@ -12,7 +12,7 @@ const componentDefinition = {
|
|
|
12
12
|
type: "range",
|
|
13
13
|
min: -1,
|
|
14
14
|
max: 1,
|
|
15
|
-
step: .
|
|
15
|
+
step: .1,
|
|
16
16
|
label: "Brightness"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
@@ -23,7 +23,7 @@ const componentDefinition = {
|
|
|
23
23
|
type: "range",
|
|
24
24
|
min: -1,
|
|
25
25
|
max: 1,
|
|
26
|
-
step: .
|
|
26
|
+
step: .1,
|
|
27
27
|
label: "Contrast"
|
|
28
28
|
},
|
|
29
29
|
transform: (value) => value + 1
|
|
@@ -27,7 +27,7 @@ const componentDefinition = {
|
|
|
27
27
|
type: "range",
|
|
28
28
|
min: -1,
|
|
29
29
|
max: 1,
|
|
30
|
-
step: .
|
|
30
|
+
step: .1,
|
|
31
31
|
label: "Strength"
|
|
32
32
|
}
|
|
33
33
|
},
|
|
@@ -38,7 +38,7 @@ const componentDefinition = {
|
|
|
38
38
|
type: "range",
|
|
39
39
|
min: 0,
|
|
40
40
|
max: 5,
|
|
41
|
-
step: .
|
|
41
|
+
step: .1,
|
|
42
42
|
label: "Radius"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
@@ -49,7 +49,7 @@ const componentDefinition = {
|
|
|
49
49
|
type: "range",
|
|
50
50
|
min: 0,
|
|
51
51
|
max: 1,
|
|
52
|
-
step: .
|
|
52
|
+
step: .1,
|
|
53
53
|
label: "Falloff"
|
|
54
54
|
}
|
|
55
55
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { convertToTexture, float, fract, length, screenUV, sin, smoothstep, vec2, vec3, vec4 } from "three/tsl";
|
|
1
|
+
import { convertToTexture, float, fract, length, mix, screenUV, sin, smoothstep, vec2, vec3, vec4, viewportSize } from "three/tsl";
|
|
2
2
|
const componentDefinition = {
|
|
3
3
|
name: "CRTScreen",
|
|
4
4
|
category: "Stylize",
|
|
@@ -35,7 +35,7 @@ const componentDefinition = {
|
|
|
35
35
|
type: "range",
|
|
36
36
|
min: 0,
|
|
37
37
|
max: 1,
|
|
38
|
-
step: .
|
|
38
|
+
step: .1,
|
|
39
39
|
label: "Scanline Intensity"
|
|
40
40
|
}
|
|
41
41
|
},
|
|
@@ -57,7 +57,7 @@ const componentDefinition = {
|
|
|
57
57
|
type: "range",
|
|
58
58
|
min: .5,
|
|
59
59
|
max: 2,
|
|
60
|
-
step: .
|
|
60
|
+
step: .1,
|
|
61
61
|
label: "Brightness"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
@@ -68,9 +68,31 @@ const componentDefinition = {
|
|
|
68
68
|
type: "range",
|
|
69
69
|
min: .5,
|
|
70
70
|
max: 2,
|
|
71
|
-
step: .
|
|
71
|
+
step: .1,
|
|
72
72
|
label: "Contrast"
|
|
73
73
|
}
|
|
74
|
+
},
|
|
75
|
+
vignetteIntensity: {
|
|
76
|
+
default: 1,
|
|
77
|
+
description: "Strength of corner darkening effect (0 = off)",
|
|
78
|
+
ui: {
|
|
79
|
+
type: "range",
|
|
80
|
+
min: 0,
|
|
81
|
+
max: 1,
|
|
82
|
+
step: .1,
|
|
83
|
+
label: "Vignette Intensity"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
vignetteRadius: {
|
|
87
|
+
default: .5,
|
|
88
|
+
description: "How far the vignette extends inward (0 = edges only, 1 = reaches center)",
|
|
89
|
+
ui: {
|
|
90
|
+
type: "range",
|
|
91
|
+
min: 0,
|
|
92
|
+
max: 1,
|
|
93
|
+
step: .1,
|
|
94
|
+
label: "Vignette Radius"
|
|
95
|
+
}
|
|
74
96
|
}
|
|
75
97
|
},
|
|
76
98
|
fragmentNode: ({ uniforms, childNode, onCleanup }) => {
|
|
@@ -102,8 +124,14 @@ const componentDefinition = {
|
|
|
102
124
|
const greenMask = sin(pixelPhase.x.mul(float(6.28318)).add(float(2.09))).mul(float(.1)).add(float(.95));
|
|
103
125
|
const blueMask = sin(pixelPhase.x.mul(float(6.28318)).add(float(4.18))).mul(float(.1)).add(float(.95));
|
|
104
126
|
const phosphorColor = vec3(scanlinedColor.r.mul(redMask), scanlinedColor.g.mul(greenMask), scanlinedColor.b.mul(blueMask));
|
|
105
|
-
const
|
|
106
|
-
const
|
|
127
|
+
const aspect = viewportSize.x.div(viewportSize.y);
|
|
128
|
+
const centeredUV = screenUV.sub(vec2(.5, .5));
|
|
129
|
+
const vignetteDistance = length(vec2(centeredUV.x.mul(aspect), centeredUV.y));
|
|
130
|
+
const vignetteRadiusProp = uniforms.vignetteRadius.uniform;
|
|
131
|
+
const vignetteIntensity = uniforms.vignetteIntensity.uniform;
|
|
132
|
+
const innerEdge = float(1).sub(vignetteRadiusProp.mul(float(.9)));
|
|
133
|
+
const vignetteValue = smoothstep(innerEdge.add(float(.5)), innerEdge, vignetteDistance);
|
|
134
|
+
const vignette = mix(float(1), vignetteValue, vignetteIntensity);
|
|
107
135
|
return vec4(phosphorColor.mul(vignette), float(1));
|
|
108
136
|
}
|
|
109
137
|
};
|
|
@@ -42,7 +42,7 @@ const componentDefinition = {
|
|
|
42
42
|
type: "range",
|
|
43
43
|
min: 0,
|
|
44
44
|
max: 1,
|
|
45
|
-
step: .
|
|
45
|
+
step: .1,
|
|
46
46
|
label: "Softness"
|
|
47
47
|
}
|
|
48
48
|
},
|
|
@@ -66,14 +66,11 @@ const componentDefinition = {
|
|
|
66
66
|
const gridUV = correctedUV.mul(cells);
|
|
67
67
|
const gridCoords = floor(gridUV);
|
|
68
68
|
const checkerValue = mod(gridCoords.x.add(gridCoords.y), 2);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const edgeBlend = smoothstep(float(0), softRange, distToEdge);
|
|
75
|
-
blendFactor = checkerValue.mul(edgeBlend).add(float(.5).mul(float(1).sub(edgeBlend)));
|
|
76
|
-
}
|
|
69
|
+
const cellUV = fract(gridUV);
|
|
70
|
+
const distToEdge = min(min(cellUV.x, float(1).sub(cellUV.x)), min(cellUV.y, float(1).sub(cellUV.y)));
|
|
71
|
+
const softRange = softness.mul(.5).add(1e-4);
|
|
72
|
+
const edgeBlend = smoothstep(float(0), softRange, distToEdge);
|
|
73
|
+
const blendFactor = checkerValue.mul(edgeBlend).add(float(.5).mul(float(1).sub(edgeBlend)));
|
|
77
74
|
return mixColors(uniforms.colorA.uniform, uniforms.colorB.uniform, blendFactor, uniforms.colorSpace.uniform);
|
|
78
75
|
}
|
|
79
76
|
};
|
|
@@ -63,13 +63,13 @@ const componentDefinition = {
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
radius: {
|
|
66
|
-
default:
|
|
66
|
+
default: 1.5,
|
|
67
67
|
description: "Radius of the liquid effect",
|
|
68
68
|
ui: {
|
|
69
69
|
type: "range",
|
|
70
70
|
min: 0,
|
|
71
71
|
max: 3,
|
|
72
|
-
step: .
|
|
72
|
+
step: .1,
|
|
73
73
|
label: "Radius"
|
|
74
74
|
}
|
|
75
75
|
},
|
|
@@ -85,7 +85,7 @@ const componentDefinition = {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
|
-
fragmentNode: ({ uniforms, onBeforeRender, onCleanup }) => {
|
|
88
|
+
fragmentNode: ({ uniforms, onBeforeRender, onCleanup, dimensions }) => {
|
|
89
89
|
const GRID_SIZE = 128;
|
|
90
90
|
const displacementData = new Float32Array(GRID_SIZE * GRID_SIZE * 2);
|
|
91
91
|
const liquidData = new Float32Array(GRID_SIZE * GRID_SIZE * 2);
|
|
@@ -112,6 +112,7 @@ const componentDefinition = {
|
|
|
112
112
|
const currentTime = Date.now();
|
|
113
113
|
const dt = Math.min((currentTime - lastTime) / 1e3, .016);
|
|
114
114
|
lastTime = currentTime;
|
|
115
|
+
const aspect = dimensions.width / dimensions.height;
|
|
115
116
|
const velX = dt > 0 ? (pointer.x - prevX) / dt : 0;
|
|
116
117
|
const velY = dt > 0 ? (pointer.y - prevY) / dt : 0;
|
|
117
118
|
mouseVelX.value = mouseVelX.value * .85 + velX * .15;
|
|
@@ -153,7 +154,7 @@ const componentDefinition = {
|
|
|
153
154
|
const idx = (i * GRID_SIZE + j) * 2;
|
|
154
155
|
const cellX = (j + .5) / GRID_SIZE;
|
|
155
156
|
const cellY = (i + .5) / GRID_SIZE;
|
|
156
|
-
const dx = cellX - pointer.x;
|
|
157
|
+
const dx = (cellX - pointer.x) / aspect;
|
|
157
158
|
const dy = cellY - pointer.y;
|
|
158
159
|
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
159
160
|
const speed = Math.sqrt(mouseVelX.value * mouseVelX.value + mouseVelY.value * mouseVelY.value);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as transformAngle } from "./transformations-YbhRK-rd.js";
|
|
2
|
-
import { convertToTexture, cos, radians, screenUV, sin, vec2, vec4 } from "three/tsl";
|
|
2
|
+
import { convertToTexture, cos, radians, screenUV, sin, vec2, vec4, viewportSize } from "three/tsl";
|
|
3
3
|
const componentDefinition = {
|
|
4
4
|
name: "ChromaticAberration",
|
|
5
5
|
category: "Stylize",
|
|
@@ -14,7 +14,7 @@ const componentDefinition = {
|
|
|
14
14
|
type: "range",
|
|
15
15
|
min: 0,
|
|
16
16
|
max: 1,
|
|
17
|
-
step: .
|
|
17
|
+
step: .1,
|
|
18
18
|
label: "Strength"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
@@ -71,7 +71,8 @@ const componentDefinition = {
|
|
|
71
71
|
if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
|
|
72
72
|
});
|
|
73
73
|
const angleRad = radians(uniforms.angle.uniform);
|
|
74
|
-
const
|
|
74
|
+
const aspect = viewportSize.x.div(viewportSize.y);
|
|
75
|
+
const direction = vec2(cos(angleRad).div(aspect), sin(angleRad));
|
|
75
76
|
const scaledStrength = uniforms.strength.uniform.mul(.1);
|
|
76
77
|
const redUV = screenUV.add(direction.mul(scaledStrength).mul(uniforms.redOffset.uniform));
|
|
77
78
|
const greenUV = screenUV.add(direction.mul(scaledStrength).mul(uniforms.greenOffset.uniform));
|
|
@@ -21,7 +21,7 @@ const componentDefinition = {
|
|
|
21
21
|
type: "range",
|
|
22
22
|
min: 0,
|
|
23
23
|
max: 2,
|
|
24
|
-
step: .
|
|
24
|
+
step: .1,
|
|
25
25
|
label: "Radius"
|
|
26
26
|
}
|
|
27
27
|
},
|
|
@@ -32,7 +32,7 @@ const componentDefinition = {
|
|
|
32
32
|
type: "range",
|
|
33
33
|
min: 0,
|
|
34
34
|
max: 1,
|
|
35
|
-
step: .
|
|
35
|
+
step: .1,
|
|
36
36
|
label: "Softness"
|
|
37
37
|
}
|
|
38
38
|
},
|
|
@@ -32,7 +32,7 @@ const componentDefinition = {
|
|
|
32
32
|
type: "range",
|
|
33
33
|
min: .5,
|
|
34
34
|
max: 2,
|
|
35
|
-
step: .
|
|
35
|
+
step: .1,
|
|
36
36
|
label: "Radius"
|
|
37
37
|
}
|
|
38
38
|
},
|
|
@@ -54,7 +54,7 @@ const componentDefinition = {
|
|
|
54
54
|
type: "range",
|
|
55
55
|
min: 0,
|
|
56
56
|
max: 1,
|
|
57
|
-
step: .
|
|
57
|
+
step: .1,
|
|
58
58
|
label: "Shrink Amount"
|
|
59
59
|
}
|
|
60
60
|
},
|
|
@@ -69,7 +69,7 @@ const componentDefinition = {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
|
-
fragmentNode: ({ uniforms, onBeforeRender, onCleanup }) => {
|
|
72
|
+
fragmentNode: ({ uniforms, onBeforeRender, onCleanup, dimensions }) => {
|
|
73
73
|
const GRID_SIZE = 128;
|
|
74
74
|
const trailData = new Float32Array(GRID_SIZE * GRID_SIZE * 4);
|
|
75
75
|
const trailTexture = new DataTexture(trailData, GRID_SIZE, GRID_SIZE, RGBAFormat, FloatType);
|
|
@@ -84,6 +84,7 @@ const componentDefinition = {
|
|
|
84
84
|
const currentTime = Date.now();
|
|
85
85
|
const dt = Math.min((currentTime - lastTime) / 1e3, .016);
|
|
86
86
|
lastTime = currentTime;
|
|
87
|
+
const aspect = dimensions.width / dimensions.height;
|
|
87
88
|
const radius = uniforms.radius.uniform.value * .1;
|
|
88
89
|
const length$1 = uniforms.length.uniform.value;
|
|
89
90
|
const shrink = uniforms.shrink.uniform.value;
|
|
@@ -107,7 +108,7 @@ const componentDefinition = {
|
|
|
107
108
|
const idx = (i * GRID_SIZE + j) * 4;
|
|
108
109
|
const cellX = (j + .5) / GRID_SIZE;
|
|
109
110
|
const cellY = (i + .5) / GRID_SIZE;
|
|
110
|
-
const cellDx = cellX - pointer.x;
|
|
111
|
+
const cellDx = (cellX - pointer.x) / aspect;
|
|
111
112
|
const cellDy = cellY - pointer.y;
|
|
112
113
|
const dist = Math.sqrt(cellDx * cellDx + cellDy * cellDy);
|
|
113
114
|
if (dist < influenceRadius) {
|
|
@@ -32,7 +32,7 @@ const componentDefinition = {
|
|
|
32
32
|
type: "range",
|
|
33
33
|
min: 0,
|
|
34
34
|
max: 1,
|
|
35
|
-
step: .
|
|
35
|
+
step: .1,
|
|
36
36
|
label: "Dot Size"
|
|
37
37
|
}
|
|
38
38
|
},
|
|
@@ -43,7 +43,7 @@ const componentDefinition = {
|
|
|
43
43
|
type: "range",
|
|
44
44
|
min: 0,
|
|
45
45
|
max: 1,
|
|
46
|
-
step: .
|
|
46
|
+
step: .1,
|
|
47
47
|
label: "Twinkle"
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -33,7 +33,7 @@ const componentDefinition = {
|
|
|
33
33
|
type: "range",
|
|
34
34
|
min: 0,
|
|
35
35
|
max: 1,
|
|
36
|
-
step: .
|
|
36
|
+
step: .1,
|
|
37
37
|
label: "Randomness"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
@@ -44,7 +44,7 @@ const componentDefinition = {
|
|
|
44
44
|
type: "range",
|
|
45
45
|
min: 0,
|
|
46
46
|
max: 1,
|
|
47
|
-
step: .
|
|
47
|
+
step: .1,
|
|
48
48
|
label: "Speed"
|
|
49
49
|
}
|
|
50
50
|
},
|
|
@@ -77,7 +77,7 @@ const componentDefinition = {
|
|
|
77
77
|
type: "range",
|
|
78
78
|
min: 0,
|
|
79
79
|
max: 5,
|
|
80
|
-
step: .
|
|
80
|
+
step: .1,
|
|
81
81
|
label: "Particle Softness"
|
|
82
82
|
}
|
|
83
83
|
},
|
|
@@ -88,7 +88,7 @@ const componentDefinition = {
|
|
|
88
88
|
type: "range",
|
|
89
89
|
min: 0,
|
|
90
90
|
max: 1,
|
|
91
|
-
step: .
|
|
91
|
+
step: .1,
|
|
92
92
|
label: "Twinkle"
|
|
93
93
|
}
|
|
94
94
|
},
|
|
@@ -119,7 +119,7 @@ const componentDefinition = {
|
|
|
119
119
|
type: "range",
|
|
120
120
|
min: 0,
|
|
121
121
|
max: 1,
|
|
122
|
-
step: .
|
|
122
|
+
step: .1,
|
|
123
123
|
label: "Speed Variance"
|
|
124
124
|
}
|
|
125
125
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { add, convertToTexture, cos, div, floor, mul, screenUV, sin, sub,
|
|
1
|
+
import { add, convertToTexture, cos, div, float, floor, mul, screenUV, sin, sub, vec2, vec4, viewportSize } from "three/tsl";
|
|
2
2
|
const componentDefinition = {
|
|
3
3
|
name: "GlassTiles",
|
|
4
4
|
category: "Distortions",
|
|
@@ -19,7 +19,7 @@ const componentDefinition = {
|
|
|
19
19
|
},
|
|
20
20
|
tileCount: {
|
|
21
21
|
default: 20,
|
|
22
|
-
description: "Number of tiles across the
|
|
22
|
+
description: "Number of tiles across the longest dimension",
|
|
23
23
|
ui: {
|
|
24
24
|
type: "range",
|
|
25
25
|
min: 5,
|
|
@@ -46,12 +46,12 @@ const componentDefinition = {
|
|
|
46
46
|
type: "range",
|
|
47
47
|
min: 0,
|
|
48
48
|
max: 1,
|
|
49
|
-
step: .
|
|
49
|
+
step: .1,
|
|
50
50
|
label: "Roundness"
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
-
fragmentNode: ({ uniforms, childNode,
|
|
54
|
+
fragmentNode: ({ uniforms, childNode, onCleanup }) => {
|
|
55
55
|
if (!childNode) {
|
|
56
56
|
console.error("You must pass a child component into the Glass Tiles shader.");
|
|
57
57
|
return vec4(0);
|
|
@@ -60,13 +60,14 @@ const componentDefinition = {
|
|
|
60
60
|
onCleanup(() => {
|
|
61
61
|
if (texture$1?.renderTarget?.dispose) texture$1.renderTarget.dispose();
|
|
62
62
|
});
|
|
63
|
-
const aspectRatioUniform =
|
|
63
|
+
const aspectRatioUniform = viewportSize.x.div(viewportSize.y);
|
|
64
64
|
const baseUV = screenUV;
|
|
65
65
|
const intensity = uniforms.intensity.uniform;
|
|
66
66
|
const baseTileCount = uniforms.tileCount.uniform;
|
|
67
67
|
const rotationDegrees = uniforms.rotation.uniform;
|
|
68
68
|
const roundnessAmount = uniforms.roundness.uniform;
|
|
69
|
-
const
|
|
69
|
+
const isWide = aspectRatioUniform.greaterThan(float(1));
|
|
70
|
+
const tileCount = vec2(isWide.select(baseTileCount, mul(baseTileCount, aspectRatioUniform)), isWide.select(div(baseTileCount, aspectRatioUniform), baseTileCount));
|
|
70
71
|
const aspectCorrectedUV = vec2(mul(baseUV.x, aspectRatioUniform), baseUV.y);
|
|
71
72
|
const rotationRadians = mul(rotationDegrees, Math.PI / 180);
|
|
72
73
|
const cosAngle = cos(rotationRadians);
|
|
@@ -76,7 +77,8 @@ const componentDefinition = {
|
|
|
76
77
|
const gridUV = vec2(div(rotatedUV.x, aspectRatioUniform), rotatedUV.y);
|
|
77
78
|
const fromCenter = sub(div(sub(gridUV, div(floor(mul(gridUV, tileCount)), tileCount)), div(vec2(1), tileCount)), vec2(.5, .5));
|
|
78
79
|
const clampedRoundness = sub(1, mul(mul(fromCenter.x, fromCenter.x).add(mul(fromCenter.y, fromCenter.y)), mul(roundnessAmount, 4))).max(0);
|
|
79
|
-
const
|
|
80
|
+
const baseDistortion = mul(fromCenter, mul(mul(intensity, .025), clampedRoundness));
|
|
81
|
+
const distortedUV = add(baseUV, vec2(div(baseDistortion.x, aspectRatioUniform), baseDistortion.y));
|
|
80
82
|
return vec4(texture$1.sample(distortedUV));
|
|
81
83
|
}
|
|
82
84
|
};
|
|
@@ -13,7 +13,7 @@ const componentDefinition = {
|
|
|
13
13
|
type: "range",
|
|
14
14
|
min: 0,
|
|
15
15
|
max: 10,
|
|
16
|
-
step: .
|
|
16
|
+
step: .1,
|
|
17
17
|
label: "Intensity"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
@@ -24,7 +24,7 @@ const componentDefinition = {
|
|
|
24
24
|
type: "range",
|
|
25
25
|
min: 0,
|
|
26
26
|
max: 1,
|
|
27
|
-
step: .
|
|
27
|
+
step: .1,
|
|
28
28
|
label: "Threshold"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
@@ -35,7 +35,7 @@ const componentDefinition = {
|
|
|
35
35
|
type: "range",
|
|
36
36
|
min: 1,
|
|
37
37
|
max: 20,
|
|
38
|
-
step: .
|
|
38
|
+
step: .1,
|
|
39
39
|
label: "Glow Size"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as transformColor, s as transformPosition } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { t as createAnimatedTime } from "./time-BZqyVJXt.js";
|
|
3
|
-
import { Fn, PI, abs, atan, clamp, float, length, mix, pow, screenUV, sin, smoothstep, vec2, vec4 } from "three/tsl";
|
|
3
|
+
import { Fn, PI, abs, atan, clamp, float, length, mix, pow, screenUV, sin, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
|
|
4
4
|
const componentDefinition = {
|
|
5
5
|
name: "Godrays",
|
|
6
6
|
category: "Base Layers",
|
|
@@ -26,7 +26,7 @@ const componentDefinition = {
|
|
|
26
26
|
type: "range",
|
|
27
27
|
min: 0,
|
|
28
28
|
max: 1,
|
|
29
|
-
step: .
|
|
29
|
+
step: .1,
|
|
30
30
|
label: "Density"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
@@ -37,7 +37,7 @@ const componentDefinition = {
|
|
|
37
37
|
type: "range",
|
|
38
38
|
min: 0,
|
|
39
39
|
max: 1,
|
|
40
|
-
step: .
|
|
40
|
+
step: .1,
|
|
41
41
|
label: "Intensity"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
@@ -48,7 +48,7 @@ const componentDefinition = {
|
|
|
48
48
|
type: "range",
|
|
49
49
|
min: 0,
|
|
50
50
|
max: 1,
|
|
51
|
-
step: .
|
|
51
|
+
step: .1,
|
|
52
52
|
label: "Spotty"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
@@ -59,7 +59,7 @@ const componentDefinition = {
|
|
|
59
59
|
type: "range",
|
|
60
60
|
min: 0,
|
|
61
61
|
max: 2,
|
|
62
|
-
step: .
|
|
62
|
+
step: .1,
|
|
63
63
|
label: "Speed"
|
|
64
64
|
}
|
|
65
65
|
},
|
|
@@ -85,8 +85,10 @@ const componentDefinition = {
|
|
|
85
85
|
fragmentNode: (params) => {
|
|
86
86
|
const { uniforms } = params;
|
|
87
87
|
const uv$1 = screenUV;
|
|
88
|
+
const aspect = viewportSize.x.div(viewportSize.y);
|
|
88
89
|
const centerPos = vec2(uniforms.center.uniform.x, uniforms.center.uniform.y.oneMinus());
|
|
89
|
-
const
|
|
90
|
+
const delta = uv$1.sub(centerPos);
|
|
91
|
+
const shapeUV = vec2(delta.x.mul(aspect), delta.y);
|
|
90
92
|
const valueNoise = Fn(([st]) => {
|
|
91
93
|
const i = st.floor();
|
|
92
94
|
const f = st.fract();
|