shaders 2.5.101 → 2.5.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/core/{FilmGrain-yBeLmqwl.js → FilmGrain-DSJiMtEp.js} +3 -3
  2. package/dist/core/Halftone-XFa7by1s.js +287 -0
  3. package/dist/core/VHS-CQJ1hV_D.js +123 -0
  4. package/dist/core/{VideoTexture-DJrkry82.js → VideoTexture-DnHIs4pp.js} +1 -1
  5. package/dist/core/{WebcamTexture-Cf8J7JB1.js → WebcamTexture-XBDo2kgN.js} +1 -1
  6. package/dist/core/index.js +13 -12
  7. package/dist/core/registry.js +13 -12
  8. package/dist/core/{shaderRegistry-X16MNgs8.js → shaderRegistry-BWuH2me2.js} +20 -18
  9. package/dist/core/shaderRegistry.d.ts.map +1 -1
  10. package/dist/core/shaders/FilmGrain/index.d.ts.map +1 -1
  11. package/dist/core/shaders/FilmGrain/index.js +1 -1
  12. package/dist/core/shaders/Halftone/index.d.ts +76 -4
  13. package/dist/core/shaders/Halftone/index.d.ts.map +1 -1
  14. package/dist/core/shaders/Halftone/index.js +2 -1
  15. package/dist/core/shaders/VHS/index.d.ts +32 -0
  16. package/dist/core/shaders/VHS/index.d.ts.map +1 -0
  17. package/dist/core/shaders/VHS/index.js +3 -0
  18. package/dist/core/shaders/Vibrance/index.js +1 -1
  19. package/dist/core/shaders/VideoTexture/index.js +2 -2
  20. package/dist/core/shaders/Vignette/index.js +1 -1
  21. package/dist/core/shaders/Voronoi/index.js +1 -1
  22. package/dist/core/shaders/WaveDistortion/index.js +1 -1
  23. package/dist/core/shaders/Weave/index.js +1 -1
  24. package/dist/core/shaders/WebcamTexture/index.js +2 -2
  25. package/dist/core/shaders/ZoomBlur/index.js +1 -1
  26. package/dist/js/createShader.js +1 -1
  27. package/dist/js/utils/generatePresetCode.d.ts.map +1 -1
  28. package/dist/js/utils/generatePresetCode.js +21 -1
  29. package/dist/react/Preview.js +1 -0
  30. package/dist/react/Shader.js +1 -1
  31. package/dist/react/VHS.js +223 -0
  32. package/dist/react/components/Halftone.d.ts +7 -2
  33. package/dist/react/components/Halftone.d.ts.map +1 -1
  34. package/dist/react/components/VHS.d.ts +35 -0
  35. package/dist/react/components/VHS.d.ts.map +1 -0
  36. package/dist/react/engine/Preview.d.ts.map +1 -1
  37. package/dist/react/index.d.ts +1 -0
  38. package/dist/react/index.d.ts.map +1 -1
  39. package/dist/react/index.js +2 -1
  40. package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
  41. package/dist/react/utils/generatePresetCode.js +21 -1
  42. package/dist/registry.js +500 -16
  43. package/dist/solid/components/Halftone.d.ts +7 -2
  44. package/dist/solid/components/Halftone.d.ts.map +1 -1
  45. package/dist/solid/components/VHS.d.ts +32 -0
  46. package/dist/solid/components/VHS.d.ts.map +1 -0
  47. package/dist/solid/components/VHS.js +228 -0
  48. package/dist/solid/engine/Preview.d.ts.map +1 -1
  49. package/dist/solid/engine/Preview.js +190 -188
  50. package/dist/solid/engine/Shader.js +1 -1
  51. package/dist/solid/index.d.ts +1 -0
  52. package/dist/solid/index.d.ts.map +1 -1
  53. package/dist/solid/index.js +24 -22
  54. package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
  55. package/dist/solid/utils/generatePresetCode.js +21 -1
  56. package/dist/svelte/components/Halftone.svelte.d.ts +6 -1
  57. package/dist/svelte/components/VHS.svelte.d.ts +22 -0
  58. package/dist/svelte/{generatePresetCode-Cdho2JhN.js → generatePresetCode-psTzYsW3.js} +21 -1
  59. package/dist/svelte/index.d.ts +1 -0
  60. package/dist/svelte/index.js +631 -431
  61. package/dist/svelte/source/components/Halftone.svelte +6 -1
  62. package/dist/svelte/source/components/VHS.svelte +328 -0
  63. package/dist/svelte/source/engine/Preview.svelte +2 -0
  64. package/dist/svelte/source/index.js +1 -0
  65. package/dist/svelte/utils/generatePresetCode.js +1 -1
  66. package/dist/vue/Halftone.vue_vue_type_script_setup_true_lang.js +13 -2
  67. package/dist/vue/Preview.vue_vue_type_script_setup_true_lang.js +2 -0
  68. package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +1 -1
  69. package/dist/vue/VHS.js +3 -0
  70. package/dist/vue/VHS.vue_vue_type_script_setup_true_lang.js +216 -0
  71. package/dist/vue/components/Halftone.vue.d.ts +6 -1
  72. package/dist/vue/components/Halftone.vue.d.ts.map +1 -1
  73. package/dist/vue/components/VHS.vue.d.ts +57 -0
  74. package/dist/vue/components/VHS.vue.d.ts.map +1 -0
  75. package/dist/vue/index.d.ts +1 -0
  76. package/dist/vue/index.d.ts.map +1 -1
  77. package/dist/vue/index.js +2 -1
  78. package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
  79. package/dist/vue/utils/generatePresetCode.js +21 -1
  80. package/package.json +9 -1
  81. package/dist/core/Halftone-BVL2oy37.js +0 -67
  82. /package/dist/core/{Vibrance-dqIV6GBe.js → Vibrance-CGvYDeds.js} +0 -0
  83. /package/dist/core/{Vignette-DB1wO1dm.js → Vignette-BJaonUVL.js} +0 -0
  84. /package/dist/core/{Voronoi-C3WIJFWc.js → Voronoi-DZemzWA4.js} +0 -0
  85. /package/dist/core/{WaveDistortion-BKma8-Ju.js → WaveDistortion--Y-m667K.js} +0 -0
  86. /package/dist/core/{Weave-xuu_vQ5e.js → Weave-CtyohvHz.js} +0 -0
  87. /package/dist/core/{ZoomBlur-UcS2iFT2.js → ZoomBlur-BwkhsFRE.js} +0 -0
  88. /package/dist/core/{browser-ClWxLlIB.js → browser-DTNngPey.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { clamp, dot, float, floor, fract, pow, screenUV, sin, uniform, vec2, vec3, vec4, viewportSize } from "three/tsl";
1
+ import { clamp, dot, float, fract, pow, sin, uniform, vec2, vec3, vec4, viewportCoordinate } from "three/tsl";
2
2
  const componentDefinition = {
3
3
  name: "FilmGrain",
4
4
  category: "Stylize",
@@ -49,8 +49,8 @@ const componentDefinition = {
49
49
  onBeforeRender(({ deltaTime }) => {
50
50
  animTime.value += deltaTime * animated.value * 10;
51
51
  });
52
- const grain = fract(sin(dot(floor(screenUV.mul(viewportSize)), vec2(1, 157)).add(animTime)).mul(float(43758.5453))).mul(float(2)).sub(float(1));
53
- const brightness = clamp(dot(sourceColor.rgb, vec3(.299, .587, .114)), 0, 1);
52
+ const grain = fract(sin(dot(viewportCoordinate, vec2(12.9898, 78.233)).add(animTime)).mul(float(43758.5453))).mul(float(2)).sub(float(1));
53
+ const brightness = clamp(dot(sourceColor.rgb, vec3(.2126, .7152, .0722)), 0, 1);
54
54
  const darkFactor = pow(float(1).sub(brightness).add(float(1e-6)), bias);
55
55
  const grainIntensity = grain.mul(darkFactor).mul(strength.mul(float(.1)));
56
56
  return vec4(sourceColor.rgb.add(grainIntensity), sourceColor.a);
@@ -0,0 +1,287 @@
1
+ import { a as transformColor, r as transformAngle } from "./transformations-B5lM6fYX.js";
2
+ import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
3
+ import { convertToTexture, cos, dot, float, fract, length, max, mix, radians, screenUV, sin, smoothstep, vec2, vec3, vec4, viewportSize } from "three/tsl";
4
+ var transformStyle = (value) => {
5
+ return value === "cmyk" ? 1 : 0;
6
+ };
7
+ const componentDefinition = {
8
+ name: "Halftone",
9
+ category: "Stylize",
10
+ description: "Halftone dot pattern effect for printing aesthetics",
11
+ requiresRTT: true,
12
+ requiresChild: true,
13
+ props: {
14
+ style: {
15
+ default: "classic",
16
+ transform: transformStyle,
17
+ compileTime: true,
18
+ description: "Halftone rendering style",
19
+ ui: {
20
+ type: "select",
21
+ options: [{
22
+ label: "Simple",
23
+ value: "classic"
24
+ }, {
25
+ label: "CMYK Print",
26
+ value: "cmyk"
27
+ }],
28
+ label: "Style",
29
+ group: "Effect"
30
+ }
31
+ },
32
+ frequency: {
33
+ default: 100,
34
+ description: "Frequency of the halftone dots",
35
+ ui: {
36
+ type: ["range", "map"],
37
+ min: 10,
38
+ max: 300,
39
+ step: 1,
40
+ label: "Frequency",
41
+ group: "Effect"
42
+ }
43
+ },
44
+ angle: {
45
+ default: 45,
46
+ transform: transformAngle,
47
+ description: "Rotation angle of the pattern (in degrees)",
48
+ ui: {
49
+ type: ["range", "map"],
50
+ min: 0,
51
+ max: 360,
52
+ step: 1,
53
+ label: "Angle",
54
+ group: "Effect",
55
+ condition: { style: "classic" }
56
+ }
57
+ },
58
+ cyanAngle: {
59
+ default: 15,
60
+ transform: transformAngle,
61
+ description: "Screen angle for the cyan plate (in degrees)",
62
+ ui: {
63
+ type: ["range", "map"],
64
+ min: 0,
65
+ max: 360,
66
+ step: 1,
67
+ label: "Cyan Angle",
68
+ group: "Plate Angles",
69
+ condition: { style: "cmyk" }
70
+ }
71
+ },
72
+ magentaAngle: {
73
+ default: 75,
74
+ transform: transformAngle,
75
+ description: "Screen angle for the magenta plate (in degrees)",
76
+ ui: {
77
+ type: ["range", "map"],
78
+ min: 0,
79
+ max: 360,
80
+ step: 1,
81
+ label: "Magenta Angle",
82
+ group: "Plate Angles",
83
+ condition: { style: "cmyk" }
84
+ }
85
+ },
86
+ yellowAngle: {
87
+ default: 0,
88
+ transform: transformAngle,
89
+ description: "Screen angle for the yellow plate (in degrees)",
90
+ ui: {
91
+ type: ["range", "map"],
92
+ min: 0,
93
+ max: 360,
94
+ step: 1,
95
+ label: "Yellow Angle",
96
+ group: "Plate Angles",
97
+ condition: { style: "cmyk" }
98
+ }
99
+ },
100
+ blackAngle: {
101
+ default: 45,
102
+ transform: transformAngle,
103
+ description: "Screen angle for the black plate (in degrees)",
104
+ ui: {
105
+ type: ["range", "map"],
106
+ min: 0,
107
+ max: 360,
108
+ step: 1,
109
+ label: "Black Angle",
110
+ group: "Plate Angles",
111
+ condition: { style: "cmyk" }
112
+ }
113
+ },
114
+ misprint: {
115
+ default: 0,
116
+ description: "Simulated mis-registration between plates. Plates are offset around the misprint angle, producing colour fringing at the edges of inked regions.",
117
+ ui: {
118
+ type: ["range", "map"],
119
+ min: 0,
120
+ max: .01,
121
+ step: 5e-4,
122
+ label: "Misprint",
123
+ group: "Effect",
124
+ condition: { style: "cmyk" }
125
+ }
126
+ },
127
+ misprintAngle: {
128
+ default: 0,
129
+ transform: transformAngle,
130
+ description: "Direction the plates drift apart. Rotating this rotates the colour-fringing pattern.",
131
+ ui: {
132
+ type: ["range", "map"],
133
+ min: 0,
134
+ max: 360,
135
+ step: 1,
136
+ label: "Misprint Angle",
137
+ group: "Effect",
138
+ condition: { style: "cmyk" }
139
+ }
140
+ },
141
+ paperColor: {
142
+ default: "#ffffff",
143
+ transform: transformColor,
144
+ description: "Paper/substrate color shown where no ink lands",
145
+ ui: {
146
+ type: "color",
147
+ label: "Paper",
148
+ group: "Inks",
149
+ condition: { style: "cmyk" }
150
+ }
151
+ },
152
+ cyanColor: {
153
+ default: "#00ffff",
154
+ transform: transformColor,
155
+ description: "Cyan ink color",
156
+ ui: {
157
+ type: "color",
158
+ label: "Cyan",
159
+ group: "Inks",
160
+ condition: { style: "cmyk" }
161
+ }
162
+ },
163
+ magentaColor: {
164
+ default: "#ff00ff",
165
+ transform: transformColor,
166
+ description: "Magenta ink color",
167
+ ui: {
168
+ type: "color",
169
+ label: "Magenta",
170
+ group: "Inks",
171
+ condition: { style: "cmyk" }
172
+ }
173
+ },
174
+ yellowColor: {
175
+ default: "#ffff00",
176
+ transform: transformColor,
177
+ description: "Yellow ink color",
178
+ ui: {
179
+ type: "color",
180
+ label: "Yellow",
181
+ group: "Inks",
182
+ condition: { style: "cmyk" }
183
+ }
184
+ },
185
+ blackColor: {
186
+ default: "#000000",
187
+ transform: transformColor,
188
+ description: "Black (key) ink color",
189
+ ui: {
190
+ type: "color",
191
+ label: "Black",
192
+ group: "Inks",
193
+ condition: { style: "cmyk" }
194
+ }
195
+ }
196
+ },
197
+ fragmentNode: ({ uniforms, childNode, onCleanup }) => {
198
+ if (!childNode) return vec4(0);
199
+ const frequency = uniforms.frequency.uniform;
200
+ const smoothness = float(.1);
201
+ const aspect = viewportSize.x.div(viewportSize.y);
202
+ const aspectUV = vec2(screenUV.x.mul(aspect), screenUV.y);
203
+ const rotateUV = (uv$1, angleRad) => {
204
+ const c$1 = cos(angleRad);
205
+ const s = sin(angleRad);
206
+ return vec2(dot(uv$1, vec2(c$1, s.negate())), dot(uv$1, vec2(s, c$1)));
207
+ };
208
+ const dotMask = (rotatedUV, intensity) => {
209
+ const dist = length(fract(rotatedUV.mul(frequency)).sub(.5));
210
+ const size = intensity.mul(.75).sub(smoothness);
211
+ return smoothstep(size.sub(smoothness), size.add(smoothness), dist).oneMinus();
212
+ };
213
+ if (uniforms.style.uniform.value === 0) {
214
+ const gridUV = fract(rotateUV(aspectUV, radians(uniforms.angle.uniform)).mul(frequency)).sub(.5);
215
+ const dotSize = dot(childNode.rgb, vec3(.299, .587, .114)).mul(.7).add(.15);
216
+ const dist = length(gridUV);
217
+ const dotPattern = smoothstep(dotSize.sub(smoothness), dotSize.add(smoothness), dist).oneMinus();
218
+ return vec4(childNode.rgb.mul(dotPattern), childNode.a.mul(dotPattern));
219
+ }
220
+ const childTexture = convertToTexture(childNode);
221
+ onCleanup(() => {
222
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
223
+ });
224
+ const misprint = uniforms.misprint.uniform;
225
+ const misprintAngleRad = radians(uniforms.misprintAngle.uniform);
226
+ const cAngleRad = radians(uniforms.cyanAngle.uniform);
227
+ const mAngleRad = radians(uniforms.magentaAngle.uniform);
228
+ const yAngleRad = radians(uniforms.yellowAngle.uniform);
229
+ const kAngleRad = radians(uniforms.blackAngle.uniform);
230
+ const plateOffset = (offsetAngleRad) => {
231
+ return vec2(cos(offsetAngleRad).mul(misprint), sin(offsetAngleRad).mul(misprint).div(aspect));
232
+ };
233
+ const cSampleUV = screenUV.add(plateOffset(misprintAngleRad));
234
+ const mSampleUV = screenUV.add(plateOffset(misprintAngleRad.add(radians(float(90)))));
235
+ const ySampleUV = screenUV.add(plateOffset(misprintAngleRad.add(radians(float(180)))));
236
+ const kSampleUV = screenUV.add(plateOffset(misprintAngleRad.add(radians(float(270)))));
237
+ const cSample = unpremultiplyAlpha(childTexture.sample(cSampleUV));
238
+ const mSample = unpremultiplyAlpha(childTexture.sample(mSampleUV));
239
+ const ySample = unpremultiplyAlpha(childTexture.sample(ySampleUV));
240
+ const kSample = unpremultiplyAlpha(childTexture.sample(kSampleUV));
241
+ const centerSample = unpremultiplyAlpha(childTexture.sample(screenUV));
242
+ const channelK = (s) => float(1).sub(max(max(s.r, s.g), s.b));
243
+ const channelC = (s) => {
244
+ const k$1 = channelK(s);
245
+ const invK = float(1).sub(k$1).max(float(1e-4));
246
+ return float(1).sub(s.r).sub(k$1).div(invK);
247
+ };
248
+ const channelM = (s) => {
249
+ const k$1 = channelK(s);
250
+ const invK = float(1).sub(k$1).max(float(1e-4));
251
+ return float(1).sub(s.g).sub(k$1).div(invK);
252
+ };
253
+ const channelY = (s) => {
254
+ const k$1 = channelK(s);
255
+ const invK = float(1).sub(k$1).max(float(1e-4));
256
+ return float(1).sub(s.b).sub(k$1).div(invK);
257
+ };
258
+ const c = channelC(cSample);
259
+ const m = channelM(mSample);
260
+ const y = channelY(ySample);
261
+ const k = channelK(kSample);
262
+ const cUV = rotateUV(aspectUV, cAngleRad);
263
+ const mUV = rotateUV(aspectUV, mAngleRad);
264
+ const yUV = rotateUV(aspectUV, yAngleRad);
265
+ const kUV = rotateUV(aspectUV, kAngleRad);
266
+ const cInk = dotMask(cUV, c);
267
+ const mInk = dotMask(mUV, m);
268
+ const yInk = dotMask(yUV, y);
269
+ const kInk = dotMask(kUV, k);
270
+ const paper = uniforms.paperColor.uniform;
271
+ const cyanCol = uniforms.cyanColor.uniform;
272
+ const magentaCol = uniforms.magentaColor.uniform;
273
+ const yellowCol = uniforms.yellowColor.uniform;
274
+ const blackCol = uniforms.blackColor.uniform;
275
+ const transmission = (inkColor, inkMask) => {
276
+ return mix(vec3(1, 1, 1), inkColor.rgb, inkMask.mul(inkColor.a));
277
+ };
278
+ let printed = paper.rgb;
279
+ printed = printed.mul(transmission(cyanCol, cInk));
280
+ printed = printed.mul(transmission(magentaCol, mInk));
281
+ printed = printed.mul(transmission(yellowCol, yInk));
282
+ printed = printed.mul(transmission(blackCol, kInk));
283
+ return vec4(printed, centerSample.a);
284
+ }
285
+ };
286
+ var Halftone_default = componentDefinition;
287
+ export { componentDefinition as n, Halftone_default as t };
@@ -0,0 +1,123 @@
1
+ import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
2
+ import { clamp, convertToTexture, cos, dot, float, floor, fract, mix, mod, screenUV, sin, smoothstep, time, vec2, vec3, vec4 } from "three/tsl";
3
+ var SMEAR_SAMPLES = 6;
4
+ var FIELD_LINES = 487;
5
+ const componentDefinition = {
6
+ name: "VHS",
7
+ category: "Stylize",
8
+ description: "Analog VHS tape with intermittent tape damage, chroma bleed, and per-scanline noise",
9
+ requiresRTT: true,
10
+ requiresChild: true,
11
+ props: {
12
+ wobble: {
13
+ default: 1,
14
+ description: "Overall amount of tape damage — waves, creases, and head-switching noise. Bursts on and off organically over time.",
15
+ ui: {
16
+ type: ["range", "map"],
17
+ min: 0,
18
+ max: 5,
19
+ step: .01,
20
+ label: "Wobble",
21
+ group: "Effect"
22
+ }
23
+ },
24
+ scanlineNoise: {
25
+ default: .6,
26
+ description: "Per-scanline fine chroma/luma jitter. Adds the classic horizontal-streak detail.",
27
+ ui: {
28
+ type: ["range", "map"],
29
+ min: 0,
30
+ max: 1,
31
+ step: .01,
32
+ label: "Scanline Noise",
33
+ group: "Effect"
34
+ }
35
+ },
36
+ smear: {
37
+ default: .2,
38
+ description: "Horizontal chroma smear (color bleed) amount. Positive trails colour to the right (classic VHS), negative trails it to the left.",
39
+ ui: {
40
+ type: ["range", "map"],
41
+ min: -2,
42
+ max: 2,
43
+ step: .01,
44
+ label: "Smear",
45
+ group: "Effect"
46
+ }
47
+ },
48
+ speed: {
49
+ default: 1,
50
+ description: "Animation speed of the tape effects.",
51
+ ui: {
52
+ type: "range",
53
+ min: .1,
54
+ max: 3,
55
+ step: .1,
56
+ label: "Speed",
57
+ group: "Effect"
58
+ }
59
+ }
60
+ },
61
+ fragmentNode: ({ uniforms, childNode, onCleanup }) => {
62
+ if (!childNode) return vec4(0, 0, 0, 0);
63
+ const childTexture = convertToTexture(childNode);
64
+ onCleanup(() => {
65
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
66
+ });
67
+ const wobble = uniforms.wobble.uniform;
68
+ const scanlineNoiseAmt = uniforms.scanlineNoise.uniform;
69
+ const smear = uniforms.smear.uniform;
70
+ const speed = uniforms.speed.uniform;
71
+ const t = time.mul(speed);
72
+ const hash2D = (p) => fract(sin(dot(p, vec2(12.9898, 78.233))).mul(43758.5453));
73
+ const smoothNoise2D = (p) => {
74
+ const i = floor(p);
75
+ const f = fract(p);
76
+ const u = f.mul(f).mul(f.mul(-2).add(3));
77
+ const a = hash2D(i);
78
+ const b = hash2D(i.add(vec2(1, 0)));
79
+ const c = hash2D(i.add(vec2(0, 1)));
80
+ const d = hash2D(i.add(vec2(1, 1)));
81
+ return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
82
+ };
83
+ const burst = smoothstep(float(.45), float(.8), smoothNoise2D(vec2(t.mul(.4), float(0))));
84
+ const rowInt = floor(screenUV.y.mul(FIELD_LINES));
85
+ const scanlineHash = (seedOffset) => fract(sin(rowInt.mul(12.9898).add(t.add(seedOffset).mul(78.233))).mul(43758.5453)).sub(.5).mul(2);
86
+ const fineGate = float(.25).add(burst.mul(.75));
87
+ const chromaRowOffset = scanlineHash(0).mul(scanlineNoiseAmt).mul(.008).mul(fineGate);
88
+ const lumaRowOffset = scanlineHash(69.42).mul(scanlineNoiseAmt).mul(.004).mul(fineGate);
89
+ const wave1 = smoothNoise2D(vec2(screenUV.y.mul(3), t.mul(.8))).sub(.5);
90
+ const wave2 = smoothNoise2D(vec2(screenUV.y.mul(30), t.mul(6))).sub(.5);
91
+ const tapeWave = wave1.mul(.008).add(wave2.mul(.002)).mul(wobble);
92
+ const creasePhase = smoothstep(float(.92), float(.99), sin(screenUV.y.mul(8).sub(t.mul(3.77))));
93
+ const creaseNoise = smoothstep(float(.3), float(1), smoothNoise2D(vec2(screenUV.y.mul(4.77), t)));
94
+ const creaseShift = creasePhase.mul(creaseNoise).mul(wobble).mul(-.018);
95
+ const switchPhase = smoothstep(float(.06), float(0), screenUV.y);
96
+ const switchNoise = smoothNoise2D(vec2(screenUV.y.mul(60), t.mul(14))).sub(.5);
97
+ const switchX = switchPhase.mul(switchNoise).mul(wobble).mul(.09);
98
+ const switchY = switchPhase.mul(wobble).mul(burst).mul(.02);
99
+ const globalX = tapeWave.add(creaseShift).add(switchX);
100
+ const lumaUV = vec2(screenUV.x.add(globalX).add(lumaRowOffset), screenUV.y.add(switchY));
101
+ const chromaUV = vec2(screenUV.x.add(globalX).add(chromaRowOffset), screenUV.y.add(switchY));
102
+ const lumaSample = childTexture.sample(lumaUV);
103
+ const sharpY = lumaSample.rgb.dot(vec3(.299, .587, .114));
104
+ const smearScale = smear.mul(.0075);
105
+ let accumI = float(0);
106
+ let accumQ = float(0);
107
+ for (let i = 0; i < SMEAR_SAMPLES; i++) {
108
+ const offsetX = float(-i).mul(smearScale);
109
+ const sampled = childTexture.sample(vec2(chromaUV.x.add(offsetX), chromaUV.y));
110
+ const iComp = sampled.rgb.dot(vec3(.596, -.274, -.322));
111
+ const qComp = sampled.rgb.dot(vec3(.211, -.523, .312));
112
+ const w = i / (SMEAR_SAMPLES - 1) * (2 / SMEAR_SAMPLES);
113
+ accumI = accumI.add(iComp.mul(w));
114
+ accumQ = accumQ.add(qComp.mul(w));
115
+ }
116
+ const finalYiq = vec3(sharpY, accumI, accumQ);
117
+ const finalRgb = vec3(finalYiq.x.add(finalYiq.y.mul(.956)).add(finalYiq.z.mul(.621)), finalYiq.x.sub(finalYiq.y.mul(.272)).sub(finalYiq.z.mul(.647)), finalYiq.x.sub(finalYiq.y.mul(1.106)).add(finalYiq.z.mul(1.703)));
118
+ const acBeat = float(1).add(cos(mod(t, 6.2831853).mul(2).add(screenUV.y.mul(.5))).mul(.015).mul(wobble));
119
+ return unpremultiplyAlpha(vec4(clamp(finalRgb.mul(acBeat), vec3(0), vec3(1)), lumaSample.a));
120
+ }
121
+ };
122
+ var VHS_default = componentDefinition;
123
+ export { componentDefinition as n, VHS_default as t };
@@ -1,4 +1,4 @@
1
- import { t as needsVideoCanvasWorkaround } from "./browser-ClWxLlIB.js";
1
+ import { t as needsVideoCanvasWorkaround } from "./browser-DTNngPey.js";
2
2
  import { CanvasTexture, SRGBColorSpace, VideoTexture } from "three/webgpu";
3
3
  import { float, max, min, or, screenUV, select, step, texture, uniform, vec2, vec4, viewportSize } from "three/tsl";
4
4
  const componentDefinition = {
@@ -1,4 +1,4 @@
1
- import { t as needsVideoCanvasWorkaround } from "./browser-ClWxLlIB.js";
1
+ import { t as needsVideoCanvasWorkaround } from "./browser-DTNngPey.js";
2
2
  import { CanvasTexture, SRGBColorSpace, VideoTexture } from "three/webgpu";
3
3
  import { float, max, min, or, screenUV, select, step, texture, uniform, vec2, vec4, viewportSize } from "three/tsl";
4
4
  const componentDefinition = {
@@ -37,7 +37,7 @@ import "./Duotone-Bl02WcA2.js";
37
37
  import "./Ellipse-CXxGqTYI.js";
38
38
  import "./Emboss-ClQV27Mt.js";
39
39
  import "./FallingLines-CArEXajJ.js";
40
- import "./FilmGrain-yBeLmqwl.js";
40
+ import "./FilmGrain-DSJiMtEp.js";
41
41
  import "./FloatingParticles-BtwGRl_d.js";
42
42
  import "./Flower-MAwlZEv8.js";
43
43
  import "./FlowField-RyqiRxyI.js";
@@ -52,7 +52,7 @@ import "./Grayscale-lYKBBkGY.js";
52
52
  import "./Grid-BJ-nxN3i.js";
53
53
  import "./GridDistortion-DtaRNrTZ.js";
54
54
  import "./Group-DpozigtX.js";
55
- import "./Halftone-BVL2oy37.js";
55
+ import "./Halftone-XFa7by1s.js";
56
56
  import "./HexGrid-D-EmQ4kI.js";
57
57
  import "./HueShift-D9K0ynaS.js";
58
58
  import "./ImageTexture-CArkZMfh.js";
@@ -100,16 +100,17 @@ import "./Tritone-BlJ7cchN.js";
100
100
  import "./Truchet-Bnn0fwbF.js";
101
101
  import "./Twirl-C5ijhqz1.js";
102
102
  import "./Vesica-DU0f85NG.js";
103
- import "./Vibrance-dqIV6GBe.js";
104
- import "./browser-ClWxLlIB.js";
105
- import "./VideoTexture-DJrkry82.js";
106
- import "./Vignette-DB1wO1dm.js";
107
- import "./Voronoi-C3WIJFWc.js";
108
- import "./WaveDistortion-BKma8-Ju.js";
109
- import "./Weave-xuu_vQ5e.js";
110
- import "./WebcamTexture-Cf8J7JB1.js";
111
- import "./ZoomBlur-UcS2iFT2.js";
112
- import { t as getAllShaders } from "./shaderRegistry-X16MNgs8.js";
103
+ import "./VHS-CQJ1hV_D.js";
104
+ import "./Vibrance-CGvYDeds.js";
105
+ import "./browser-DTNngPey.js";
106
+ import "./VideoTexture-DnHIs4pp.js";
107
+ import "./Vignette-BJaonUVL.js";
108
+ import "./Voronoi-DZemzWA4.js";
109
+ import "./WaveDistortion--Y-m667K.js";
110
+ import "./Weave-CtyohvHz.js";
111
+ import "./WebcamTexture-XBDo2kgN.js";
112
+ import "./ZoomBlur-BwkhsFRE.js";
113
+ import { t as getAllShaders } from "./shaderRegistry-BWuH2me2.js";
113
114
  import { Material, Mesh, MeshBasicNodeMaterial, OrthographicCamera, PlaneGeometry, SRGBColorSpace, Scene, Vector2, WebGPURenderer } from "three/webgpu";
114
115
  import { WebGLRenderer } from "three";
115
116
  import { PI, abs, add, atan, clamp, convertToTexture, cos, div, dot, float, fract, max, min, mix, mul, pow, screenUV, sign, sin, smoothstep, sqrt, step, sub, time, uniform, uv, vec2, vec3, vec4 } from "three/tsl";
@@ -37,7 +37,7 @@ import "./Duotone-Bl02WcA2.js";
37
37
  import "./Ellipse-CXxGqTYI.js";
38
38
  import "./Emboss-ClQV27Mt.js";
39
39
  import "./FallingLines-CArEXajJ.js";
40
- import "./FilmGrain-yBeLmqwl.js";
40
+ import "./FilmGrain-DSJiMtEp.js";
41
41
  import "./FloatingParticles-BtwGRl_d.js";
42
42
  import "./Flower-MAwlZEv8.js";
43
43
  import "./FlowField-RyqiRxyI.js";
@@ -52,7 +52,7 @@ import "./Grayscale-lYKBBkGY.js";
52
52
  import "./Grid-BJ-nxN3i.js";
53
53
  import "./GridDistortion-DtaRNrTZ.js";
54
54
  import "./Group-DpozigtX.js";
55
- import "./Halftone-BVL2oy37.js";
55
+ import "./Halftone-XFa7by1s.js";
56
56
  import "./HexGrid-D-EmQ4kI.js";
57
57
  import "./HueShift-D9K0ynaS.js";
58
58
  import "./ImageTexture-CArkZMfh.js";
@@ -100,14 +100,15 @@ import "./Tritone-BlJ7cchN.js";
100
100
  import "./Truchet-Bnn0fwbF.js";
101
101
  import "./Twirl-C5ijhqz1.js";
102
102
  import "./Vesica-DU0f85NG.js";
103
- import "./Vibrance-dqIV6GBe.js";
104
- import "./browser-ClWxLlIB.js";
105
- import "./VideoTexture-DJrkry82.js";
106
- import "./Vignette-DB1wO1dm.js";
107
- import "./Voronoi-C3WIJFWc.js";
108
- import "./WaveDistortion-BKma8-Ju.js";
109
- import "./Weave-xuu_vQ5e.js";
110
- import "./WebcamTexture-Cf8J7JB1.js";
111
- import "./ZoomBlur-UcS2iFT2.js";
112
- import { a as shaderRegistry, i as getShadersByCategory, n as getShaderByName, r as getShaderCategories, t as getAllShaders } from "./shaderRegistry-X16MNgs8.js";
103
+ import "./VHS-CQJ1hV_D.js";
104
+ import "./Vibrance-CGvYDeds.js";
105
+ import "./browser-DTNngPey.js";
106
+ import "./VideoTexture-DnHIs4pp.js";
107
+ import "./Vignette-BJaonUVL.js";
108
+ import "./Voronoi-DZemzWA4.js";
109
+ import "./WaveDistortion--Y-m667K.js";
110
+ import "./Weave-CtyohvHz.js";
111
+ import "./WebcamTexture-XBDo2kgN.js";
112
+ import "./ZoomBlur-BwkhsFRE.js";
113
+ import { a as shaderRegistry, i as getShadersByCategory, n as getShaderByName, r as getShaderCategories, t as getAllShaders } from "./shaderRegistry-BWuH2me2.js";
113
114
  export { getAllShaders, getShaderByName, getShaderCategories, getShadersByCategory, shaderRegistry };
@@ -30,7 +30,7 @@ import { n as componentDefinition$28 } from "./Duotone-Bl02WcA2.js";
30
30
  import { n as componentDefinition$29 } from "./Ellipse-CXxGqTYI.js";
31
31
  import { n as componentDefinition$30 } from "./Emboss-ClQV27Mt.js";
32
32
  import { n as componentDefinition$31 } from "./FallingLines-CArEXajJ.js";
33
- import { n as componentDefinition$32 } from "./FilmGrain-yBeLmqwl.js";
33
+ import { n as componentDefinition$32 } from "./FilmGrain-DSJiMtEp.js";
34
34
  import { n as componentDefinition$33 } from "./FloatingParticles-BtwGRl_d.js";
35
35
  import { n as componentDefinition$34 } from "./Flower-MAwlZEv8.js";
36
36
  import { n as componentDefinition$35 } from "./FlowField-RyqiRxyI.js";
@@ -45,7 +45,7 @@ import { n as componentDefinition$43 } from "./Grayscale-lYKBBkGY.js";
45
45
  import { n as componentDefinition$44 } from "./Grid-BJ-nxN3i.js";
46
46
  import { n as componentDefinition$45 } from "./GridDistortion-DtaRNrTZ.js";
47
47
  import { n as componentDefinition$46 } from "./Group-DpozigtX.js";
48
- import { n as componentDefinition$47 } from "./Halftone-BVL2oy37.js";
48
+ import { n as componentDefinition$47 } from "./Halftone-XFa7by1s.js";
49
49
  import { n as componentDefinition$48 } from "./HexGrid-D-EmQ4kI.js";
50
50
  import { n as componentDefinition$49 } from "./HueShift-D9K0ynaS.js";
51
51
  import { n as componentDefinition$50 } from "./ImageTexture-CArkZMfh.js";
@@ -93,14 +93,15 @@ import { n as componentDefinition$91 } from "./Tritone-BlJ7cchN.js";
93
93
  import { n as componentDefinition$92 } from "./Truchet-Bnn0fwbF.js";
94
94
  import { n as componentDefinition$93 } from "./Twirl-C5ijhqz1.js";
95
95
  import { n as componentDefinition$94 } from "./Vesica-DU0f85NG.js";
96
- import { n as componentDefinition$95 } from "./Vibrance-dqIV6GBe.js";
97
- import { n as componentDefinition$96 } from "./VideoTexture-DJrkry82.js";
98
- import { n as componentDefinition$97 } from "./Vignette-DB1wO1dm.js";
99
- import { n as componentDefinition$98 } from "./Voronoi-C3WIJFWc.js";
100
- import { n as componentDefinition$99 } from "./WaveDistortion-BKma8-Ju.js";
101
- import { n as componentDefinition$100 } from "./Weave-xuu_vQ5e.js";
102
- import { n as componentDefinition$101 } from "./WebcamTexture-Cf8J7JB1.js";
103
- import { n as componentDefinition$102 } from "./ZoomBlur-UcS2iFT2.js";
96
+ import { n as componentDefinition$95 } from "./VHS-CQJ1hV_D.js";
97
+ import { n as componentDefinition$96 } from "./Vibrance-CGvYDeds.js";
98
+ import { n as componentDefinition$97 } from "./VideoTexture-DnHIs4pp.js";
99
+ import { n as componentDefinition$98 } from "./Vignette-BJaonUVL.js";
100
+ import { n as componentDefinition$99 } from "./Voronoi-DZemzWA4.js";
101
+ import { n as componentDefinition$100 } from "./WaveDistortion--Y-m667K.js";
102
+ import { n as componentDefinition$101 } from "./Weave-CtyohvHz.js";
103
+ import { n as componentDefinition$102 } from "./WebcamTexture-XBDo2kgN.js";
104
+ import { n as componentDefinition$103 } from "./ZoomBlur-BwkhsFRE.js";
104
105
  var createShaderRegistry = () => {
105
106
  const registry = {};
106
107
  const shaderDefinitions = {
@@ -199,14 +200,15 @@ var createShaderRegistry = () => {
199
200
  Truchet: componentDefinition$92,
200
201
  Twirl: componentDefinition$93,
201
202
  Vesica: componentDefinition$94,
202
- Vibrance: componentDefinition$95,
203
- VideoTexture: componentDefinition$96,
204
- Vignette: componentDefinition$97,
205
- Voronoi: componentDefinition$98,
206
- WaveDistortion: componentDefinition$99,
207
- Weave: componentDefinition$100,
208
- WebcamTexture: componentDefinition$101,
209
- ZoomBlur: componentDefinition$102
203
+ VHS: componentDefinition$95,
204
+ Vibrance: componentDefinition$96,
205
+ VideoTexture: componentDefinition$97,
206
+ Vignette: componentDefinition$98,
207
+ Voronoi: componentDefinition$99,
208
+ WaveDistortion: componentDefinition$100,
209
+ Weave: componentDefinition$101,
210
+ WebcamTexture: componentDefinition$102,
211
+ ZoomBlur: componentDefinition$103
210
212
  };
211
213
  Object.entries(shaderDefinitions).forEach(([fileName, def]) => {
212
214
  const propsMetadata = {};
@@ -1 +1 @@
1
- {"version":3,"file":"shaderRegistry.d.ts","sourceRoot":"","sources":["../src/shaderRegistry.ts"],"names":[],"mappings":"AA0GA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAA;IACpC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE;QAC5B,EAAE,CAAC,EAAE,GAAG,CAAA;QACR,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAC,CAAA;CACH;AA2ID,eAAO,MAAM,cAAc,qCAAyB,CAAA;AAGpD,wBAAgB,aAAa,IAAI,mBAAmB,EAAE,CAErD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAE7E;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAE5E;AAED,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAG9C"}
1
+ {"version":3,"file":"shaderRegistry.d.ts","sourceRoot":"","sources":["../src/shaderRegistry.ts"],"names":[],"mappings":"AA2GA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAA;IACpC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE;QAC5B,EAAE,CAAC,EAAE,GAAG,CAAA;QACR,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAC,CAAA;CACH;AA4ID,eAAO,MAAM,cAAc,qCAAyB,CAAA;AAGpD,wBAAgB,aAAa,IAAI,mBAAmB,EAAE,CAErD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAE7E;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAE5E;AAED,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAG9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shaders/FilmGrain/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAqB,MAAM,iBAAiB,CAAA;AAIvE,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;CACpB;AAED,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CAAC,cAAc,CA4DnE,CAAA;AAED,eAAe,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shaders/FilmGrain/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAqB,MAAM,iBAAiB,CAAA;AAIvE,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;CACpB;AAED,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CAAC,cAAc,CAgEnE,CAAA;AAED,eAAe,mBAAmB,CAAA"}
@@ -1,2 +1,2 @@
1
- import { n as componentDefinition, t as FilmGrain_default } from "../../FilmGrain-yBeLmqwl.js";
1
+ import { n as componentDefinition, t as FilmGrain_default } from "../../FilmGrain-DSJiMtEp.js";
2
2
  export { componentDefinition, FilmGrain_default as default };