shaders 2.2.24 → 2.2.25
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-Dl2gwk68.js +64 -0
- package/dist/core/Ascii-Dha_QpT3.js +286 -0
- package/dist/core/Beam-CTN9Ni43.js +139 -0
- package/dist/core/Blob-CxFDZovO.js +218 -0
- package/dist/core/Blur-Y2FsmFk_.js +77 -0
- package/dist/core/Bulge-Cb-t0xqI.js +132 -0
- package/dist/core/CRTScreen-CtERsenz.js +112 -0
- package/dist/core/ChannelBlur-CvM6GJgZ.js +118 -0
- package/dist/core/Checkerboard-CgB-egNY.js +83 -0
- package/dist/core/ChromaFlow-vRCwhQpN.js +222 -0
- package/dist/core/ChromaticAberration-FTquTQIL.js +88 -0
- package/dist/core/Circle-Daziv5d7.js +67 -0
- package/dist/core/CursorTrail-Bsz9e6Fn.js +145 -0
- package/dist/core/DiffuseBlur-Cj2PtRNd.js +83 -0
- package/dist/core/Dither-D2Nf4p3w.js +66 -0
- package/dist/core/DotGrid-CzOwquo4.js +75 -0
- package/dist/core/Duotone-XuTN9tI7.js +65 -0
- package/dist/core/FilmGrain-D3-nbi12.js +28 -0
- package/dist/core/FloatingParticles-D9Nnu1qg.js +217 -0
- package/dist/core/GlassTiles-CnjCvajI.js +69 -0
- package/dist/core/Glow-BluFc9be.js +75 -0
- package/dist/core/Godrays-ChLh_vGl.js +144 -0
- package/dist/core/Grayscale-DRny75A9.js +20 -0
- package/dist/core/Grid-DgyDa4H1.js +58 -0
- package/dist/core/GridDistortion-BAspCYvp.js +188 -0
- package/dist/core/Group-Dul7PUBl.js +14 -0
- package/dist/core/Halftone-Ifv5F_FT.js +65 -0
- package/dist/core/HueShift-De8ukMWs.js +31 -0
- package/dist/core/ImageTexture-DvYcQgJB.js +143 -0
- package/dist/core/Invert-Fz0NtIJc.js +21 -0
- package/dist/core/LinearBlur-LmhnQoA4.js +62 -0
- package/dist/core/LinearGradient-xbloQjzt.js +133 -0
- package/dist/core/Liquify-DMe1V5-O.js +175 -0
- package/dist/core/Pixelate-Cv8537Pj.js +37 -0
- package/dist/core/PolarCoordinates-DDvDhBE-.js +112 -0
- package/dist/core/Posterize-3m3xkWOz.js +29 -0
- package/dist/core/ProgressiveBlur-EGkevObV.js +121 -0
- package/dist/core/RadialGradient-B7ZZB_VJ.js +71 -0
- package/dist/core/RectangularCoordinates-muWR8mZS.js +101 -0
- package/dist/core/Ripples-8XaZaXQF.js +117 -0
- package/dist/core/Saturation-CYFI1jzN.js +30 -0
- package/dist/core/SimplexNoise-DJUe0wz_.js +99 -0
- package/dist/core/SineWave-Dl3nFO1W.js +120 -0
- package/dist/core/SolidColor-CWGq_Bjq.js +21 -0
- package/dist/core/Spherize-C-jZEUsN.js +128 -0
- package/dist/core/Spiral-BSB_R39p.js +132 -0
- package/dist/core/Strands-0stO5BMy.js +161 -0
- package/dist/core/Stretch-B645paha.js +133 -0
- package/dist/core/Swirl-CVnbawit.js +173 -0
- package/dist/core/TiltShift-0CxNRI6L.js +134 -0
- package/dist/core/Tritone-Daa-I5UD.js +76 -0
- package/dist/core/Twirl-2CJVZEtk.js +96 -0
- package/dist/core/Vibrance-DRtecEvb.js +30 -0
- package/dist/core/WaveDistortion-BscXN2rs.js +173 -0
- package/dist/core/ZoomBlur-CAqK0Kju.js +62 -0
- package/dist/core/colorMixing-BXiTAqJU.js +69 -0
- package/dist/core/edges-Bn_OIa_h.js +26 -0
- package/dist/core/index.js +2257 -1606
- package/dist/core/shaders/AngularBlur/index.js +3 -7
- package/dist/core/shaders/Ascii/index.js +2 -6
- package/dist/core/shaders/Beam/index.js +4 -8
- package/dist/core/shaders/Blob/index.js +5 -9
- package/dist/core/shaders/Blur/index.js +2 -6
- package/dist/core/shaders/Bulge/index.js +4 -8
- package/dist/core/shaders/CRTScreen/index.js +2 -6
- package/dist/core/shaders/ChannelBlur/index.js +2 -6
- package/dist/core/shaders/Checkerboard/index.js +4 -8
- package/dist/core/shaders/ChromaFlow/index.js +3 -7
- package/dist/core/shaders/ChromaticAberration/index.js +3 -7
- package/dist/core/shaders/Circle/index.js +3 -7
- package/dist/core/shaders/CursorTrail/index.js +4 -8
- package/dist/core/shaders/DiffuseBlur/index.js +4 -8
- package/dist/core/shaders/Dither/index.js +3 -7
- package/dist/core/shaders/DotGrid/index.js +3 -7
- package/dist/core/shaders/Duotone/index.js +4 -8
- package/dist/core/shaders/FilmGrain/index.js +2 -6
- package/dist/core/shaders/FloatingParticles/index.js +3 -7
- package/dist/core/shaders/GlassTiles/index.js +2 -6
- package/dist/core/shaders/Glow/index.js +2 -6
- package/dist/core/shaders/Godrays/index.js +3 -7
- package/dist/core/shaders/Grayscale/index.js +2 -8
- package/dist/core/shaders/Grid/index.js +3 -7
- package/dist/core/shaders/GridDistortion/index.js +4 -8
- package/dist/core/shaders/Group/index.js +2 -6
- package/dist/core/shaders/Halftone/index.js +3 -7
- package/dist/core/shaders/HueShift/index.js +2 -8
- package/dist/core/shaders/ImageTexture/index.js +2 -6
- package/dist/core/shaders/Invert/index.js +2 -6
- package/dist/core/shaders/LinearBlur/index.js +3 -7
- package/dist/core/shaders/LinearGradient/index.js +4 -8
- package/dist/core/shaders/Liquify/index.js +4 -8
- package/dist/core/shaders/Pixelate/index.js +2 -6
- package/dist/core/shaders/PolarCoordinates/index.js +4 -8
- package/dist/core/shaders/Posterize/index.js +2 -7
- package/dist/core/shaders/ProgressiveBlur/index.js +3 -7
- package/dist/core/shaders/RadialGradient/index.js +4 -8
- package/dist/core/shaders/RectangularCoordinates/index.js +4 -8
- package/dist/core/shaders/Ripples/index.js +5 -9
- package/dist/core/shaders/Saturation/index.js +2 -8
- package/dist/core/shaders/SimplexNoise/index.js +5 -9
- package/dist/core/shaders/SineWave/index.js +3 -7
- package/dist/core/shaders/SolidColor/index.js +3 -7
- package/dist/core/shaders/Spherize/index.js +3 -7
- package/dist/core/shaders/Spiral/index.js +4 -8
- package/dist/core/shaders/Strands/index.js +4 -8
- package/dist/core/shaders/Stretch/index.js +4 -8
- package/dist/core/shaders/Swirl/index.js +5 -9
- package/dist/core/shaders/TiltShift/index.js +3 -7
- package/dist/core/shaders/Tritone/index.js +4 -8
- package/dist/core/shaders/Twirl/index.js +4 -8
- package/dist/core/shaders/Vibrance/index.js +2 -8
- package/dist/core/shaders/WaveDistortion/index.js +4 -8
- package/dist/core/shaders/ZoomBlur/index.js +3 -7
- package/dist/core/telemetry/index.js +189 -157
- package/dist/core/time-CTJvRUZ4.js +10 -0
- package/dist/core/transformations-DxfQXZWi.js +4715 -0
- package/dist/react/generatePresetCode-CCibXbtZ.js +645 -0
- package/dist/react/index.js +7645 -104827
- package/dist/react/utils/generatePresetCode.js +2 -5
- package/dist/solid/index.js +6670 -102727
- package/dist/solid/utils/generatePresetCode.js +583 -554
- package/dist/svelte/generatePresetCode-CymgoDq_.js +645 -0
- package/dist/svelte/index.js +6175 -102645
- package/dist/svelte/utils/generatePresetCode.js +2 -5
- package/dist/vue/generatePresetCode-CRJmU8iF.js +649 -0
- package/dist/vue/index.js +6929 -103706
- package/dist/vue/utils/generatePresetCode.js +2 -5
- package/package.json +4 -1
- package/dist/core/AngularBlur-ClvtyURQ.js +0 -56
- package/dist/core/Ascii-BT0-K_vw.js +0 -196
- package/dist/core/Beam-BAKql1AP.js +0 -116
- package/dist/core/Blob-CVSxhHJG.js +0 -169
- package/dist/core/Blur-C1TTBHCX.js +0 -64
- package/dist/core/Bulge-DV8tX-cw.js +0 -103
- package/dist/core/CRTScreen-VTJQoOeq.js +0 -91
- package/dist/core/ChannelBlur-BLZ9kBNA.js +0 -89
- package/dist/core/Checkerboard-DQ4Df3vm.js +0 -75
- package/dist/core/ChromaFlow-BggN1_Av.js +0 -134
- package/dist/core/ChromaticAberration-DlTaHNcp.js +0 -82
- package/dist/core/Circle-B9ObWlq5.js +0 -62
- package/dist/core/ColorAdjustment-FeXXpypd.js +0 -14
- package/dist/core/CursorTrail-C7QdUj8O.js +0 -105
- package/dist/core/DiffuseBlur-Mx6LBsqz.js +0 -69
- package/dist/core/Dither-CeIdV_9C.js +0 -61
- package/dist/core/DotGrid-D6xUvYrt.js +0 -61
- package/dist/core/Duotone-C2Pqt2gR.js +0 -66
- package/dist/core/FilmGrain-CJ9n_fgk.js +0 -28
- package/dist/core/FloatingParticles-iGtMs44K.js +0 -160
- package/dist/core/GlassTiles-D_lVyag2.js +0 -52
- package/dist/core/Glow-B0jj-6OC.js +0 -66
- package/dist/core/Godrays-DjLVuZa4.js +0 -105
- package/dist/core/Grayscale-BbsdDa_X.js +0 -21
- package/dist/core/Grid-ByjU-_ua.js +0 -50
- package/dist/core/GridDistortion-C_eIlhkW.js +0 -147
- package/dist/core/Group-CyaDLGpI.js +0 -17
- package/dist/core/Halftone-BvuAe_k-.js +0 -55
- package/dist/core/HueShift-B_qE9c08.js +0 -32
- package/dist/core/ImageTexture-h00TFC1l.js +0 -105
- package/dist/core/Invert-BEDDB0sm.js +0 -20
- package/dist/core/LinearBlur-CLKxuyeT.js +0 -56
- package/dist/core/LinearGradient-BPo8TX_M.js +0 -111
- package/dist/core/Liquify-DGkfeixZ.js +0 -139
- package/dist/core/Pixelate-Bzy_7LnJ.js +0 -38
- package/dist/core/PolarCoordinates-BUumPeTv.js +0 -103
- package/dist/core/Posterize-ggKIJlmm.js +0 -46
- package/dist/core/ProgressiveBlur-D6_6T7SS.js +0 -102
- package/dist/core/RadialGradient-DEY9fRqa.js +0 -71
- package/dist/core/RectangularCoordinates-CZ-cFrCh.js +0 -92
- package/dist/core/Ripples-BwNlcsnV.js +0 -106
- package/dist/core/Saturation-Dl3gCWuZ.js +0 -31
- package/dist/core/SimplexNoise-BhE_WyGt.js +0 -94
- package/dist/core/SineWave-Db_Y0Mcv.js +0 -107
- package/dist/core/SolidColor-CerOp4EQ.js +0 -22
- package/dist/core/Spherize-Dh8E5XwG.js +0 -103
- package/dist/core/Spiral-BvygQEfP.js +0 -115
- package/dist/core/Strands-maaPn4On.js +0 -125
- package/dist/core/Stretch-CnA0-nSz.js +0 -103
- package/dist/core/Swirl-CQBUahTB.js +0 -148
- package/dist/core/TSLBase-Bt7Z4hv_.js +0 -8053
- package/dist/core/TiltShift-qFj0oFzN.js +0 -114
- package/dist/core/Tritone-AiixmTg8.js +0 -75
- package/dist/core/Twirl-ooHQcV89.js +0 -82
- package/dist/core/Vibrance-C2FRlLkK.js +0 -31
- package/dist/core/WaveDistortion-CN8MjKlm.js +0 -132
- package/dist/core/ZoomBlur-CxWGx8PH.js +0 -56
- package/dist/core/colorMixing--dhzx0ch.js +0 -21
- package/dist/core/edges-CDzKsauJ.js +0 -15
- package/dist/core/three.tsl-Btj1hLsf.js +0 -43845
- package/dist/core/time-DbRMw6Jm.js +0 -10
- package/dist/core/transformations-CsrIJXh-.js +0 -3992
- package/dist/react/generatePresetCode-CVj6IV8Y.js +0 -646
- package/dist/svelte/generatePresetCode-CVj6IV8Y.js +0 -646
- package/dist/vue/generatePresetCode-DCaIsDhE.js +0 -652
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { t as createAnimatedTime } from "./time-CTJvRUZ4.js";
|
|
2
|
+
import { i as transformColorSpace, o as transformPosition, r as transformColor, t as colorSpaceOptions } from "./transformations-DxfQXZWi.js";
|
|
3
|
+
import { t as mixColors } from "./colorMixing-BXiTAqJU.js";
|
|
4
|
+
import * as TSL from "three/tsl";
|
|
5
|
+
const componentDefinition = {
|
|
6
|
+
name: "Blob",
|
|
7
|
+
category: "Base Layers",
|
|
8
|
+
description: "Organic animated blob with 3D lighting and gradients",
|
|
9
|
+
acceptsUVContext: true,
|
|
10
|
+
props: {
|
|
11
|
+
colorA: {
|
|
12
|
+
default: "#ff6b35",
|
|
13
|
+
transform: transformColor,
|
|
14
|
+
description: "Primary color of the blob",
|
|
15
|
+
ui: {
|
|
16
|
+
type: "color",
|
|
17
|
+
label: "Color A"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
colorB: {
|
|
21
|
+
default: "#e91e63",
|
|
22
|
+
transform: transformColor,
|
|
23
|
+
description: "Secondary color of the blob",
|
|
24
|
+
ui: {
|
|
25
|
+
type: "color",
|
|
26
|
+
label: "Color B"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
size: {
|
|
30
|
+
default: .5,
|
|
31
|
+
description: "Size of the blob",
|
|
32
|
+
ui: {
|
|
33
|
+
type: "range",
|
|
34
|
+
min: 0,
|
|
35
|
+
max: 1,
|
|
36
|
+
step: .01,
|
|
37
|
+
label: "Size"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
deformation: {
|
|
41
|
+
default: .5,
|
|
42
|
+
description: "How organic and blobby the shape is (0 = circle, 1 = very blobby)",
|
|
43
|
+
ui: {
|
|
44
|
+
type: "range",
|
|
45
|
+
min: 0,
|
|
46
|
+
max: 1,
|
|
47
|
+
step: .01,
|
|
48
|
+
label: "Deformation"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
softness: {
|
|
52
|
+
default: .5,
|
|
53
|
+
description: "Softness of the blob edges (combines edge width and transition curve)",
|
|
54
|
+
ui: {
|
|
55
|
+
type: "range",
|
|
56
|
+
min: 0,
|
|
57
|
+
max: 1,
|
|
58
|
+
step: .01,
|
|
59
|
+
label: "Softness"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
highlightIntensity: {
|
|
63
|
+
default: .5,
|
|
64
|
+
description: "Intensity of specular highlight effect",
|
|
65
|
+
ui: {
|
|
66
|
+
type: "range",
|
|
67
|
+
min: 0,
|
|
68
|
+
max: 1,
|
|
69
|
+
step: .01,
|
|
70
|
+
label: "Highlight Intensity"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
highlightX: {
|
|
74
|
+
default: .3,
|
|
75
|
+
description: "Light direction X component",
|
|
76
|
+
ui: {
|
|
77
|
+
type: "range",
|
|
78
|
+
min: -1,
|
|
79
|
+
max: 1,
|
|
80
|
+
step: .01,
|
|
81
|
+
label: "Highlight X"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
highlightY: {
|
|
85
|
+
default: -.3,
|
|
86
|
+
description: "Light direction Y component",
|
|
87
|
+
ui: {
|
|
88
|
+
type: "range",
|
|
89
|
+
min: -1,
|
|
90
|
+
max: 1,
|
|
91
|
+
step: .01,
|
|
92
|
+
label: "Highlight Y"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
highlightZ: {
|
|
96
|
+
default: .4,
|
|
97
|
+
description: "Light direction Z component",
|
|
98
|
+
ui: {
|
|
99
|
+
type: "range",
|
|
100
|
+
min: -1,
|
|
101
|
+
max: 1,
|
|
102
|
+
step: .01,
|
|
103
|
+
label: "Highlight Z"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
highlightColor: {
|
|
107
|
+
default: "#ffe11a",
|
|
108
|
+
transform: transformColor,
|
|
109
|
+
description: "Color of the specular highlight",
|
|
110
|
+
ui: {
|
|
111
|
+
type: "color",
|
|
112
|
+
label: "Highlight Color"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
speed: {
|
|
116
|
+
default: .5,
|
|
117
|
+
description: "Animation speed",
|
|
118
|
+
ui: {
|
|
119
|
+
type: "range",
|
|
120
|
+
min: 0,
|
|
121
|
+
max: 2,
|
|
122
|
+
step: .1,
|
|
123
|
+
label: "Speed"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
seed: {
|
|
127
|
+
default: 1,
|
|
128
|
+
description: "Adjusts the starting state, useful for variation",
|
|
129
|
+
ui: {
|
|
130
|
+
type: "range",
|
|
131
|
+
min: 0,
|
|
132
|
+
max: 100,
|
|
133
|
+
step: 1,
|
|
134
|
+
label: "Seed"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
center: {
|
|
138
|
+
default: {
|
|
139
|
+
x: .5,
|
|
140
|
+
y: .5
|
|
141
|
+
},
|
|
142
|
+
transform: transformPosition,
|
|
143
|
+
description: "The center point of the blob",
|
|
144
|
+
ui: {
|
|
145
|
+
type: "position",
|
|
146
|
+
label: "Center Position"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
colorSpace: {
|
|
150
|
+
default: "linear",
|
|
151
|
+
transform: transformColorSpace,
|
|
152
|
+
description: "Color space for color interpolation",
|
|
153
|
+
ui: {
|
|
154
|
+
type: "select",
|
|
155
|
+
options: colorSpaceOptions,
|
|
156
|
+
label: "Color Space"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
fragmentNode: (params) => {
|
|
161
|
+
const { uniforms, uvContext } = params;
|
|
162
|
+
const { vec2: vec2$1, vec3: vec3$1, vec4: vec4$1, float: float$1, screenUV: screenUV$1, smoothstep, sin: sin$1, length, viewportSize: viewportSize$1, pow: pow$1, max: max$1, normalize, dot: dot$1, reflect } = TSL;
|
|
163
|
+
const baseUV = uvContext ?? screenUV$1;
|
|
164
|
+
const animTime = createAnimatedTime(params, uniforms.speed, uniforms.seed);
|
|
165
|
+
const colorA = uniforms.colorA.uniform;
|
|
166
|
+
const colorB = uniforms.colorB.uniform;
|
|
167
|
+
const size = uniforms.size.uniform;
|
|
168
|
+
const deformation = uniforms.deformation.uniform;
|
|
169
|
+
const softness = uniforms.softness.uniform;
|
|
170
|
+
const highlightIntensity = uniforms.highlightIntensity.uniform;
|
|
171
|
+
const highlightX = uniforms.highlightX.uniform;
|
|
172
|
+
const highlightY = uniforms.highlightY.uniform;
|
|
173
|
+
const highlightZ = uniforms.highlightZ.uniform;
|
|
174
|
+
const highlightColor = uniforms.highlightColor.uniform;
|
|
175
|
+
const edgeWidth = softness.mul(float$1(.3));
|
|
176
|
+
const edgeCurve = softness.mul(float$1(2)).add(float$1(.5));
|
|
177
|
+
const edgeComplexity = float$1(.5);
|
|
178
|
+
const aspect = viewportSize$1.x.div(viewportSize$1.y);
|
|
179
|
+
const aspectCorrectedUV = vec2$1(baseUV.x.mul(aspect), baseUV.y);
|
|
180
|
+
const centerPos = vec2$1(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus());
|
|
181
|
+
const uv = aspectCorrectedUV.sub(centerPos);
|
|
182
|
+
const dist = length(uv);
|
|
183
|
+
const baseRadius = size;
|
|
184
|
+
const noiseScale = float$1(4);
|
|
185
|
+
const noise1 = sin$1(uv.x.mul(noiseScale.mul(float$1(.8))).add(animTime.mul(float$1(.8)))).mul(sin$1(uv.y.mul(noiseScale.mul(float$1(.7))).add(animTime.mul(float$1(.6))))).add(sin$1(uv.x.mul(noiseScale.mul(float$1(1.2))).sub(uv.y.mul(noiseScale.mul(float$1(.9))).add(animTime.mul(float$1(.4)))))).mul(float$1(.15)).mul(deformation);
|
|
186
|
+
const noise2 = sin$1(uv.x.mul(noiseScale.mul(float$1(1.4))).sub(animTime.mul(float$1(.5)))).mul(sin$1(uv.y.mul(noiseScale.mul(float$1(1.1))).add(animTime.mul(float$1(.7))))).mul(float$1(.12)).mul(deformation).mul(smoothstep(float$1(.15), float$1(.25), edgeComplexity));
|
|
187
|
+
const noise3 = sin$1(uv.x.mul(noiseScale.mul(float$1(1.8))).add(uv.y.mul(noiseScale.mul(float$1(1.6))).add(animTime.mul(float$1(.3))))).add(sin$1(uv.x.mul(noiseScale.mul(float$1(.6))).sub(animTime.mul(float$1(.9))))).mul(float$1(.1)).mul(deformation).mul(smoothstep(float$1(.3), float$1(.4), edgeComplexity));
|
|
188
|
+
const noise4 = sin$1(uv.x.mul(noiseScale.mul(float$1(2.2))).add(animTime.mul(float$1(.2)))).mul(sin$1(uv.y.mul(noiseScale.mul(float$1(1.9))).sub(animTime.mul(float$1(.8))))).mul(float$1(.08)).mul(deformation).mul(smoothstep(float$1(.45), float$1(.55), edgeComplexity));
|
|
189
|
+
const noise5 = sin$1(uv.x.mul(noiseScale.mul(float$1(2.8))).sub(uv.y.mul(noiseScale.mul(float$1(2.4))).add(animTime.mul(float$1(.6))))).mul(float$1(.06)).mul(deformation).mul(smoothstep(float$1(.6), float$1(.7), edgeComplexity));
|
|
190
|
+
const noise6 = sin$1(uv.x.mul(noiseScale.mul(float$1(3.2))).add(animTime.mul(float$1(1.1)))).add(sin$1(uv.y.mul(noiseScale.mul(float$1(3.5))).sub(animTime.mul(float$1(.4))))).mul(float$1(.04)).mul(deformation).mul(smoothstep(float$1(.75), float$1(.85), edgeComplexity));
|
|
191
|
+
const noiseAmount = noise1.add(noise2).add(noise3).add(noise4).add(noise5).add(noise6);
|
|
192
|
+
const organicRadius = baseRadius.add(noiseAmount);
|
|
193
|
+
const blobMask = pow$1(smoothstep(organicRadius.add(edgeWidth), organicRadius.sub(edgeWidth), dist), edgeCurve);
|
|
194
|
+
const distFromCenter = length(uv);
|
|
195
|
+
const sphereRadius = organicRadius;
|
|
196
|
+
const normalTilt = smoothstep(float$1(0), sphereRadius, distFromCenter);
|
|
197
|
+
const fakeZ = float$1(1).sub(normalTilt.mul(float$1(.1)));
|
|
198
|
+
const surfaceNormal = normalize(vec3$1(uv.x.mul(normalTilt.add(float$1(.2))), uv.y.mul(normalTilt.add(float$1(.2))), fakeZ));
|
|
199
|
+
const lightDir = normalize(vec3$1(highlightX, highlightY, highlightZ));
|
|
200
|
+
const viewDir = vec3$1(float$1(0), float$1(0), float$1(1));
|
|
201
|
+
const reflectDir = reflect(lightDir.negate(), surfaceNormal);
|
|
202
|
+
const specularPower = float$1(32);
|
|
203
|
+
const specular = pow$1(max$1(float$1(0), dot$1(reflectDir, viewDir)), specularPower);
|
|
204
|
+
const curvatureBoost = normalTilt.mul(float$1(.5)).add(float$1(.5));
|
|
205
|
+
const finalHighlight = specular.mul(curvatureBoost).mul(highlightIntensity).mul(blobMask);
|
|
206
|
+
const posX = uv.x.mul(float$1(3));
|
|
207
|
+
const posY = uv.y.mul(float$1(3));
|
|
208
|
+
const colorNoise1 = sin$1(posX.add(animTime.mul(float$1(.4)))).mul(sin$1(posY.add(animTime.mul(float$1(.3))))).add(sin$1(posX.mul(float$1(.7)).add(posY.mul(float$1(.8))).add(animTime.mul(float$1(.2))))).mul(float$1(.5)).add(float$1(.5));
|
|
209
|
+
const colorNoise2 = sin$1(posX.mul(float$1(1.3)).sub(animTime.mul(float$1(.5)))).mul(sin$1(posY.mul(float$1(1.1)).add(animTime.mul(float$1(.6))))).add(sin$1(posX.mul(float$1(.5)).sub(posY.mul(float$1(.6)).sub(animTime.mul(float$1(.3)))))).mul(float$1(.5)).add(float$1(.5));
|
|
210
|
+
const combinedNoise = colorNoise1.mul(float$1(.6)).add(colorNoise2.mul(float$1(.4)));
|
|
211
|
+
const finalColorRGB = mixColors(colorA, colorB, smoothstep(float$1(.1), float$1(.9), combinedNoise), uniforms.colorSpace.uniform).rgb;
|
|
212
|
+
const avgAlpha = colorA.a.add(colorB.a).div(float$1(2));
|
|
213
|
+
const highlightContribution = highlightColor.rgb.mul(finalHighlight);
|
|
214
|
+
return vec4$1(finalColorRGB.add(highlightContribution), avgAlpha.mul(blobMask));
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
var Blob_default = componentDefinition;
|
|
218
|
+
export { componentDefinition as n, Blob_default as t };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as TSL from "three/tsl";
|
|
2
|
+
const componentDefinition = {
|
|
3
|
+
name: "Blur",
|
|
4
|
+
category: "Blurs",
|
|
5
|
+
description: "A simple Gaussian blur effect",
|
|
6
|
+
requiresRTT: true,
|
|
7
|
+
requiresChild: true,
|
|
8
|
+
props: { intensity: {
|
|
9
|
+
default: 50,
|
|
10
|
+
description: "Intensity of the blur effect",
|
|
11
|
+
ui: {
|
|
12
|
+
type: "range",
|
|
13
|
+
min: 0,
|
|
14
|
+
max: 100,
|
|
15
|
+
step: 1,
|
|
16
|
+
label: "Intensity"
|
|
17
|
+
}
|
|
18
|
+
} },
|
|
19
|
+
fragmentNode: ({ uniforms, childNode, onCleanup }) => {
|
|
20
|
+
const { vec2: vec2$1, vec4: vec4$1, float: float$1, screenUV: screenUV$1, convertToTexture: convertToTexture$1, viewportSize: viewportSize$1, Fn } = TSL;
|
|
21
|
+
if (!childNode) return vec4$1(0, 0, 0, 0);
|
|
22
|
+
const childTexture = convertToTexture$1(childNode);
|
|
23
|
+
onCleanup(() => {
|
|
24
|
+
if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
|
|
25
|
+
});
|
|
26
|
+
const weights = [
|
|
27
|
+
.056,
|
|
28
|
+
.135,
|
|
29
|
+
.278,
|
|
30
|
+
.487,
|
|
31
|
+
.726,
|
|
32
|
+
.923,
|
|
33
|
+
1,
|
|
34
|
+
.923,
|
|
35
|
+
.726,
|
|
36
|
+
.487,
|
|
37
|
+
.278,
|
|
38
|
+
.135,
|
|
39
|
+
.056
|
|
40
|
+
];
|
|
41
|
+
const weightSum = 6.214;
|
|
42
|
+
const scaledIntensity = uniforms.intensity.uniform.mul(.06);
|
|
43
|
+
const horizontalTexture = convertToTexture$1(Fn(() => {
|
|
44
|
+
const uv = screenUV$1;
|
|
45
|
+
const blurRadius = scaledIntensity;
|
|
46
|
+
const pixelSize = vec2$1(1).div(viewportSize$1);
|
|
47
|
+
const total = vec4$1(0).toVar();
|
|
48
|
+
for (let x = -6; x <= 6; x++) {
|
|
49
|
+
const weight = float$1(weights[x + 6] / weightSum);
|
|
50
|
+
const offset = vec2$1(float$1(x), float$1(0)).mul(blurRadius).mul(pixelSize);
|
|
51
|
+
const sampleCoord = uv.add(offset);
|
|
52
|
+
const sample = childTexture.sample(sampleCoord).mul(weight);
|
|
53
|
+
total.assign(total.add(sample));
|
|
54
|
+
}
|
|
55
|
+
return total;
|
|
56
|
+
})());
|
|
57
|
+
onCleanup(() => {
|
|
58
|
+
if (horizontalTexture?.renderTarget?.dispose) horizontalTexture.renderTarget.dispose();
|
|
59
|
+
});
|
|
60
|
+
return Fn(() => {
|
|
61
|
+
const uv = screenUV$1;
|
|
62
|
+
const blurRadius = scaledIntensity;
|
|
63
|
+
const pixelSize = vec2$1(1).div(viewportSize$1);
|
|
64
|
+
const total = vec4$1(0).toVar();
|
|
65
|
+
for (let y = -6; y <= 6; y++) {
|
|
66
|
+
const weight = float$1(weights[y + 6] / weightSum);
|
|
67
|
+
const offset = vec2$1(float$1(0), float$1(y)).mul(blurRadius).mul(pixelSize);
|
|
68
|
+
const sampleCoord = uv.add(offset);
|
|
69
|
+
const sample = horizontalTexture.sample(sampleCoord).mul(weight);
|
|
70
|
+
total.assign(total.add(sample));
|
|
71
|
+
}
|
|
72
|
+
return total;
|
|
73
|
+
})();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var Blur_default = componentDefinition;
|
|
77
|
+
export { componentDefinition as n, Blur_default as t };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { t as applyEdgeHandling } from "./edges-Bn_OIa_h.js";
|
|
2
|
+
import { a as transformEdges, o as transformPosition } from "./transformations-DxfQXZWi.js";
|
|
3
|
+
import * as TSL from "three/tsl";
|
|
4
|
+
const componentDefinition = {
|
|
5
|
+
name: "Bulge",
|
|
6
|
+
category: "Distortions",
|
|
7
|
+
description: "Magnify or pinch content around a center point",
|
|
8
|
+
requiresRTT: true,
|
|
9
|
+
requiresChild: true,
|
|
10
|
+
props: {
|
|
11
|
+
center: {
|
|
12
|
+
default: {
|
|
13
|
+
x: .5,
|
|
14
|
+
y: .5
|
|
15
|
+
},
|
|
16
|
+
transform: transformPosition,
|
|
17
|
+
description: "The center point of the bulge effect",
|
|
18
|
+
ui: {
|
|
19
|
+
type: "position",
|
|
20
|
+
label: "Center"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
strength: {
|
|
24
|
+
default: 1,
|
|
25
|
+
description: "The intensity of the bulge effect (positive = bulge out, negative = pinch in)",
|
|
26
|
+
ui: {
|
|
27
|
+
type: "range",
|
|
28
|
+
min: -1,
|
|
29
|
+
max: 1,
|
|
30
|
+
step: .01,
|
|
31
|
+
label: "Strength"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
radius: {
|
|
35
|
+
default: 1,
|
|
36
|
+
description: "The radius of the bulge effect area",
|
|
37
|
+
ui: {
|
|
38
|
+
type: "range",
|
|
39
|
+
min: 0,
|
|
40
|
+
max: 5,
|
|
41
|
+
step: .01,
|
|
42
|
+
label: "Radius"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
falloff: {
|
|
46
|
+
default: .5,
|
|
47
|
+
description: "Controls the smoothness of the transition (0 = hard edge, 1 = very smooth)",
|
|
48
|
+
ui: {
|
|
49
|
+
type: "range",
|
|
50
|
+
min: 0,
|
|
51
|
+
max: 1,
|
|
52
|
+
step: .01,
|
|
53
|
+
label: "Falloff"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
edges: {
|
|
57
|
+
default: "stretch",
|
|
58
|
+
description: "How to handle edges when distortion pushes content out of bounds",
|
|
59
|
+
transform: transformEdges,
|
|
60
|
+
ui: {
|
|
61
|
+
type: "select",
|
|
62
|
+
options: [
|
|
63
|
+
{
|
|
64
|
+
label: "Stretch",
|
|
65
|
+
value: "stretch"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: "Transparent",
|
|
69
|
+
value: "transparent"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: "Mirror",
|
|
73
|
+
value: "mirror"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: "Wrap",
|
|
77
|
+
value: "wrap"
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
label: "Edges"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
uvTransformNode: ({ uv, uniforms, viewportSize: viewportSize$1 }) => {
|
|
85
|
+
const { vec2: vec2$1, length, smoothstep, float: float$1, max: max$1 } = TSL;
|
|
86
|
+
const aspect = viewportSize$1.x.div(viewportSize$1.y);
|
|
87
|
+
const aspectCorrectedUV = vec2$1(uv.x.mul(aspect), uv.y);
|
|
88
|
+
const centerPos = vec2$1(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus());
|
|
89
|
+
const delta = aspectCorrectedUV.sub(centerPos);
|
|
90
|
+
const distance = length(delta);
|
|
91
|
+
const effectRadius = uniforms.radius.uniform.mul(.5);
|
|
92
|
+
const falloffAmount = uniforms.falloff.uniform;
|
|
93
|
+
const smoothFalloff = smoothstep(effectRadius.mul(float$1(1).sub(falloffAmount).sub(float$1(.001)).max(float$1(0))), effectRadius, distance).oneMinus();
|
|
94
|
+
const normalizedDist = distance.div(effectRadius);
|
|
95
|
+
const distSq = normalizedDist.mul(normalizedDist);
|
|
96
|
+
const quadraticFalloff = max$1(float$1(0), float$1(1).sub(distSq));
|
|
97
|
+
const falloff = smoothFalloff.mul(quadraticFalloff);
|
|
98
|
+
const displacementAmount = uniforms.strength.uniform.negate().mul(falloff);
|
|
99
|
+
const scaleFactor = float$1(1).add(displacementAmount);
|
|
100
|
+
const bulgedDelta = delta.mul(scaleFactor);
|
|
101
|
+
const bulgedUV = centerPos.add(bulgedDelta);
|
|
102
|
+
return vec2$1(bulgedUV.x.div(aspect), bulgedUV.y);
|
|
103
|
+
},
|
|
104
|
+
fragmentNode: ({ uniforms, childNode, onCleanup }) => {
|
|
105
|
+
const { vec2: vec2$1, vec4: vec4$1, length, screenUV: screenUV$1, viewportSize: viewportSize$1, convertToTexture: convertToTexture$1, smoothstep } = TSL;
|
|
106
|
+
if (!childNode) return vec4$1(0, 0, 0, 0);
|
|
107
|
+
const childTexture = convertToTexture$1(childNode);
|
|
108
|
+
onCleanup(() => {
|
|
109
|
+
if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
|
|
110
|
+
});
|
|
111
|
+
const aspect = viewportSize$1.x.div(viewportSize$1.y);
|
|
112
|
+
const aspectCorrectedUV = vec2$1(screenUV$1.x.mul(aspect), screenUV$1.y);
|
|
113
|
+
const centerPos = vec2$1(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus());
|
|
114
|
+
const delta = aspectCorrectedUV.sub(centerPos);
|
|
115
|
+
const distance = length(delta);
|
|
116
|
+
const effectRadius = uniforms.radius.uniform.mul(.5);
|
|
117
|
+
const falloffAmount = uniforms.falloff.uniform;
|
|
118
|
+
const smoothFalloff = smoothstep(effectRadius.mul(TSL.float(1).sub(falloffAmount).sub(TSL.float(.001)).max(TSL.float(0))), effectRadius, distance).oneMinus();
|
|
119
|
+
const normalizedDist = distance.div(effectRadius);
|
|
120
|
+
const distSq = normalizedDist.mul(normalizedDist);
|
|
121
|
+
const quadraticFalloff = TSL.max(TSL.float(0), TSL.float(1).sub(distSq));
|
|
122
|
+
const falloff = smoothFalloff.mul(quadraticFalloff);
|
|
123
|
+
const displacementAmount = uniforms.strength.uniform.negate().mul(falloff);
|
|
124
|
+
const scaleFactor = TSL.float(1).add(displacementAmount);
|
|
125
|
+
const bulgedDelta = delta.mul(scaleFactor);
|
|
126
|
+
const bulgedUV = centerPos.add(bulgedDelta);
|
|
127
|
+
const finalUV = vec2$1(bulgedUV.x.div(aspect), bulgedUV.y);
|
|
128
|
+
return applyEdgeHandling(finalUV, childTexture.sample(finalUV), childTexture, uniforms.edges.uniform);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
var Bulge_default = componentDefinition;
|
|
132
|
+
export { componentDefinition as n, Bulge_default as t };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import * as TSL from "three/tsl";
|
|
2
|
+
const componentDefinition = {
|
|
3
|
+
name: "CRTScreen",
|
|
4
|
+
category: "Stylize",
|
|
5
|
+
description: "Retro CRT monitor simulation with scanlines",
|
|
6
|
+
requiresRTT: true,
|
|
7
|
+
requiresChild: true,
|
|
8
|
+
props: {
|
|
9
|
+
pixelSize: {
|
|
10
|
+
default: 128,
|
|
11
|
+
description: "Size of individual TV pixels (lower = more pixels)",
|
|
12
|
+
ui: {
|
|
13
|
+
type: "range",
|
|
14
|
+
min: 8,
|
|
15
|
+
max: 128,
|
|
16
|
+
step: 1,
|
|
17
|
+
label: "Pixel Size"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
colorShift: {
|
|
21
|
+
default: 1,
|
|
22
|
+
description: "Chromatic aberration amount",
|
|
23
|
+
ui: {
|
|
24
|
+
type: "range",
|
|
25
|
+
min: 0,
|
|
26
|
+
max: 10,
|
|
27
|
+
step: .1,
|
|
28
|
+
label: "Color Shift"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
scanlineIntensity: {
|
|
32
|
+
default: .3,
|
|
33
|
+
description: "Strength of horizontal scanlines",
|
|
34
|
+
ui: {
|
|
35
|
+
type: "range",
|
|
36
|
+
min: 0,
|
|
37
|
+
max: 1,
|
|
38
|
+
step: .01,
|
|
39
|
+
label: "Scanline Intensity"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
scanlineFrequency: {
|
|
43
|
+
default: 200,
|
|
44
|
+
description: "Number of scanlines across screen",
|
|
45
|
+
ui: {
|
|
46
|
+
type: "range",
|
|
47
|
+
min: 100,
|
|
48
|
+
max: 800,
|
|
49
|
+
step: 10,
|
|
50
|
+
label: "Scanline Frequency"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
brightness: {
|
|
54
|
+
default: 1.1,
|
|
55
|
+
description: "Screen brightness boost",
|
|
56
|
+
ui: {
|
|
57
|
+
type: "range",
|
|
58
|
+
min: .5,
|
|
59
|
+
max: 2,
|
|
60
|
+
step: .01,
|
|
61
|
+
label: "Brightness"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
contrast: {
|
|
65
|
+
default: 1.2,
|
|
66
|
+
description: "Screen contrast enhancement",
|
|
67
|
+
ui: {
|
|
68
|
+
type: "range",
|
|
69
|
+
min: .5,
|
|
70
|
+
max: 2,
|
|
71
|
+
step: .01,
|
|
72
|
+
label: "Contrast"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
fragmentNode: ({ uniforms, childNode, onCleanup }) => {
|
|
77
|
+
const { vec2: vec2$1, vec3: vec3$1, vec4: vec4$1, float: float$1, screenUV: screenUV$1, sin: sin$1, fract, smoothstep, length, convertToTexture: convertToTexture$1 } = TSL;
|
|
78
|
+
if (!childNode) return vec4$1(0, 0, 0, 0);
|
|
79
|
+
const childTexture = convertToTexture$1(childNode);
|
|
80
|
+
onCleanup(() => {
|
|
81
|
+
if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
|
|
82
|
+
});
|
|
83
|
+
const pixelSize = uniforms.pixelSize.uniform;
|
|
84
|
+
const colorShift = uniforms.colorShift.uniform;
|
|
85
|
+
const scanlineIntensity = uniforms.scanlineIntensity.uniform;
|
|
86
|
+
const scanlineFrequency = uniforms.scanlineFrequency.uniform;
|
|
87
|
+
const brightness = uniforms.brightness.uniform;
|
|
88
|
+
const contrast = uniforms.contrast.uniform;
|
|
89
|
+
const scaledColorShift = colorShift.mul(float$1(.002));
|
|
90
|
+
const redUV = screenUV$1.add(vec2$1(scaledColorShift, float$1(0)));
|
|
91
|
+
const greenUV = screenUV$1;
|
|
92
|
+
const blueUV = screenUV$1.sub(vec2$1(scaledColorShift, float$1(0)));
|
|
93
|
+
const redSample = childTexture.sample(redUV).r;
|
|
94
|
+
const greenSample = childTexture.sample(greenUV).g;
|
|
95
|
+
const blueSample = childTexture.sample(blueUV).b;
|
|
96
|
+
const adjustedColor = vec3$1(redSample, greenSample, blueSample).sub(float$1(.5)).mul(contrast).add(float$1(.5)).mul(brightness);
|
|
97
|
+
const scanlineWave = sin$1(screenUV$1.y.mul(scanlineFrequency).mul(float$1(3.14159 * 2)));
|
|
98
|
+
const scanlineEffect = float$1(1).sub(scanlineIntensity.mul(scanlineWave.mul(float$1(.5)).add(float$1(.5))));
|
|
99
|
+
const scanlinedColor = adjustedColor.mul(scanlineEffect);
|
|
100
|
+
const phosphorScale = pixelSize.mul(float$1(.5));
|
|
101
|
+
const pixelPhase = fract(screenUV$1.mul(phosphorScale));
|
|
102
|
+
const redMask = sin$1(pixelPhase.x.mul(float$1(6.28318))).mul(float$1(.1)).add(float$1(.95));
|
|
103
|
+
const greenMask = sin$1(pixelPhase.x.mul(float$1(6.28318)).add(float$1(2.09))).mul(float$1(.1)).add(float$1(.95));
|
|
104
|
+
const blueMask = sin$1(pixelPhase.x.mul(float$1(6.28318)).add(float$1(4.18))).mul(float$1(.1)).add(float$1(.95));
|
|
105
|
+
const phosphorColor = vec3$1(scanlinedColor.r.mul(redMask), scanlinedColor.g.mul(greenMask), scanlinedColor.b.mul(blueMask));
|
|
106
|
+
const vignetteDistance = length(screenUV$1.sub(vec2$1(.5, .5)));
|
|
107
|
+
const vignette = smoothstep(float$1(.8), float$1(.3), vignetteDistance);
|
|
108
|
+
return vec4$1(phosphorColor.mul(vignette), float$1(1));
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
var CRTScreen_default = componentDefinition;
|
|
112
|
+
export { componentDefinition as n, CRTScreen_default as t };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import * as TSL from "three/tsl";
|
|
2
|
+
const componentDefinition = {
|
|
3
|
+
name: "ChannelBlur",
|
|
4
|
+
category: "Blurs",
|
|
5
|
+
description: "Independent blur for red, green, and blue channels",
|
|
6
|
+
requiresRTT: true,
|
|
7
|
+
requiresChild: true,
|
|
8
|
+
props: {
|
|
9
|
+
redIntensity: {
|
|
10
|
+
default: 0,
|
|
11
|
+
description: "Blur intensity for red channel",
|
|
12
|
+
ui: {
|
|
13
|
+
type: "range",
|
|
14
|
+
min: 0,
|
|
15
|
+
max: 100,
|
|
16
|
+
step: 1,
|
|
17
|
+
label: "Red Intensity"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
greenIntensity: {
|
|
21
|
+
default: 20,
|
|
22
|
+
description: "Blur intensity for green channel",
|
|
23
|
+
ui: {
|
|
24
|
+
type: "range",
|
|
25
|
+
min: 0,
|
|
26
|
+
max: 100,
|
|
27
|
+
step: 1,
|
|
28
|
+
label: "Green Intensity"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
blueIntensity: {
|
|
32
|
+
default: 40,
|
|
33
|
+
description: "Blur intensity for blue channel",
|
|
34
|
+
ui: {
|
|
35
|
+
type: "range",
|
|
36
|
+
min: 0,
|
|
37
|
+
max: 100,
|
|
38
|
+
step: 1,
|
|
39
|
+
label: "Blue Intensity"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
fragmentNode: ({ uniforms, childNode, onCleanup }) => {
|
|
44
|
+
const { vec2: vec2$1, vec4: vec4$1, float: float$1, screenUV: screenUV$1, convertToTexture: convertToTexture$1, viewportSize: viewportSize$1, Fn } = TSL;
|
|
45
|
+
if (!childNode) return vec4$1(0, 0, 0, 0);
|
|
46
|
+
const childTexture = convertToTexture$1(childNode);
|
|
47
|
+
onCleanup(() => {
|
|
48
|
+
if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
|
|
49
|
+
});
|
|
50
|
+
const weights = [
|
|
51
|
+
.056,
|
|
52
|
+
.135,
|
|
53
|
+
.278,
|
|
54
|
+
.487,
|
|
55
|
+
.726,
|
|
56
|
+
.923,
|
|
57
|
+
1,
|
|
58
|
+
.923,
|
|
59
|
+
.726,
|
|
60
|
+
.487,
|
|
61
|
+
.278,
|
|
62
|
+
.135,
|
|
63
|
+
.056
|
|
64
|
+
];
|
|
65
|
+
const weightSum = 6.214;
|
|
66
|
+
const redRadius = uniforms.redIntensity.uniform.mul(.1);
|
|
67
|
+
const greenRadius = uniforms.greenIntensity.uniform.mul(.1);
|
|
68
|
+
const blueRadius = uniforms.blueIntensity.uniform.mul(.1);
|
|
69
|
+
const horizontalTexture = convertToTexture$1(Fn(() => {
|
|
70
|
+
const uv = screenUV$1;
|
|
71
|
+
const pixelSize = vec2$1(1).div(viewportSize$1);
|
|
72
|
+
const redTotal = float$1(0).toVar();
|
|
73
|
+
const greenTotal = float$1(0).toVar();
|
|
74
|
+
const blueTotal = float$1(0).toVar();
|
|
75
|
+
for (let x = -6; x <= 6; x++) {
|
|
76
|
+
const weight = float$1(weights[x + 6] / weightSum);
|
|
77
|
+
const xOffset = float$1(x).mul(pixelSize.x);
|
|
78
|
+
const redOffset = vec2$1(xOffset.mul(redRadius), float$1(0));
|
|
79
|
+
const greenOffset = vec2$1(xOffset.mul(greenRadius), float$1(0));
|
|
80
|
+
const blueOffset = vec2$1(xOffset.mul(blueRadius), float$1(0));
|
|
81
|
+
const redSample = childTexture.sample(uv.add(redOffset)).r.mul(weight);
|
|
82
|
+
const greenSample = childTexture.sample(uv.add(greenOffset)).g.mul(weight);
|
|
83
|
+
const blueSample = childTexture.sample(uv.add(blueOffset)).b.mul(weight);
|
|
84
|
+
redTotal.assign(redTotal.add(redSample));
|
|
85
|
+
greenTotal.assign(greenTotal.add(greenSample));
|
|
86
|
+
blueTotal.assign(blueTotal.add(blueSample));
|
|
87
|
+
}
|
|
88
|
+
return vec4$1(redTotal, greenTotal, blueTotal, float$1(1));
|
|
89
|
+
})());
|
|
90
|
+
onCleanup(() => {
|
|
91
|
+
if (horizontalTexture?.renderTarget?.dispose) horizontalTexture.renderTarget.dispose();
|
|
92
|
+
});
|
|
93
|
+
return Fn(() => {
|
|
94
|
+
const uv = screenUV$1;
|
|
95
|
+
const pixelSize = vec2$1(1).div(viewportSize$1);
|
|
96
|
+
const redTotal = float$1(0).toVar();
|
|
97
|
+
const greenTotal = float$1(0).toVar();
|
|
98
|
+
const blueTotal = float$1(0).toVar();
|
|
99
|
+
for (let y = -6; y <= 6; y++) {
|
|
100
|
+
const weight = float$1(weights[y + 6] / weightSum);
|
|
101
|
+
const yOffset = float$1(y).mul(pixelSize.y);
|
|
102
|
+
const redOffset = vec2$1(float$1(0), yOffset.mul(redRadius));
|
|
103
|
+
const greenOffset = vec2$1(float$1(0), yOffset.mul(greenRadius));
|
|
104
|
+
const blueOffset = vec2$1(float$1(0), yOffset.mul(blueRadius));
|
|
105
|
+
const redSample = horizontalTexture.sample(uv.add(redOffset)).r.mul(weight);
|
|
106
|
+
const greenSample = horizontalTexture.sample(uv.add(greenOffset)).g.mul(weight);
|
|
107
|
+
const blueSample = horizontalTexture.sample(uv.add(blueOffset)).b.mul(weight);
|
|
108
|
+
redTotal.assign(redTotal.add(redSample));
|
|
109
|
+
greenTotal.assign(greenTotal.add(greenSample));
|
|
110
|
+
blueTotal.assign(blueTotal.add(blueSample));
|
|
111
|
+
}
|
|
112
|
+
const originalAlpha = childTexture.sample(uv).a;
|
|
113
|
+
return vec4$1(redTotal, greenTotal, blueTotal, originalAlpha);
|
|
114
|
+
})();
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
var ChannelBlur_default = componentDefinition;
|
|
118
|
+
export { componentDefinition as n, ChannelBlur_default as t };
|