shaders 2.2.23 → 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.
Files changed (213) hide show
  1. package/dist/core/AngularBlur-Dl2gwk68.js +64 -0
  2. package/dist/core/Ascii-Dha_QpT3.js +286 -0
  3. package/dist/core/Beam-CTN9Ni43.js +139 -0
  4. package/dist/core/Blob-CxFDZovO.js +218 -0
  5. package/dist/core/Blur-Y2FsmFk_.js +77 -0
  6. package/dist/core/Bulge-Cb-t0xqI.js +132 -0
  7. package/dist/core/CRTScreen-CtERsenz.js +112 -0
  8. package/dist/core/ChannelBlur-CvM6GJgZ.js +118 -0
  9. package/dist/core/Checkerboard-CgB-egNY.js +83 -0
  10. package/dist/core/ChromaFlow-vRCwhQpN.js +222 -0
  11. package/dist/core/ChromaticAberration-FTquTQIL.js +88 -0
  12. package/dist/core/Circle-Daziv5d7.js +67 -0
  13. package/dist/core/CursorTrail-Bsz9e6Fn.js +145 -0
  14. package/dist/core/DiffuseBlur-Cj2PtRNd.js +83 -0
  15. package/dist/core/Dither-D2Nf4p3w.js +66 -0
  16. package/dist/core/DotGrid-CzOwquo4.js +75 -0
  17. package/dist/core/Duotone-XuTN9tI7.js +65 -0
  18. package/dist/core/FilmGrain-D3-nbi12.js +28 -0
  19. package/dist/core/FloatingParticles-D9Nnu1qg.js +217 -0
  20. package/dist/core/GlassTiles-CnjCvajI.js +69 -0
  21. package/dist/core/Glow-BluFc9be.js +75 -0
  22. package/dist/core/Godrays-ChLh_vGl.js +144 -0
  23. package/dist/core/Grayscale-DRny75A9.js +20 -0
  24. package/dist/core/Grid-DgyDa4H1.js +58 -0
  25. package/dist/core/GridDistortion-BAspCYvp.js +188 -0
  26. package/dist/core/Group-Dul7PUBl.js +14 -0
  27. package/dist/core/Halftone-Ifv5F_FT.js +65 -0
  28. package/dist/core/HueShift-De8ukMWs.js +31 -0
  29. package/dist/core/ImageTexture-DvYcQgJB.js +143 -0
  30. package/dist/core/Invert-Fz0NtIJc.js +21 -0
  31. package/dist/core/LinearBlur-LmhnQoA4.js +62 -0
  32. package/dist/core/LinearGradient-xbloQjzt.js +133 -0
  33. package/dist/core/Liquify-DMe1V5-O.js +175 -0
  34. package/dist/core/Pixelate-Cv8537Pj.js +37 -0
  35. package/dist/core/PolarCoordinates-DDvDhBE-.js +112 -0
  36. package/dist/core/Posterize-3m3xkWOz.js +29 -0
  37. package/dist/core/ProgressiveBlur-EGkevObV.js +121 -0
  38. package/dist/core/RadialGradient-B7ZZB_VJ.js +71 -0
  39. package/dist/core/RectangularCoordinates-muWR8mZS.js +101 -0
  40. package/dist/core/Ripples-8XaZaXQF.js +117 -0
  41. package/dist/core/Saturation-CYFI1jzN.js +30 -0
  42. package/dist/core/SimplexNoise-DJUe0wz_.js +99 -0
  43. package/dist/core/SineWave-Dl3nFO1W.js +120 -0
  44. package/dist/core/SolidColor-CWGq_Bjq.js +21 -0
  45. package/dist/core/Spherize-C-jZEUsN.js +128 -0
  46. package/dist/core/Spiral-BSB_R39p.js +132 -0
  47. package/dist/core/Strands-0stO5BMy.js +161 -0
  48. package/dist/core/Stretch-B645paha.js +133 -0
  49. package/dist/core/Swirl-CVnbawit.js +173 -0
  50. package/dist/core/TiltShift-0CxNRI6L.js +134 -0
  51. package/dist/core/Tritone-Daa-I5UD.js +76 -0
  52. package/dist/core/Twirl-2CJVZEtk.js +96 -0
  53. package/dist/core/Vibrance-DRtecEvb.js +30 -0
  54. package/dist/core/WaveDistortion-BscXN2rs.js +173 -0
  55. package/dist/core/ZoomBlur-CAqK0Kju.js +62 -0
  56. package/dist/core/colorMixing-BXiTAqJU.js +69 -0
  57. package/dist/core/edges-Bn_OIa_h.js +26 -0
  58. package/dist/core/index.js +2257 -1604
  59. package/dist/core/shaderRegistry.d.ts.map +1 -1
  60. package/dist/core/shaders/AngularBlur/index.js +3 -7
  61. package/dist/core/shaders/Ascii/index.js +2 -6
  62. package/dist/core/shaders/Beam/index.d.ts +71 -0
  63. package/dist/core/shaders/Beam/index.d.ts.map +1 -0
  64. package/dist/core/shaders/Beam/index.js +4 -0
  65. package/dist/core/shaders/Blob/index.js +5 -9
  66. package/dist/core/shaders/Blur/index.js +2 -6
  67. package/dist/core/shaders/Bulge/index.js +4 -8
  68. package/dist/core/shaders/CRTScreen/index.js +2 -6
  69. package/dist/core/shaders/ChannelBlur/index.js +2 -6
  70. package/dist/core/shaders/Checkerboard/index.js +4 -8
  71. package/dist/core/shaders/ChromaFlow/index.js +3 -7
  72. package/dist/core/shaders/ChromaticAberration/index.js +3 -7
  73. package/dist/core/shaders/Circle/index.js +3 -7
  74. package/dist/core/shaders/CursorTrail/index.js +4 -8
  75. package/dist/core/shaders/DiffuseBlur/index.js +4 -8
  76. package/dist/core/shaders/Dither/index.js +3 -7
  77. package/dist/core/shaders/DotGrid/index.js +3 -7
  78. package/dist/core/shaders/Duotone/index.js +4 -8
  79. package/dist/core/shaders/FilmGrain/index.js +2 -6
  80. package/dist/core/shaders/FloatingParticles/index.js +3 -7
  81. package/dist/core/shaders/GlassTiles/index.js +2 -6
  82. package/dist/core/shaders/Glow/index.js +2 -6
  83. package/dist/core/shaders/Godrays/index.js +3 -7
  84. package/dist/core/shaders/Grayscale/index.js +2 -8
  85. package/dist/core/shaders/Grid/index.js +3 -7
  86. package/dist/core/shaders/GridDistortion/index.js +4 -8
  87. package/dist/core/shaders/Group/index.js +2 -6
  88. package/dist/core/shaders/Halftone/index.js +3 -7
  89. package/dist/core/shaders/HueShift/index.js +2 -8
  90. package/dist/core/shaders/ImageTexture/index.js +2 -6
  91. package/dist/core/shaders/Invert/index.js +2 -6
  92. package/dist/core/shaders/LinearBlur/index.js +3 -7
  93. package/dist/core/shaders/LinearGradient/index.js +4 -8
  94. package/dist/core/shaders/Liquify/index.js +4 -8
  95. package/dist/core/shaders/Pixelate/index.js +2 -6
  96. package/dist/core/shaders/PolarCoordinates/index.js +4 -8
  97. package/dist/core/shaders/Posterize/index.js +2 -7
  98. package/dist/core/shaders/ProgressiveBlur/index.js +3 -7
  99. package/dist/core/shaders/RadialGradient/index.js +4 -8
  100. package/dist/core/shaders/RectangularCoordinates/index.js +4 -8
  101. package/dist/core/shaders/Ripples/index.js +5 -9
  102. package/dist/core/shaders/Saturation/index.js +2 -8
  103. package/dist/core/shaders/SimplexNoise/index.js +5 -9
  104. package/dist/core/shaders/SineWave/index.js +3 -7
  105. package/dist/core/shaders/SolidColor/index.js +3 -7
  106. package/dist/core/shaders/Spherize/index.js +3 -7
  107. package/dist/core/shaders/Spiral/index.js +4 -8
  108. package/dist/core/shaders/Strands/index.js +4 -8
  109. package/dist/core/shaders/Stretch/index.js +4 -8
  110. package/dist/core/shaders/Swirl/index.js +5 -9
  111. package/dist/core/shaders/TiltShift/index.js +3 -7
  112. package/dist/core/shaders/Tritone/index.js +4 -8
  113. package/dist/core/shaders/Twirl/index.js +4 -8
  114. package/dist/core/shaders/Vibrance/index.js +2 -8
  115. package/dist/core/shaders/WaveDistortion/index.js +4 -8
  116. package/dist/core/shaders/ZoomBlur/index.js +3 -7
  117. package/dist/core/telemetry/index.js +189 -157
  118. package/dist/core/time-CTJvRUZ4.js +10 -0
  119. package/dist/core/transformations-DxfQXZWi.js +4715 -0
  120. package/dist/react/components/Beam.d.ts +31 -0
  121. package/dist/react/components/Beam.d.ts.map +1 -0
  122. package/dist/react/generatePresetCode-CCibXbtZ.js +645 -0
  123. package/dist/react/index.d.ts +1 -0
  124. package/dist/react/index.d.ts.map +1 -1
  125. package/dist/react/index.js +7649 -104600
  126. package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
  127. package/dist/react/utils/generatePresetCode.js +2 -5
  128. package/dist/registry.js +224 -0
  129. package/dist/solid/components/Beam.d.ts +28 -0
  130. package/dist/solid/components/Beam.d.ts.map +1 -0
  131. package/dist/solid/index.d.ts +1 -0
  132. package/dist/solid/index.d.ts.map +1 -1
  133. package/dist/solid/index.js +6691 -102524
  134. package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
  135. package/dist/solid/utils/generatePresetCode.js +586 -537
  136. package/dist/svelte/components/Beam.svelte.d.ts +19 -0
  137. package/dist/svelte/generatePresetCode-CymgoDq_.js +645 -0
  138. package/dist/svelte/index.d.ts +1 -0
  139. package/dist/svelte/index.js +6175 -102455
  140. package/dist/svelte/utils/generatePresetCode.js +2 -5
  141. package/dist/vue/components/Beam.vue.d.ts +57 -0
  142. package/dist/vue/components/Beam.vue.d.ts.map +1 -0
  143. package/dist/vue/generatePresetCode-CRJmU8iF.js +649 -0
  144. package/dist/vue/index.d.ts +1 -0
  145. package/dist/vue/index.d.ts.map +1 -1
  146. package/dist/vue/index.js +6929 -103492
  147. package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
  148. package/dist/vue/utils/generatePresetCode.js +2 -5
  149. package/package.json +12 -1
  150. package/dist/core/AngularBlur-ClvtyURQ.js +0 -56
  151. package/dist/core/Ascii-BT0-K_vw.js +0 -196
  152. package/dist/core/Blob-BlQ_1T_8.js +0 -169
  153. package/dist/core/Blur-421AjWLH.js +0 -64
  154. package/dist/core/Bulge-CZRVoR6C.js +0 -103
  155. package/dist/core/CRTScreen-C_U9g_IR.js +0 -91
  156. package/dist/core/ChannelBlur-5pzcB6Zv.js +0 -89
  157. package/dist/core/Checkerboard-CrQkqXhD.js +0 -75
  158. package/dist/core/ChromaFlow-CNrQdL8f.js +0 -134
  159. package/dist/core/ChromaticAberration-D9H7O17Y.js +0 -82
  160. package/dist/core/Circle-DnLaDn8V.js +0 -62
  161. package/dist/core/ColorAdjustment-CKwpE_4M.js +0 -14
  162. package/dist/core/CursorTrail-NY6n97VG.js +0 -105
  163. package/dist/core/DiffuseBlur-C_n01ABk.js +0 -69
  164. package/dist/core/Dither-4s-c4zh4.js +0 -61
  165. package/dist/core/DotGrid-BYl8XdMi.js +0 -61
  166. package/dist/core/Duotone-DbewOoB4.js +0 -66
  167. package/dist/core/FilmGrain-zA_-knOw.js +0 -28
  168. package/dist/core/FloatingParticles-BhVnqMsE.js +0 -160
  169. package/dist/core/GlassTiles-CFI57glh.js +0 -52
  170. package/dist/core/Glow-CQgl3IoS.js +0 -66
  171. package/dist/core/Godrays-BHMix_Bh.js +0 -105
  172. package/dist/core/Grayscale-CAEFLteL.js +0 -21
  173. package/dist/core/Grid-DlM-rVbZ.js +0 -50
  174. package/dist/core/GridDistortion-ZOZphSAT.js +0 -147
  175. package/dist/core/Group-BQAs3RiH.js +0 -17
  176. package/dist/core/Halftone-ci4ga-_J.js +0 -55
  177. package/dist/core/HueShift-CyxzPcJV.js +0 -32
  178. package/dist/core/ImageTexture-CdAGsPuH.js +0 -105
  179. package/dist/core/Invert-iPsiIqNZ.js +0 -20
  180. package/dist/core/LinearBlur-BEaaoIk-.js +0 -56
  181. package/dist/core/LinearGradient-DR_7RxLX.js +0 -111
  182. package/dist/core/Liquify-Bi02_ugh.js +0 -139
  183. package/dist/core/Pixelate-CSsdT1rr.js +0 -38
  184. package/dist/core/PolarCoordinates-D626ml58.js +0 -103
  185. package/dist/core/Posterize-DhZkMaC7.js +0 -46
  186. package/dist/core/ProgressiveBlur-CGtCfLF8.js +0 -102
  187. package/dist/core/RadialGradient-C0_WzmbH.js +0 -71
  188. package/dist/core/RectangularCoordinates-DfXw7fhI.js +0 -92
  189. package/dist/core/Ripples-DkemN3eh.js +0 -106
  190. package/dist/core/Saturation-Dup81Pnq.js +0 -31
  191. package/dist/core/SimplexNoise-BYEiCjDj.js +0 -94
  192. package/dist/core/SineWave-C6MRPtsy.js +0 -107
  193. package/dist/core/SolidColor-BZHRczgb.js +0 -22
  194. package/dist/core/Spherize-DOAnDx2l.js +0 -103
  195. package/dist/core/Spiral-BMjnWXh1.js +0 -115
  196. package/dist/core/Strands-BOVsuJLe.js +0 -125
  197. package/dist/core/Stretch-D6bHc6yp.js +0 -103
  198. package/dist/core/Swirl-BFoc0ImG.js +0 -148
  199. package/dist/core/TSLBase-BFMvTOak.js +0 -8053
  200. package/dist/core/TiltShift-BiNvvhzj.js +0 -114
  201. package/dist/core/Tritone-gdx2AA0m.js +0 -75
  202. package/dist/core/Twirl-BsV8YbqC.js +0 -82
  203. package/dist/core/Vibrance-C182fbSw.js +0 -31
  204. package/dist/core/WaveDistortion-CmaS2zDB.js +0 -132
  205. package/dist/core/ZoomBlur-DLf5xQ16.js +0 -56
  206. package/dist/core/colorMixing--dhzx0ch.js +0 -21
  207. package/dist/core/edges-CDzKsauJ.js +0 -15
  208. package/dist/core/three.tsl-Btj1hLsf.js +0 -43845
  209. package/dist/core/time-DbRMw6Jm.js +0 -10
  210. package/dist/core/transformations-CsrIJXh-.js +0 -3992
  211. package/dist/react/generatePresetCode-DaS7jkcT.js +0 -626
  212. package/dist/svelte/generatePresetCode-DaS7jkcT.js +0 -626
  213. package/dist/vue/generatePresetCode-Cd1B-Y9j.js +0 -632
@@ -0,0 +1,134 @@
1
+ import { n as transformAngle, o as transformPosition } from "./transformations-DxfQXZWi.js";
2
+ import * as TSL from "three/tsl";
3
+ const componentDefinition = {
4
+ name: "TiltShift",
5
+ category: "Blurs",
6
+ description: "Selective focus blur mimicking tilt-shift photography",
7
+ requiresRTT: true,
8
+ requiresChild: true,
9
+ props: {
10
+ intensity: {
11
+ default: 50,
12
+ description: "Maximum blur intensity at edges",
13
+ ui: {
14
+ type: "range",
15
+ min: 0,
16
+ max: 100,
17
+ step: 1,
18
+ label: "Intensity"
19
+ }
20
+ },
21
+ width: {
22
+ default: .3,
23
+ description: "Width of the sharp focus area",
24
+ ui: {
25
+ type: "range",
26
+ min: 0,
27
+ max: 1,
28
+ step: .01,
29
+ label: "Width"
30
+ }
31
+ },
32
+ falloff: {
33
+ default: .3,
34
+ description: "Distance over which blur transitions to full strength",
35
+ ui: {
36
+ type: "range",
37
+ min: 0,
38
+ max: 1,
39
+ step: .01,
40
+ label: "Falloff"
41
+ }
42
+ },
43
+ angle: {
44
+ default: 0,
45
+ transform: transformAngle,
46
+ description: "Rotation angle of the focus line (in degrees)",
47
+ ui: {
48
+ type: "range",
49
+ min: 0,
50
+ max: 360,
51
+ step: 1,
52
+ label: "Angle"
53
+ }
54
+ },
55
+ center: {
56
+ default: {
57
+ x: .5,
58
+ y: .5
59
+ },
60
+ transform: transformPosition,
61
+ description: "Center point of the focus line",
62
+ ui: {
63
+ type: "position",
64
+ label: "Center"
65
+ }
66
+ }
67
+ },
68
+ fragmentNode: ({ uniforms, childNode, onCleanup }) => {
69
+ const { vec2: vec2$1, vec4: vec4$1, float: float$1, screenUV: screenUV$1, convertToTexture: convertToTexture$1, viewportSize: viewportSize$1, radians, cos: cos$1, sin: sin$1, dot: dot$1, abs: abs$1, smoothstep, mix: mix$1, Fn } = TSL;
70
+ if (!childNode) return vec4$1(0, 0, 0, 0);
71
+ const childTexture = convertToTexture$1(childNode);
72
+ onCleanup(() => {
73
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
74
+ });
75
+ const angleRad = radians(uniforms.angle.uniform);
76
+ const cosAngle = cos$1(angleRad);
77
+ const perpVector = vec2$1(sin$1(angleRad).negate(), cosAngle);
78
+ const centerPosition = vec2$1(uniforms.center.uniform[0], uniforms.center.uniform[1].oneMinus());
79
+ const distFromLine = abs$1(dot$1(screenUV$1.sub(centerPosition), perpVector));
80
+ const focusWidth = uniforms.width.uniform.mul(.5);
81
+ const falloff = uniforms.falloff.uniform;
82
+ const blurAmount = smoothstep(focusWidth, focusWidth.add(falloff), distFromLine);
83
+ const scaledIntensity = uniforms.intensity.uniform.mul(.06);
84
+ const blurRadius = blurAmount.mul(scaledIntensity);
85
+ const weights = [
86
+ .056,
87
+ .135,
88
+ .278,
89
+ .487,
90
+ .726,
91
+ .923,
92
+ 1,
93
+ .923,
94
+ .726,
95
+ .487,
96
+ .278,
97
+ .135,
98
+ .056
99
+ ];
100
+ const weightSum = 6.214;
101
+ const horizontalTexture = convertToTexture$1(Fn(() => {
102
+ const uv = screenUV$1;
103
+ const pixelSize = vec2$1(1).div(viewportSize$1);
104
+ const total = vec4$1(0).toVar();
105
+ for (let x = -6; x <= 6; x++) {
106
+ const weight = float$1(weights[x + 6] / weightSum);
107
+ const offset = vec2$1(float$1(x), float$1(0)).mul(blurRadius).mul(pixelSize);
108
+ const sampleCoord = uv.add(offset);
109
+ const sample = childTexture.sample(sampleCoord).mul(weight);
110
+ total.assign(total.add(sample));
111
+ }
112
+ return total;
113
+ })());
114
+ onCleanup(() => {
115
+ if (horizontalTexture?.renderTarget?.dispose) horizontalTexture.renderTarget.dispose();
116
+ });
117
+ return Fn(() => {
118
+ const uv = screenUV$1;
119
+ const pixelSize = vec2$1(1).div(viewportSize$1);
120
+ const total = vec4$1(0).toVar();
121
+ for (let y = -6; y <= 6; y++) {
122
+ const weight = float$1(weights[y + 6] / weightSum);
123
+ const offset = vec2$1(float$1(0), float$1(y)).mul(blurRadius).mul(pixelSize);
124
+ const sampleCoord = uv.add(offset);
125
+ const sample = horizontalTexture.sample(sampleCoord).mul(weight);
126
+ total.assign(total.add(sample));
127
+ }
128
+ const blurred = total;
129
+ return mix$1(childTexture.sample(uv), blurred, blurAmount);
130
+ })();
131
+ }
132
+ };
133
+ var TiltShift_default = componentDefinition;
134
+ export { componentDefinition as n, TiltShift_default as t };
@@ -0,0 +1,76 @@
1
+ import { i as transformColorSpace, r as transformColor, t as colorSpaceOptions } from "./transformations-DxfQXZWi.js";
2
+ import { t as mixColors } from "./colorMixing-BXiTAqJU.js";
3
+ import * as TSL from "three/tsl";
4
+ const componentDefinition = {
5
+ name: "Tritone",
6
+ category: "Adjustments",
7
+ description: "Map colors to three tones: shadows, midtones, highlights",
8
+ requiresRTT: true,
9
+ requiresChild: true,
10
+ props: {
11
+ colorA: {
12
+ default: "#ce1bea",
13
+ transform: transformColor,
14
+ description: "First color (used for shadows/darkest areas)",
15
+ ui: {
16
+ type: "color",
17
+ label: "Color A (Shadows)"
18
+ }
19
+ },
20
+ colorB: {
21
+ default: "#2fff00",
22
+ transform: transformColor,
23
+ description: "Second color (used for midtones)",
24
+ ui: {
25
+ type: "color",
26
+ label: "Color B (Midtones)"
27
+ }
28
+ },
29
+ colorC: {
30
+ default: "#ffff00",
31
+ transform: transformColor,
32
+ description: "Third color (used for highlights/brightest areas)",
33
+ ui: {
34
+ type: "color",
35
+ label: "Color C (Highlights)"
36
+ }
37
+ },
38
+ blendMid: {
39
+ default: .5,
40
+ description: "Midpoint position between the three colors",
41
+ ui: {
42
+ type: "range",
43
+ min: 0,
44
+ max: 1,
45
+ step: .01,
46
+ label: "Midpoint"
47
+ }
48
+ },
49
+ colorSpace: {
50
+ default: "linear",
51
+ transform: transformColorSpace,
52
+ description: "Color space for color interpolation",
53
+ ui: {
54
+ type: "select",
55
+ options: colorSpaceOptions,
56
+ label: "Color Space"
57
+ }
58
+ }
59
+ },
60
+ fragmentNode: ({ uniforms, childNode, onCleanup }) => {
61
+ const { vec3: vec3$1, vec4: vec4$1, dot: dot$1, smoothstep, screenUV: screenUV$1, convertToTexture: convertToTexture$1 } = TSL;
62
+ if (!childNode) return vec4$1(0, 0, 0, 0);
63
+ const childTexture = convertToTexture$1(childNode);
64
+ onCleanup(() => {
65
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
66
+ });
67
+ const inputColor = childTexture.sample(screenUV$1);
68
+ const luminance = dot$1(inputColor.rgb, vec3$1(.299, .587, .114));
69
+ const shadowToMid = smoothstep(uniforms.blendMid.uniform.sub(.25), uniforms.blendMid.uniform, luminance);
70
+ const lowerBlend = mixColors(uniforms.colorA.uniform, uniforms.colorB.uniform, shadowToMid, uniforms.colorSpace.uniform);
71
+ const midToHighlight = smoothstep(uniforms.blendMid.uniform, uniforms.blendMid.uniform.add(.25), luminance);
72
+ return vec4$1(mixColors(lowerBlend, mixColors(uniforms.colorB.uniform, uniforms.colorC.uniform, midToHighlight, uniforms.colorSpace.uniform), smoothstep(uniforms.blendMid.uniform.sub(.1), uniforms.blendMid.uniform.add(.1), luminance), uniforms.colorSpace.uniform).rgb, inputColor.a);
73
+ }
74
+ };
75
+ var Tritone_default = componentDefinition;
76
+ export { componentDefinition as n, Tritone_default as t };
@@ -0,0 +1,96 @@
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: "Twirl",
6
+ category: "Distortions",
7
+ description: "Rotate and twist 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 twirl effect",
18
+ ui: {
19
+ type: "position",
20
+ label: "Center"
21
+ }
22
+ },
23
+ intensity: {
24
+ default: 1,
25
+ description: "The strength of the twirl effect",
26
+ ui: {
27
+ type: "range",
28
+ min: -5,
29
+ max: 5,
30
+ step: .1,
31
+ label: "Intensity"
32
+ }
33
+ },
34
+ edges: {
35
+ default: "stretch",
36
+ description: "How to handle edges when distortion pushes content out of bounds",
37
+ transform: transformEdges,
38
+ ui: {
39
+ type: "select",
40
+ options: [
41
+ {
42
+ label: "Stretch",
43
+ value: "stretch"
44
+ },
45
+ {
46
+ label: "Transparent",
47
+ value: "transparent"
48
+ },
49
+ {
50
+ label: "Mirror",
51
+ value: "mirror"
52
+ },
53
+ {
54
+ label: "Wrap",
55
+ value: "wrap"
56
+ }
57
+ ],
58
+ label: "Edges"
59
+ }
60
+ }
61
+ },
62
+ uvTransformNode: ({ uv, uniforms }) => {
63
+ const { vec2: vec2$1, cos: cos$1, sin: sin$1, length } = TSL;
64
+ const centerPos = vec2$1(uniforms.center.uniform.x, uniforms.center.uniform.y.oneMinus());
65
+ const delta = uv.sub(centerPos);
66
+ const angle = uniforms.intensity.uniform.mul(length(delta));
67
+ const cosAngle = cos$1(angle);
68
+ const sinAngle = sin$1(angle);
69
+ const rotatedX = cosAngle.mul(delta.x).sub(sinAngle.mul(delta.y));
70
+ const rotatedY = sinAngle.mul(delta.x).add(cosAngle.mul(delta.y));
71
+ return vec2$1(rotatedX.add(centerPos.x), rotatedY.add(centerPos.y));
72
+ },
73
+ fragmentNode: ({ uniforms, childNode, onCleanup }) => {
74
+ const { vec2: vec2$1, vec4: vec4$1, cos: cos$1, sin: sin$1, length, screenUV: screenUV$1, convertToTexture: convertToTexture$1 } = TSL;
75
+ if (!childNode) {
76
+ console.error("You must pass a child component into the Twirl shader.");
77
+ return vec4$1(0);
78
+ }
79
+ const texture = convertToTexture$1(childNode);
80
+ onCleanup(() => {
81
+ if (texture?.renderTarget?.dispose) texture.renderTarget.dispose();
82
+ });
83
+ const uvNode = screenUV$1;
84
+ const centerPos = vec2$1(uniforms.center.uniform.x, uniforms.center.uniform.y.oneMinus());
85
+ const delta = uvNode.sub(centerPos);
86
+ const angle = uniforms.intensity.uniform.mul(length(delta));
87
+ const cosAngle = cos$1(angle);
88
+ const sinAngle = sin$1(angle);
89
+ const rotatedX = cosAngle.mul(delta.x).sub(sinAngle.mul(delta.y));
90
+ const rotatedY = sinAngle.mul(delta.x).add(cosAngle.mul(delta.y));
91
+ const twistedUV = vec2$1(rotatedX.add(centerPos.x), rotatedY.add(centerPos.y));
92
+ return applyEdgeHandling(twistedUV, texture.sample(twistedUV), texture, uniforms.edges.uniform);
93
+ }
94
+ };
95
+ var Twirl_default = componentDefinition;
96
+ export { componentDefinition as n, Twirl_default as t };
@@ -0,0 +1,30 @@
1
+ import * as TSL from "three/tsl";
2
+ import { vibrance } from "three/src/nodes/display/ColorAdjustment";
3
+ const componentDefinition = {
4
+ name: "Vibrance",
5
+ category: "Adjustments",
6
+ description: "Selective saturation adjustment protecting skin tones",
7
+ requiresChild: true,
8
+ props: { intensity: {
9
+ default: 0,
10
+ description: "The intensity of the vibrance effect",
11
+ ui: {
12
+ type: "range",
13
+ min: -2,
14
+ max: 2,
15
+ step: .01,
16
+ label: "Intensity"
17
+ }
18
+ } },
19
+ fragmentNode: ({ uniforms, childNode }) => {
20
+ const { vec4: vec4$1 } = TSL;
21
+ if (!childNode) {
22
+ console.error("You must pass a child component into the Vibrance shader.");
23
+ return vec4$1(0);
24
+ }
25
+ const sourceColor = childNode || vec4$1(0, 0, 0, 0);
26
+ return vec4$1(vibrance(sourceColor.rgb, uniforms.intensity.uniform).rgb, sourceColor.a);
27
+ }
28
+ };
29
+ var Vibrance_default = componentDefinition;
30
+ export { componentDefinition as n, Vibrance_default as t };
@@ -0,0 +1,173 @@
1
+ import { t as applyEdgeHandling } from "./edges-Bn_OIa_h.js";
2
+ import { a as transformEdges } from "./transformations-DxfQXZWi.js";
3
+ import * as TSL from "three/tsl";
4
+ const componentDefinition = {
5
+ name: "WaveDistortion",
6
+ category: "Distortions",
7
+ description: "Wave-based distortion with multiple waveform types",
8
+ requiresRTT: true,
9
+ requiresChild: true,
10
+ props: {
11
+ strength: {
12
+ default: .3,
13
+ description: "Distortion intensity",
14
+ ui: {
15
+ type: "range",
16
+ min: 0,
17
+ max: 1,
18
+ step: .01,
19
+ label: "Strength"
20
+ }
21
+ },
22
+ frequency: {
23
+ default: 1,
24
+ description: "Number of bends/waves",
25
+ ui: {
26
+ type: "range",
27
+ min: .1,
28
+ max: 10,
29
+ step: .1,
30
+ label: "Frequency"
31
+ }
32
+ },
33
+ speed: {
34
+ default: 1,
35
+ description: "Animation speed",
36
+ ui: {
37
+ type: "range",
38
+ min: 0,
39
+ max: 5,
40
+ step: .1,
41
+ label: "Speed"
42
+ }
43
+ },
44
+ angle: {
45
+ default: 0,
46
+ description: "Direction of wave distortion in degrees",
47
+ ui: {
48
+ type: "range",
49
+ min: 0,
50
+ max: 360,
51
+ step: 1,
52
+ label: "Angle"
53
+ }
54
+ },
55
+ waveType: {
56
+ default: "sine",
57
+ description: "Shape of the distortion wave",
58
+ transform: (value) => {
59
+ return {
60
+ "sine": 0,
61
+ "triangle": 1,
62
+ "square": 2,
63
+ "sawtooth": 3
64
+ }[value] ?? 0;
65
+ },
66
+ ui: {
67
+ type: "select",
68
+ options: [
69
+ {
70
+ label: "Sine",
71
+ value: "sine"
72
+ },
73
+ {
74
+ label: "Triangle",
75
+ value: "triangle"
76
+ },
77
+ {
78
+ label: "Square",
79
+ value: "square"
80
+ },
81
+ {
82
+ label: "Sawtooth",
83
+ value: "sawtooth"
84
+ }
85
+ ],
86
+ label: "Wave Type"
87
+ }
88
+ },
89
+ edges: {
90
+ default: "stretch",
91
+ description: "How to handle edges when distortion pushes content out of bounds",
92
+ transform: transformEdges,
93
+ ui: {
94
+ type: "select",
95
+ options: [
96
+ {
97
+ label: "Stretch",
98
+ value: "stretch"
99
+ },
100
+ {
101
+ label: "Transparent",
102
+ value: "transparent"
103
+ },
104
+ {
105
+ label: "Mirror",
106
+ value: "mirror"
107
+ },
108
+ {
109
+ label: "Wrap",
110
+ value: "wrap"
111
+ }
112
+ ],
113
+ label: "Edges"
114
+ }
115
+ }
116
+ },
117
+ uvTransformNode: ({ uv, uniforms }) => {
118
+ const { vec2: vec2$1, sin: sin$1, cos: cos$1, abs: abs$1, fract, step: step$1, float: float$1, PI, time } = TSL;
119
+ const t = time.mul(uniforms.speed.uniform).mul(.5);
120
+ const angleRad = uniforms.angle.uniform.mul(PI).div(180);
121
+ const cosAngle = cos$1(angleRad);
122
+ const sinAngle = sin$1(angleRad);
123
+ const centeredUV = uv.sub(vec2$1(.5, .5));
124
+ const phase = vec2$1(centeredUV.x.mul(cosAngle).sub(centeredUV.y.mul(sinAngle)), centeredUV.x.mul(sinAngle).add(centeredUV.y.mul(cosAngle))).add(vec2$1(.5, .5)).y.mul(uniforms.frequency.uniform).mul(PI.mul(2)).add(t);
125
+ const normalizedPhase = fract(phase.div(PI.mul(2)));
126
+ const sineWave = sin$1(phase);
127
+ const triangleWave = abs$1(normalizedPhase.mul(2).sub(1)).mul(2).sub(1);
128
+ const squareWave = step$1(float$1(.5), normalizedPhase).mul(2).sub(1);
129
+ const sawtoothWave = normalizedPhase.mul(2).sub(1);
130
+ const waveTypeValue = uniforms.waveType.uniform;
131
+ const isSine = step$1(waveTypeValue, float$1(.5));
132
+ const isTriangle = step$1(float$1(.5), waveTypeValue).mul(step$1(waveTypeValue, float$1(1.5)));
133
+ const isSquare = step$1(float$1(1.5), waveTypeValue).mul(step$1(waveTypeValue, float$1(2.5)));
134
+ const isSawtooth = step$1(float$1(2.5), waveTypeValue);
135
+ const displacement = sineWave.mul(isSine).add(triangleWave.mul(isTriangle)).add(squareWave.mul(isSquare)).add(sawtoothWave.mul(isSawtooth)).mul(uniforms.strength.uniform).mul(.5);
136
+ const displacementX = displacement.mul(cosAngle);
137
+ const displacementY = displacement.mul(sinAngle);
138
+ return vec2$1(uv.x.add(displacementX), uv.y.add(displacementY));
139
+ },
140
+ fragmentNode: (params) => {
141
+ const { uniforms, childNode, onCleanup } = params;
142
+ const { vec2: vec2$1, vec4: vec4$1, sin: sin$1, cos: cos$1, abs: abs$1, fract, step: step$1, convertToTexture: convertToTexture$1, screenUV: screenUV$1, float: float$1, PI, time } = TSL;
143
+ if (!childNode) return vec4$1(0, 0, 0, 0);
144
+ const uvCoord = screenUV$1;
145
+ const t = time.mul(uniforms.speed.uniform).mul(.5);
146
+ const angleRad = uniforms.angle.uniform.mul(PI).div(180);
147
+ const cosAngle = cos$1(angleRad);
148
+ const sinAngle = sin$1(angleRad);
149
+ const centeredUV = uvCoord.sub(vec2$1(.5, .5));
150
+ const phase = vec2$1(centeredUV.x.mul(cosAngle).sub(centeredUV.y.mul(sinAngle)), centeredUV.x.mul(sinAngle).add(centeredUV.y.mul(cosAngle))).add(vec2$1(.5, .5)).y.mul(uniforms.frequency.uniform).mul(PI.mul(2)).add(t);
151
+ const normalizedPhase = fract(phase.div(PI.mul(2)));
152
+ const sineWave = sin$1(phase);
153
+ const triangleWave = abs$1(normalizedPhase.mul(2).sub(1)).mul(2).sub(1);
154
+ const squareWave = step$1(float$1(.5), normalizedPhase).mul(2).sub(1);
155
+ const sawtoothWave = normalizedPhase.mul(2).sub(1);
156
+ const waveTypeValue = uniforms.waveType.uniform;
157
+ const isSine = step$1(waveTypeValue, float$1(.5));
158
+ const isTriangle = step$1(float$1(.5), waveTypeValue).mul(step$1(waveTypeValue, float$1(1.5)));
159
+ const isSquare = step$1(float$1(1.5), waveTypeValue).mul(step$1(waveTypeValue, float$1(2.5)));
160
+ const isSawtooth = step$1(float$1(2.5), waveTypeValue);
161
+ const displacement = sineWave.mul(isSine).add(triangleWave.mul(isTriangle)).add(squareWave.mul(isSquare)).add(sawtoothWave.mul(isSawtooth)).mul(uniforms.strength.uniform).mul(.5);
162
+ const displacementX = displacement.mul(cosAngle);
163
+ const displacementY = displacement.mul(sinAngle);
164
+ const distortedUV = vec2$1(uvCoord.x.add(displacementX), uvCoord.y.add(displacementY));
165
+ const childTexture = convertToTexture$1(childNode);
166
+ onCleanup(() => {
167
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
168
+ });
169
+ return applyEdgeHandling(distortedUV, childTexture.sample(distortedUV), childTexture, uniforms.edges.uniform);
170
+ }
171
+ };
172
+ var WaveDistortion_default = componentDefinition;
173
+ export { componentDefinition as n, WaveDistortion_default as t };
@@ -0,0 +1,62 @@
1
+ import { o as transformPosition } from "./transformations-DxfQXZWi.js";
2
+ import * as TSL from "three/tsl";
3
+ const componentDefinition = {
4
+ name: "ZoomBlur",
5
+ category: "Blurs",
6
+ description: "Radial zoom blur expanding from a center point",
7
+ requiresRTT: true,
8
+ requiresChild: true,
9
+ props: {
10
+ intensity: {
11
+ default: 30,
12
+ description: "Intensity of the zoom blur effect",
13
+ ui: {
14
+ type: "range",
15
+ min: 0,
16
+ max: 100,
17
+ step: 1,
18
+ label: "Intensity"
19
+ }
20
+ },
21
+ center: {
22
+ default: {
23
+ x: .5,
24
+ y: .5
25
+ },
26
+ transform: transformPosition,
27
+ description: "Center point of the zoom blur",
28
+ ui: {
29
+ type: "position",
30
+ label: "Center"
31
+ }
32
+ }
33
+ },
34
+ fragmentNode: ({ uniforms, childNode, onCleanup }) => {
35
+ const { vec2: vec2$1, vec4: vec4$1, float: float$1, screenUV: screenUV$1, Fn, convertToTexture: convertToTexture$1 } = TSL;
36
+ if (!childNode) return vec4$1(0, 0, 0, 0);
37
+ const childTexture = convertToTexture$1(childNode);
38
+ onCleanup(() => {
39
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
40
+ });
41
+ const center = vec2$1(uniforms.center.uniform.x, uniforms.center.uniform.y.oneMinus());
42
+ const radius = uniforms.intensity.uniform.mul(.01);
43
+ return Fn(() => {
44
+ const uv = screenUV$1;
45
+ const total = vec4$1(0).toVar();
46
+ const totalWeight = float$1(0).toVar();
47
+ for (let i = 0; i < 32; i++) {
48
+ const t = float$1(i).div(float$1(31));
49
+ const weightT = t.sub(.5).mul(2);
50
+ const weight = float$1(1).div(float$1(2.506628)).mul(float$1(-.5).mul(weightT).mul(weightT).div(float$1(.64)).exp());
51
+ const scale = float$1(1).add(radius.mul(t));
52
+ const scaledCoord = uv.sub(center).div(scale).add(center);
53
+ const sample = childTexture.sample(scaledCoord).mul(weight);
54
+ total.assign(total.add(sample));
55
+ totalWeight.assign(totalWeight.add(weight));
56
+ }
57
+ return total.div(totalWeight);
58
+ })();
59
+ }
60
+ };
61
+ var ZoomBlur_default = componentDefinition;
62
+ export { componentDefinition as n, ZoomBlur_default as t };
@@ -0,0 +1,69 @@
1
+ import * as TSL from "three/tsl";
2
+ var { vec3: vec3$1, vec4: vec4$1, float: float$1, pow: pow$1, sqrt: sqrt$1, atan: atan$1, cos: cos$1, sin: sin$1 } = TSL;
3
+ var p3ToSRGB = (p3) => {
4
+ return vec3$1(p3.x.mul(1.2249401).sub(p3.y.mul(.2249404)).sub(p3.z.mul(0)), p3.x.mul(-.0420569).add(p3.y.mul(1.0420571)).add(p3.z.mul(0)), p3.x.mul(-.0196376).sub(p3.y.mul(.0786361)).add(p3.z.mul(1.0982735)));
5
+ };
6
+ var sRGBToP3 = (srgb) => {
7
+ return vec3$1(srgb.x.mul(.8224621).add(srgb.y.mul(.177538)).add(srgb.z.mul(0)), srgb.x.mul(.0331941).add(srgb.y.mul(.9668058)).add(srgb.z.mul(0)), srgb.x.mul(.0170826).add(srgb.y.mul(.0723974)).add(srgb.z.mul(.9105199)));
8
+ };
9
+ var rgbToOklab = (rgb) => {
10
+ const r = rgb.x;
11
+ const g = rgb.y;
12
+ const b = rgb.z;
13
+ const l = r.mul(.4122214708).add(g.mul(.5363325363)).add(b.mul(.0514459929));
14
+ const m = r.mul(.2119034982).add(g.mul(.6806995451).add(b.mul(.1073969566)));
15
+ const s = r.mul(.0883024619).add(g.mul(.2817188376)).add(b.mul(.6299787005));
16
+ const l_ = pow$1(l, float$1(1 / 3));
17
+ const m_ = pow$1(m, float$1(1 / 3));
18
+ const s_ = pow$1(s, float$1(1 / 3));
19
+ return vec3$1(l_.mul(.2104542553).add(m_.mul(.793617785)).sub(s_.mul(.0040720468)), l_.mul(1.9779984951).sub(m_.mul(2.428592205)).add(s_.mul(.4505937099)), l_.mul(.0259040371).add(m_.mul(.7827717662)).sub(s_.mul(.808675766)));
20
+ };
21
+ var oklabToRgb = (lab) => {
22
+ const L = lab.x;
23
+ const a = lab.y;
24
+ const b = lab.z;
25
+ const l_ = L.add(a.mul(.3963377774)).add(b.mul(.2158037573));
26
+ const m_ = L.sub(a.mul(.1055613458)).sub(b.mul(.0638541728));
27
+ const s_ = L.sub(a.mul(.0894841775)).sub(b.mul(1.291485548));
28
+ const l = pow$1(l_, float$1(3));
29
+ const m = pow$1(m_, float$1(3));
30
+ const s = pow$1(s_, float$1(3));
31
+ return vec3$1(l.mul(4.0767416621).sub(m.mul(3.3077115913)).add(s.mul(.2309699292)), l.mul(-1.2684380046).add(m.mul(2.6097574011)).sub(s.mul(.3413193965)), l.mul(-.0041960863).sub(m.mul(.7034186147)).add(s.mul(1.707614701)));
32
+ };
33
+ var oklabToOklch = (lab) => {
34
+ const L = lab.x;
35
+ const a = lab.y;
36
+ const b = lab.z;
37
+ return vec3$1(L, sqrt$1(a.mul(a).add(b.mul(b))), atan$1(b, a));
38
+ };
39
+ var oklchToOklab = (lch) => {
40
+ const L = lch.x;
41
+ const C = lch.y;
42
+ const h = lch.z;
43
+ return vec3$1(L, C.mul(cos$1(h)), C.mul(sin$1(h)));
44
+ };
45
+ const mixColors = (colorA, colorB, t, colorSpaceMode) => {
46
+ const p3A = vec3$1(colorA.x, colorA.y, colorA.z);
47
+ const p3B = vec3$1(colorB.x, colorB.y, colorB.z);
48
+ const alphaA = colorA.w;
49
+ const alphaB = colorB.w;
50
+ const weightA = alphaA.mul(float$1(1).sub(t));
51
+ const weightB = alphaB.mul(t);
52
+ const totalWeight = weightA.add(weightB);
53
+ const safeWeight = TSL.max(totalWeight, float$1(.001));
54
+ const alphaWeightedMix = (rgbA, rgbB) => {
55
+ return rgbA.mul(weightA).add(rgbB.mul(weightB)).div(safeWeight);
56
+ };
57
+ const linearMix = alphaWeightedMix(p3A, p3B);
58
+ const srgbA = p3ToSRGB(p3A);
59
+ const srgbB = p3ToSRGB(p3B);
60
+ const oklabA = rgbToOklab(srgbA);
61
+ const oklabB = rgbToOklab(srgbB);
62
+ const oklchResult = sRGBToP3(oklabToRgb(oklchToOklab(alphaWeightedMix(oklabToOklch(oklabA), oklabToOklch(oklabB)))));
63
+ const oklabResult = sRGBToP3(oklabToRgb(alphaWeightedMix(oklabA, oklabB)));
64
+ const isMode1OrHigher = colorSpaceMode.greaterThanEqual(float$1(.5));
65
+ const rgb = colorSpaceMode.greaterThanEqual(float$1(1.5)).select(oklabResult, isMode1OrHigher.select(oklchResult, linearMix));
66
+ const alpha = totalWeight;
67
+ return vec4$1(rgb.x, rgb.y, rgb.z, alpha);
68
+ };
69
+ export { mixColors as t };
@@ -0,0 +1,26 @@
1
+ import * as TSL from "three/tsl";
2
+ var { vec2: vec2$1, vec4: vec4$1, step: step$1, abs: abs$1, mod, fract, float: float$1, select } = TSL;
3
+ const applyEdgeToUV = (uv, edgeModeUniform) => {
4
+ const stretchedUV = uv.clamp(vec2$1(0, 0), vec2$1(1, 1));
5
+ const transparentUV = uv;
6
+ const mirrorX = mod(abs$1(uv.x), float$1(2));
7
+ const mirrorY = mod(abs$1(uv.y), float$1(2));
8
+ const mirroredUV = vec2$1(select(step$1(float$1(1), mirrorX), float$1(2).sub(mirrorX), mirrorX), select(step$1(float$1(1), mirrorY), float$1(2).sub(mirrorY), mirrorY));
9
+ const wrappedUV = fract(uv);
10
+ return select(step$1(float$1(.5), edgeModeUniform), select(step$1(float$1(1.5), edgeModeUniform), select(step$1(float$1(2.5), edgeModeUniform), wrappedUV, mirroredUV), transparentUV), stretchedUV);
11
+ };
12
+ const applyEdgeHandling = (distortedUV, sampledColor, childTexture, edgeModeUniform) => {
13
+ const inBoundsX = step$1(float$1(0), distortedUV.x).mul(step$1(distortedUV.x, float$1(1)));
14
+ const inBoundsY = step$1(float$1(0), distortedUV.y).mul(step$1(distortedUV.y, float$1(1)));
15
+ const inBounds = inBoundsX.mul(inBoundsY);
16
+ const transparentColor = vec4$1(sampledColor.rgb, sampledColor.a.mul(inBounds));
17
+ if (!childTexture) return select(step$1(float$1(.5), edgeModeUniform), transparentColor, sampledColor);
18
+ const mirrorX = mod(abs$1(distortedUV.x), float$1(2));
19
+ const mirrorY = mod(abs$1(distortedUV.y), float$1(2));
20
+ const mirroredUV = vec2$1(select(step$1(float$1(1), mirrorX), float$1(2).sub(mirrorX), mirrorX), select(step$1(float$1(1), mirrorY), float$1(2).sub(mirrorY), mirrorY));
21
+ const mirrorColor = childTexture.sample(mirroredUV);
22
+ const wrappedUV = vec2$1(fract(distortedUV.x), fract(distortedUV.y));
23
+ const wrapColor = childTexture.sample(wrappedUV);
24
+ return select(step$1(float$1(.5), edgeModeUniform), select(step$1(float$1(1.5), edgeModeUniform), select(step$1(float$1(2.5), edgeModeUniform), wrapColor, mirrorColor), transparentColor), sampledColor);
25
+ };
26
+ export { applyEdgeToUV as n, applyEdgeHandling as t };