shaders 2.2.25 → 2.2.27

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 (184) hide show
  1. package/dist/core/{AngularBlur-Dl2gwk68.js → AngularBlur-DKFExWUF.js} +15 -16
  2. package/dist/core/{Ascii-Dha_QpT3.js → Ascii-BRApYlD4.js} +18 -19
  3. package/dist/core/{Beam-CTN9Ni43.js → Beam-DU7wxmIh.js} +23 -24
  4. package/dist/core/{Blob-CxFDZovO.js → Blob-nssNzEgN.js} +37 -38
  5. package/dist/core/{Blur-Y2FsmFk_.js → Blur-k37gOaRA.js} +16 -17
  6. package/dist/core/{Bulge-Cb-t0xqI.js → Bulge-Dm02_fG6.js} +23 -25
  7. package/dist/core/{CRTScreen-CtERsenz.js → CRTScreen-DLy8Rig6.js} +19 -20
  8. package/dist/core/ChannelBlur-BPOGOQXl.js +117 -0
  9. package/dist/core/{Checkerboard-CgB-egNY.js → Checkerboard-SKsXoUXE.js} +9 -10
  10. package/dist/core/{ChromaFlow-vRCwhQpN.js → ChromaFlow-VpfgLFbs.js} +31 -32
  11. package/dist/core/{ChromaticAberration-FTquTQIL.js → ChromaticAberration-CaCyXMyE.js} +10 -11
  12. package/dist/core/{Circle-Daziv5d7.js → Circle-BHnAmzVb.js} +7 -8
  13. package/dist/core/{CursorTrail-Bsz9e6Fn.js → CursorTrail-CfVWIKok.js} +16 -17
  14. package/dist/core/{DiffuseBlur-Cj2PtRNd.js → DiffuseBlur-GWPb8Zht.js} +19 -21
  15. package/dist/core/{Dither-D2Nf4p3w.js → Dither-BNEeyo0u.js} +7 -8
  16. package/dist/core/{DotGrid-CzOwquo4.js → DotGrid-CRRS6nbt.js} +10 -11
  17. package/dist/core/{Duotone-XuTN9tI7.js → Duotone-5gKND3an.js} +8 -9
  18. package/dist/core/{FilmGrain-D3-nbi12.js → FilmGrain-osBGk_b9.js} +4 -5
  19. package/dist/core/{FloatingParticles-D9Nnu1qg.js → FloatingParticles-CULOurGT.js} +41 -42
  20. package/dist/core/GlassTiles-CA90XrNT.js +67 -0
  21. package/dist/core/{Glow-BluFc9be.js → Glow-D0boDIAW.js} +12 -13
  22. package/dist/core/{Godrays-ChLh_vGl.js → Godrays-BQsDwU26.js} +27 -28
  23. package/dist/core/{Grayscale-DRny75A9.js → Grayscale-Bi-XBvO_.js} +4 -6
  24. package/dist/core/{Grid-DgyDa4H1.js → Grid-CWHxwO7R.js} +7 -8
  25. package/dist/core/{GridDistortion-BAspCYvp.js → GridDistortion-CZB9w-rv.js} +21 -22
  26. package/dist/core/{Group-Dul7PUBl.js → Group-C0AknFDS.js} +2 -3
  27. package/dist/core/{Halftone-Ifv5F_FT.js → Halftone-MMcLMRpL.js} +11 -12
  28. package/dist/core/HueShift-DvOpzM7W.js +47 -0
  29. package/dist/core/{ImageTexture-DvYcQgJB.js → ImageTexture-D9OMwqAs.js} +26 -27
  30. package/dist/core/{Invert-Fz0NtIJc.js → Invert-Bmjbp6g6.js} +5 -6
  31. package/dist/core/{LinearBlur-LmhnQoA4.js → LinearBlur-B-Ikurxt.js} +12 -13
  32. package/dist/core/{LinearGradient-xbloQjzt.js → LinearGradient-DV6UkhZk.js} +21 -22
  33. package/dist/core/{Liquify-DMe1V5-O.js → Liquify-W8UQNeEM.js} +24 -26
  34. package/dist/core/{Pixelate-Cv8537Pj.js → Pixelate-_pyYeLRP.js} +6 -8
  35. package/dist/core/{PolarCoordinates-DDvDhBE-.js → PolarCoordinates-D63xm0oJ.js} +15 -17
  36. package/dist/core/{Posterize-3m3xkWOz.js → Posterize-DIjjPS72.js} +4 -5
  37. package/dist/core/{ProgressiveBlur-EGkevObV.js → ProgressiveBlur-G-s-o9ic.js} +23 -24
  38. package/dist/core/{RadialGradient-B7ZZB_VJ.js → RadialGradient-BGVqSwh0.js} +6 -7
  39. package/dist/core/{RectangularCoordinates-muWR8mZS.js → RectangularCoordinates-DyHBo456.js} +19 -21
  40. package/dist/core/{Ripples-8XaZaXQF.js → Ripples-2FGWCZlp.js} +9 -10
  41. package/dist/core/{Saturation-CYFI1jzN.js → Saturation-J0nI4hmh.js} +4 -6
  42. package/dist/core/{SimplexNoise-DJUe0wz_.js → SimplexNoise-B6dtUCmn.js} +4 -4
  43. package/dist/core/{SineWave-Dl3nFO1W.js → SineWave-BtPf6-2H.js} +11 -12
  44. package/dist/core/{SolidColor-CWGq_Bjq.js → SolidColor-CETl1cEr.js} +1 -1
  45. package/dist/core/{Spherize-C-jZEUsN.js → Spherize-BwvUcorJ.js} +24 -25
  46. package/dist/core/{Spiral-BSB_R39p.js → Spiral-DmJWmUmr.js} +16 -17
  47. package/dist/core/{Strands-0stO5BMy.js → Strands-CV1oCmHx.js} +31 -32
  48. package/dist/core/{Stretch-B645paha.js → Stretch-pl-Cn2F8.js} +23 -25
  49. package/dist/core/{Swirl-CVnbawit.js → Swirl-D65vXLDw.js} +15 -16
  50. package/dist/core/{TiltShift-0CxNRI6L.js → TiltShift-CFcK6Hzg.js} +22 -23
  51. package/dist/core/{Tritone-Daa-I5UD.js → Tritone-EmnjV2rX.js} +8 -9
  52. package/dist/core/{Twirl-2CJVZEtk.js → Twirl-HSMyRx5I.js} +18 -20
  53. package/dist/core/{Vibrance-DRtecEvb.js → Vibrance-BI5q7_Wt.js} +8 -6
  54. package/dist/core/{WaveDistortion-BscXN2rs.js → WaveDistortion-DG8GO_l8.js} +31 -33
  55. package/dist/core/{ZoomBlur-CAqK0Kju.js → ZoomBlur-C01oGwwG.js} +12 -13
  56. package/dist/core/colorMixing-CZPFmiT4.js +68 -0
  57. package/dist/core/edges-Djr_12SL.js +25 -0
  58. package/dist/core/helpers/distort.d.ts.map +1 -1
  59. package/dist/core/helpers/edgeMask.d.ts.map +1 -1
  60. package/dist/core/helpers/glow.d.ts +3 -2
  61. package/dist/core/helpers/glow.d.ts.map +1 -1
  62. package/dist/core/helpers/grain.d.ts.map +1 -1
  63. package/dist/core/index.js +99 -107
  64. package/dist/core/shaders/AngularBlur/index.d.ts.map +1 -1
  65. package/dist/core/shaders/AngularBlur/index.js +2 -2
  66. package/dist/core/shaders/Ascii/index.d.ts.map +1 -1
  67. package/dist/core/shaders/Ascii/index.js +1 -1
  68. package/dist/core/shaders/Beam/index.d.ts.map +1 -1
  69. package/dist/core/shaders/Beam/index.js +3 -3
  70. package/dist/core/shaders/Blob/index.d.ts.map +1 -1
  71. package/dist/core/shaders/Blob/index.js +3 -3
  72. package/dist/core/shaders/Blur/index.d.ts.map +1 -1
  73. package/dist/core/shaders/Blur/index.js +1 -1
  74. package/dist/core/shaders/Bulge/index.d.ts.map +1 -1
  75. package/dist/core/shaders/Bulge/index.js +3 -3
  76. package/dist/core/shaders/CRTScreen/index.d.ts.map +1 -1
  77. package/dist/core/shaders/CRTScreen/index.js +1 -1
  78. package/dist/core/shaders/ChannelBlur/index.d.ts.map +1 -1
  79. package/dist/core/shaders/ChannelBlur/index.js +1 -1
  80. package/dist/core/shaders/Checkerboard/index.d.ts.map +1 -1
  81. package/dist/core/shaders/Checkerboard/index.js +3 -3
  82. package/dist/core/shaders/ChromaFlow/index.d.ts.map +1 -1
  83. package/dist/core/shaders/ChromaFlow/index.js +2 -2
  84. package/dist/core/shaders/ChromaticAberration/index.d.ts.map +1 -1
  85. package/dist/core/shaders/ChromaticAberration/index.js +2 -2
  86. package/dist/core/shaders/Circle/index.d.ts.map +1 -1
  87. package/dist/core/shaders/Circle/index.js +2 -2
  88. package/dist/core/shaders/CursorTrail/index.d.ts.map +1 -1
  89. package/dist/core/shaders/CursorTrail/index.js +3 -3
  90. package/dist/core/shaders/DiffuseBlur/index.d.ts.map +1 -1
  91. package/dist/core/shaders/DiffuseBlur/index.js +3 -3
  92. package/dist/core/shaders/Dither/index.d.ts.map +1 -1
  93. package/dist/core/shaders/Dither/index.js +2 -2
  94. package/dist/core/shaders/DotGrid/index.d.ts.map +1 -1
  95. package/dist/core/shaders/DotGrid/index.js +2 -2
  96. package/dist/core/shaders/Duotone/index.d.ts.map +1 -1
  97. package/dist/core/shaders/Duotone/index.js +3 -3
  98. package/dist/core/shaders/FilmGrain/index.d.ts.map +1 -1
  99. package/dist/core/shaders/FilmGrain/index.js +1 -1
  100. package/dist/core/shaders/FloatingParticles/index.d.ts.map +1 -1
  101. package/dist/core/shaders/FloatingParticles/index.js +2 -2
  102. package/dist/core/shaders/GlassTiles/index.d.ts.map +1 -1
  103. package/dist/core/shaders/GlassTiles/index.js +1 -1
  104. package/dist/core/shaders/Glow/index.d.ts.map +1 -1
  105. package/dist/core/shaders/Glow/index.js +1 -1
  106. package/dist/core/shaders/Godrays/index.d.ts.map +1 -1
  107. package/dist/core/shaders/Godrays/index.js +2 -2
  108. package/dist/core/shaders/Grayscale/index.d.ts.map +1 -1
  109. package/dist/core/shaders/Grayscale/index.js +1 -1
  110. package/dist/core/shaders/Grid/index.d.ts.map +1 -1
  111. package/dist/core/shaders/Grid/index.js +2 -2
  112. package/dist/core/shaders/GridDistortion/index.d.ts.map +1 -1
  113. package/dist/core/shaders/GridDistortion/index.js +3 -3
  114. package/dist/core/shaders/Group/index.d.ts.map +1 -1
  115. package/dist/core/shaders/Group/index.js +1 -1
  116. package/dist/core/shaders/Halftone/index.d.ts.map +1 -1
  117. package/dist/core/shaders/Halftone/index.js +2 -2
  118. package/dist/core/shaders/HueShift/index.d.ts.map +1 -1
  119. package/dist/core/shaders/HueShift/index.js +1 -1
  120. package/dist/core/shaders/ImageTexture/index.d.ts.map +1 -1
  121. package/dist/core/shaders/ImageTexture/index.js +1 -1
  122. package/dist/core/shaders/Invert/index.d.ts.map +1 -1
  123. package/dist/core/shaders/Invert/index.js +1 -1
  124. package/dist/core/shaders/LinearBlur/index.d.ts.map +1 -1
  125. package/dist/core/shaders/LinearBlur/index.js +2 -2
  126. package/dist/core/shaders/LinearGradient/index.d.ts.map +1 -1
  127. package/dist/core/shaders/LinearGradient/index.js +3 -3
  128. package/dist/core/shaders/Liquify/index.d.ts.map +1 -1
  129. package/dist/core/shaders/Liquify/index.js +3 -3
  130. package/dist/core/shaders/Pixelate/index.d.ts.map +1 -1
  131. package/dist/core/shaders/Pixelate/index.js +1 -1
  132. package/dist/core/shaders/PolarCoordinates/index.d.ts.map +1 -1
  133. package/dist/core/shaders/PolarCoordinates/index.js +3 -3
  134. package/dist/core/shaders/Posterize/index.d.ts.map +1 -1
  135. package/dist/core/shaders/Posterize/index.js +1 -1
  136. package/dist/core/shaders/ProgressiveBlur/index.d.ts.map +1 -1
  137. package/dist/core/shaders/ProgressiveBlur/index.js +2 -2
  138. package/dist/core/shaders/RadialGradient/index.d.ts.map +1 -1
  139. package/dist/core/shaders/RadialGradient/index.js +3 -3
  140. package/dist/core/shaders/RectangularCoordinates/index.d.ts.map +1 -1
  141. package/dist/core/shaders/RectangularCoordinates/index.js +3 -3
  142. package/dist/core/shaders/Ripples/index.d.ts.map +1 -1
  143. package/dist/core/shaders/Ripples/index.js +3 -3
  144. package/dist/core/shaders/Saturation/index.d.ts.map +1 -1
  145. package/dist/core/shaders/Saturation/index.js +1 -1
  146. package/dist/core/shaders/SimplexNoise/index.js +3 -3
  147. package/dist/core/shaders/SineWave/index.d.ts.map +1 -1
  148. package/dist/core/shaders/SineWave/index.js +2 -2
  149. package/dist/core/shaders/SolidColor/index.js +2 -2
  150. package/dist/core/shaders/Spherize/index.d.ts.map +1 -1
  151. package/dist/core/shaders/Spherize/index.js +2 -2
  152. package/dist/core/shaders/Spiral/index.d.ts.map +1 -1
  153. package/dist/core/shaders/Spiral/index.js +3 -3
  154. package/dist/core/shaders/Strands/index.d.ts.map +1 -1
  155. package/dist/core/shaders/Strands/index.js +2 -2
  156. package/dist/core/shaders/Stretch/index.d.ts.map +1 -1
  157. package/dist/core/shaders/Stretch/index.js +3 -3
  158. package/dist/core/shaders/Swirl/index.d.ts.map +1 -1
  159. package/dist/core/shaders/Swirl/index.js +3 -3
  160. package/dist/core/shaders/TiltShift/index.d.ts.map +1 -1
  161. package/dist/core/shaders/TiltShift/index.js +2 -2
  162. package/dist/core/shaders/Tritone/index.d.ts.map +1 -1
  163. package/dist/core/shaders/Tritone/index.js +3 -3
  164. package/dist/core/shaders/Twirl/index.d.ts.map +1 -1
  165. package/dist/core/shaders/Twirl/index.js +3 -3
  166. package/dist/core/shaders/Vibrance/index.d.ts.map +1 -1
  167. package/dist/core/shaders/Vibrance/index.js +1 -1
  168. package/dist/core/shaders/WaveDistortion/index.d.ts.map +1 -1
  169. package/dist/core/shaders/WaveDistortion/index.js +3 -3
  170. package/dist/core/shaders/ZoomBlur/index.d.ts.map +1 -1
  171. package/dist/core/shaders/ZoomBlur/index.js +2 -2
  172. package/dist/core/{transformations-DxfQXZWi.js → transformations-Dv5JW9ck.js} +11 -12
  173. package/dist/core/utilities/colorMixing.d.ts.map +1 -1
  174. package/dist/core/utilities/edges.d.ts.map +1 -1
  175. package/dist/core/utilities/transformations.d.ts.map +1 -1
  176. package/dist/core/utilities/uniforms.d.ts.map +1 -1
  177. package/dist/core/utilities/uv.d.ts.map +1 -1
  178. package/dist/core/utilities/uvTransform.d.ts.map +1 -1
  179. package/package.json +1 -1
  180. package/dist/core/ChannelBlur-CvM6GJgZ.js +0 -118
  181. package/dist/core/GlassTiles-CnjCvajI.js +0 -69
  182. package/dist/core/HueShift-De8ukMWs.js +0 -31
  183. package/dist/core/colorMixing-BXiTAqJU.js +0 -69
  184. package/dist/core/edges-Bn_OIa_h.js +0 -26
@@ -1,5 +1,5 @@
1
- import { o as transformPosition } from "./transformations-DxfQXZWi.js";
2
- import * as TSL from "three/tsl";
1
+ import { o as transformPosition } from "./transformations-Dv5JW9ck.js";
2
+ import { Fn, convertToTexture, cos, float, screenUV, sin, vec2, vec4 } from "three/tsl";
3
3
  const componentDefinition = {
4
4
  name: "AngularBlur",
5
5
  category: "Blurs",
@@ -32,26 +32,25 @@ const componentDefinition = {
32
32
  }
33
33
  },
34
34
  fragmentNode: ({ uniforms, childNode, onCleanup }) => {
35
- const { vec2: vec2$1, vec4: vec4$1, float: float$1, screenUV: screenUV$1, sin: sin$1, cos: cos$1, Fn, convertToTexture: convertToTexture$1 } = TSL;
36
- if (!childNode) return vec4$1(0, 0, 0, 0);
37
- const childTexture = convertToTexture$1(childNode);
35
+ if (!childNode) return vec4(0, 0, 0, 0);
36
+ const childTexture = convertToTexture(childNode);
38
37
  onCleanup(() => {
39
38
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
40
39
  });
41
- const center = vec2$1(uniforms.center.uniform.x, uniforms.center.uniform.y.oneMinus());
40
+ const center = vec2(uniforms.center.uniform.x, uniforms.center.uniform.y.oneMinus());
42
41
  const angle = uniforms.intensity.uniform.mul(.005);
43
42
  return Fn(() => {
44
- const initialCoord = screenUV$1.sub(center);
45
- const total = vec4$1(0).toVar();
46
- const totalWeight = float$1(0).toVar();
47
- const angleStep = angle.div(float$1(31));
43
+ const initialCoord = screenUV.sub(center);
44
+ const total = vec4(0).toVar();
45
+ const totalWeight = float(0).toVar();
46
+ const angleStep = angle.div(float(31));
48
47
  for (let i = 0; i < 32; i++) {
49
- const t = float$1(i).div(float$1(31)).sub(.5).mul(2);
50
- const weight = float$1(1).div(float$1(2.506628)).mul(float$1(-.5).mul(t).mul(t).div(float$1(.64)).exp());
51
- const currentAngle = angleStep.mul(float$1(i));
52
- const cosAngle = cos$1(currentAngle);
53
- const sinAngle = sin$1(currentAngle);
54
- const sampleCoord = vec2$1(initialCoord.x.mul(cosAngle).sub(initialCoord.y.mul(sinAngle)), initialCoord.x.mul(sinAngle).add(initialCoord.y.mul(cosAngle))).add(center);
48
+ const t = float(i).div(float(31)).sub(.5).mul(2);
49
+ const weight = float(1).div(float(2.506628)).mul(float(-.5).mul(t).mul(t).div(float(.64)).exp());
50
+ const currentAngle = angleStep.mul(float(i));
51
+ const cosAngle = cos(currentAngle);
52
+ const sinAngle = sin(currentAngle);
53
+ const sampleCoord = vec2(initialCoord.x.mul(cosAngle).sub(initialCoord.y.mul(sinAngle)), initialCoord.x.mul(sinAngle).add(initialCoord.y.mul(cosAngle))).add(center);
55
54
  const sample = childTexture.sample(sampleCoord).mul(weight);
56
55
  total.assign(total.add(sample));
57
56
  totalWeight.assign(totalWeight.add(weight));
@@ -1,5 +1,5 @@
1
1
  import { DataTexture, NearestFilter, RGBAFormat, UnsignedByteType } from "three";
2
- import * as TSL from "three/tsl";
2
+ import { abs, any, ceil, convertToTexture, dot, float, floor, fract, greaterThan, or, screenUV, select, sqrt, texture, uniform, vec2, vec3, vec4, viewportSize } from "three/tsl";
3
3
  const componentDefinition = {
4
4
  name: "Ascii",
5
5
  category: "Stylize",
@@ -78,9 +78,8 @@ const componentDefinition = {
78
78
  }
79
79
  },
80
80
  fragmentNode: ({ uniforms, childNode, onCleanup, onBeforeRender }) => {
81
- const { vec2: vec2$1, vec3: vec3$1, vec4: vec4$1, floor, fract, dot: dot$1, ceil, sqrt: sqrt$1, screenUV: screenUV$1, texture, viewportSize: viewportSize$1, convertToTexture: convertToTexture$1 } = TSL;
82
- if (!childNode) return vec4$1(0, 0, 0, 0);
83
- const childTexture = convertToTexture$1(childNode);
81
+ if (!childNode) return vec4(0, 0, 0, 0);
82
+ const childTexture = convertToTexture(childNode);
84
83
  onCleanup(() => {
85
84
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
86
85
  });
@@ -188,9 +187,9 @@ const componentDefinition = {
188
187
  atlasTexture.generateMipmaps = false;
189
188
  atlasTexture.needsUpdate = true;
190
189
  const atlasField = texture(atlasTexture);
191
- const charCountUniform = TSL.uniform(atlasData.charCount);
192
- const cellSizeUniform = TSL.uniform(atlasData.cellSize);
193
- const atlasScaleUniform = TSL.uniform(atlasData.uvScale);
190
+ const charCountUniform = uniform(atlasData.charCount);
191
+ const cellSizeUniform = uniform(atlasData.cellSize);
192
+ const atlasScaleUniform = uniform(atlasData.uvScale);
194
193
  let lastCharacters = initialCharacters;
195
194
  let lastCellSize = initialCellSize;
196
195
  let lastFontFamily = initialFontFamily;
@@ -258,28 +257,28 @@ const componentDefinition = {
258
257
  atlasTexture.dispose();
259
258
  });
260
259
  const effectiveCellSize = cellSizeUniform.mul(1.5);
261
- const mainGridSize = viewportSize$1.div(effectiveCellSize);
262
- const gridCoords = screenUV$1.mul(mainGridSize);
260
+ const mainGridSize = viewportSize.div(effectiveCellSize);
261
+ const gridCoords = screenUV.mul(mainGridSize);
263
262
  const cellCoords = floor(gridCoords);
264
263
  const rawCellUV = fract(gridCoords);
265
- const characterSize = uniforms.spacing?.uniform ?? TSL.uniform(initialSpacing);
266
- const center = vec2$1(.5);
264
+ const characterSize = uniforms.spacing?.uniform ?? uniform(initialSpacing);
265
+ const center = vec2(.5);
267
266
  const centeredUV = rawCellUV.sub(center);
268
267
  const cellUV = centeredUV.div(characterSize).add(center);
269
- const isOutsideBounds = TSL.any(TSL.greaterThan(TSL.abs(centeredUV), vec2$1(characterSize.mul(.5))));
270
- const cellCenter = cellCoords.add(vec2$1(.5)).div(mainGridSize);
268
+ const isOutsideBounds = any(greaterThan(abs(centeredUV), vec2(characterSize.mul(.5))));
269
+ const cellCenter = cellCoords.add(vec2(.5)).div(mainGridSize);
271
270
  const cellColor = childTexture.sample(cellCenter);
272
- const rawBrightness = dot$1(cellColor.rgb, vec3$1(.299, .587, .114));
271
+ const rawBrightness = dot(cellColor.rgb, vec3(.299, .587, .114));
273
272
  const charCount = charCountUniform;
274
273
  const charIndex = floor(rawBrightness.mul(.8).add(.1).mul(charCount).min(charCount.sub(1e-4)));
275
- const atlasSize = ceil(sqrt$1(charCount));
274
+ const atlasSize = ceil(sqrt(charCount));
276
275
  const atlasCol = charIndex.mod(atlasSize);
277
276
  const atlasRow = floor(charIndex.div(atlasSize));
278
- const atlasCellSize = TSL.float(1).div(atlasSize).mul(atlasScaleUniform);
279
- const atlasSampleUV = vec2$1(atlasCol, atlasRow).mul(atlasCellSize).add(cellUV.mul(atlasCellSize));
277
+ const atlasCellSize = float(1).div(atlasSize).mul(atlasScaleUniform);
278
+ const atlasSampleUV = vec2(atlasCol, atlasRow).mul(atlasCellSize).add(cellUV.mul(atlasCellSize));
280
279
  const asciiChar = atlasField.sample(atlasSampleUV);
281
- const isBackground = dot$1(asciiChar.rgb, vec3$1(.299, .587, .114)).lessThan(.1);
282
- return vec4$1(asciiChar.rgb.mul(cellColor.rgb), TSL.select(TSL.or(isBackground, isOutsideBounds), TSL.float(0), cellColor.a));
280
+ const isBackground = dot(asciiChar.rgb, vec3(.299, .587, .114)).lessThan(.1);
281
+ return vec4(asciiChar.rgb.mul(cellColor.rgb), select(or(isBackground, isOutsideBounds), float(0), cellColor.a));
283
282
  }
284
283
  };
285
284
  var Ascii_default = componentDefinition;
@@ -1,6 +1,6 @@
1
- import { i as transformColorSpace, o as transformPosition, 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";
1
+ import { i as transformColorSpace, o as transformPosition, r as transformColor, t as colorSpaceOptions } from "./transformations-Dv5JW9ck.js";
2
+ import { t as mixColors } from "./colorMixing-CZPFmiT4.js";
3
+ import { clamp, float, max, mix, pow, screenUV, smoothstep, sqrt, vec2, vec4, viewportSize } from "three/tsl";
4
4
  const componentDefinition = {
5
5
  name: "Beam",
6
6
  category: "Base Layers",
@@ -105,34 +105,33 @@ const componentDefinition = {
105
105
  }
106
106
  },
107
107
  fragmentNode: ({ uniforms, uvContext }) => {
108
- const { vec2: vec2$1, vec4: vec4$1, float: float$1, screenUV: screenUV$1, viewportSize: viewportSize$1, sqrt: sqrt$1, max: max$1, smoothstep, mix: mix$1, clamp: clamp$1, pow: pow$1 } = TSL;
109
- const baseUV = uvContext ?? screenUV$1;
110
- const aspect = viewportSize$1.x.div(viewportSize$1.y);
111
- const startPos = vec2$1(uniforms.startPosition.uniform.x, uniforms.startPosition.uniform.y.oneMinus());
112
- const endPos = vec2$1(uniforms.endPosition.uniform.x, uniforms.endPosition.uniform.y.oneMinus());
113
- const aspectCorrectedStart = vec2$1(startPos.x.mul(aspect), startPos.y);
114
- const aspectCorrectedEnd = vec2$1(endPos.x.mul(aspect), endPos.y);
115
- const aspectCorrectedUV = vec2$1(baseUV.x.mul(aspect), baseUV.y);
116
- const lineVec = vec2$1(aspectCorrectedEnd.x.sub(aspectCorrectedStart.x), aspectCorrectedEnd.y.sub(aspectCorrectedStart.y));
117
- const toPoint = vec2$1(aspectCorrectedUV.x.sub(aspectCorrectedStart.x), aspectCorrectedUV.y.sub(aspectCorrectedStart.y));
108
+ const baseUV = uvContext ?? screenUV;
109
+ const aspect = viewportSize.x.div(viewportSize.y);
110
+ const startPos = vec2(uniforms.startPosition.uniform.x, uniforms.startPosition.uniform.y.oneMinus());
111
+ const endPos = vec2(uniforms.endPosition.uniform.x, uniforms.endPosition.uniform.y.oneMinus());
112
+ const aspectCorrectedStart = vec2(startPos.x.mul(aspect), startPos.y);
113
+ const aspectCorrectedEnd = vec2(endPos.x.mul(aspect), endPos.y);
114
+ const aspectCorrectedUV = vec2(baseUV.x.mul(aspect), baseUV.y);
115
+ const lineVec = vec2(aspectCorrectedEnd.x.sub(aspectCorrectedStart.x), aspectCorrectedEnd.y.sub(aspectCorrectedStart.y));
116
+ const toPoint = vec2(aspectCorrectedUV.x.sub(aspectCorrectedStart.x), aspectCorrectedUV.y.sub(aspectCorrectedStart.y));
118
117
  const dotProduct = toPoint.x.mul(lineVec.x).add(toPoint.y.mul(lineVec.y));
119
118
  const lineLengthSq = lineVec.x.mul(lineVec.x).add(lineVec.y.mul(lineVec.y));
120
- const t = clamp$1(dotProduct.div(max$1(lineLengthSq, float$1(1e-4))), float$1(0), float$1(1));
121
- const closestPoint = vec2$1(aspectCorrectedStart.x.add(lineVec.x.mul(t)), aspectCorrectedStart.y.add(lineVec.y.mul(t)));
122
- const distVec = vec2$1(aspectCorrectedUV.x.sub(closestPoint.x), aspectCorrectedUV.y.sub(closestPoint.y));
123
- const distance = sqrt$1(distVec.x.mul(distVec.x).add(distVec.y.mul(distVec.y)));
124
- const thickness = mix$1(uniforms.startThickness.uniform.mul(.25), uniforms.endThickness.uniform.mul(.25), t);
119
+ const t = clamp(dotProduct.div(max(lineLengthSq, float(1e-4))), float(0), float(1));
120
+ const closestPoint = vec2(aspectCorrectedStart.x.add(lineVec.x.mul(t)), aspectCorrectedStart.y.add(lineVec.y.mul(t)));
121
+ const distVec = vec2(aspectCorrectedUV.x.sub(closestPoint.x), aspectCorrectedUV.y.sub(closestPoint.y));
122
+ const distance$1 = sqrt(distVec.x.mul(distVec.x).add(distVec.y.mul(distVec.y)));
123
+ const thickness = mix(uniforms.startThickness.uniform.mul(.25), uniforms.endThickness.uniform.mul(.25), t);
125
124
  const startSoft = uniforms.startSoftness.uniform;
126
125
  const endSoft = uniforms.endSoftness.uniform;
127
- const softness = mix$1(startSoft, endSoft, t);
128
- const normalizedDist = distance.div(max$1(thickness, float$1(1e-4)));
129
- const edgeEnd = float$1(1).add(softness);
130
- const alpha = pow$1(float$1(1).sub(smoothstep(float$1(1), edgeEnd, normalizedDist)), float$1(1).add(softness.mul(1.5)));
131
- const colorT = smoothstep(float$1(1).sub(softness), float$1(1).add(softness), normalizedDist);
126
+ const softness = mix(startSoft, endSoft, t);
127
+ const normalizedDist = distance$1.div(max(thickness, float(1e-4)));
128
+ const edgeEnd = float(1).add(softness);
129
+ const alpha = pow(float(1).sub(smoothstep(float(1), edgeEnd, normalizedDist)), float(1).add(softness.mul(1.5)));
130
+ const colorT = smoothstep(float(1).sub(softness), float(1).add(softness), normalizedDist);
132
131
  const insideCol = uniforms.insideColor.uniform;
133
132
  const outsideCol = uniforms.outsideColor.uniform;
134
133
  const beamColorRGB = mixColors(insideCol, outsideCol, colorT, uniforms.colorSpace.uniform).rgb;
135
- return vec4$1(beamColorRGB, insideCol.a.add(outsideCol.a).div(float$1(2)).mul(alpha));
134
+ return vec4(beamColorRGB, insideCol.a.add(outsideCol.a).div(float(2)).mul(alpha));
136
135
  }
137
136
  };
138
137
  var Beam_default = componentDefinition;
@@ -1,7 +1,7 @@
1
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";
2
+ import { i as transformColorSpace, o as transformPosition, r as transformColor, t as colorSpaceOptions } from "./transformations-Dv5JW9ck.js";
3
+ import { t as mixColors } from "./colorMixing-CZPFmiT4.js";
4
+ import { dot, float, length, max, normalize, pow, reflect, screenUV, sin, smoothstep, vec2, vec3, vec4, viewportSize } from "three/tsl";
5
5
  const componentDefinition = {
6
6
  name: "Blob",
7
7
  category: "Base Layers",
@@ -159,8 +159,7 @@ const componentDefinition = {
159
159
  },
160
160
  fragmentNode: (params) => {
161
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;
162
+ const baseUV = uvContext ?? screenUV;
164
163
  const animTime = createAnimatedTime(params, uniforms.speed, uniforms.seed);
165
164
  const colorA = uniforms.colorA.uniform;
166
165
  const colorB = uniforms.colorB.uniform;
@@ -172,46 +171,46 @@ const componentDefinition = {
172
171
  const highlightY = uniforms.highlightY.uniform;
173
172
  const highlightZ = uniforms.highlightZ.uniform;
174
173
  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);
174
+ const edgeWidth = softness.mul(float(.3));
175
+ const edgeCurve = softness.mul(float(2)).add(float(.5));
176
+ const edgeComplexity = float(.5);
177
+ const aspect = viewportSize.x.div(viewportSize.y);
178
+ const aspectCorrectedUV = vec2(baseUV.x.mul(aspect), baseUV.y);
179
+ const centerPos = vec2(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus());
180
+ const uv$1 = aspectCorrectedUV.sub(centerPos);
181
+ const dist = length(uv$1);
183
182
  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));
183
+ const noiseScale = float(4);
184
+ const noise1 = sin(uv$1.x.mul(noiseScale.mul(float(.8))).add(animTime.mul(float(.8)))).mul(sin(uv$1.y.mul(noiseScale.mul(float(.7))).add(animTime.mul(float(.6))))).add(sin(uv$1.x.mul(noiseScale.mul(float(1.2))).sub(uv$1.y.mul(noiseScale.mul(float(.9))).add(animTime.mul(float(.4)))))).mul(float(.15)).mul(deformation);
185
+ const noise2 = sin(uv$1.x.mul(noiseScale.mul(float(1.4))).sub(animTime.mul(float(.5)))).mul(sin(uv$1.y.mul(noiseScale.mul(float(1.1))).add(animTime.mul(float(.7))))).mul(float(.12)).mul(deformation).mul(smoothstep(float(.15), float(.25), edgeComplexity));
186
+ const noise3 = sin(uv$1.x.mul(noiseScale.mul(float(1.8))).add(uv$1.y.mul(noiseScale.mul(float(1.6))).add(animTime.mul(float(.3))))).add(sin(uv$1.x.mul(noiseScale.mul(float(.6))).sub(animTime.mul(float(.9))))).mul(float(.1)).mul(deformation).mul(smoothstep(float(.3), float(.4), edgeComplexity));
187
+ const noise4 = sin(uv$1.x.mul(noiseScale.mul(float(2.2))).add(animTime.mul(float(.2)))).mul(sin(uv$1.y.mul(noiseScale.mul(float(1.9))).sub(animTime.mul(float(.8))))).mul(float(.08)).mul(deformation).mul(smoothstep(float(.45), float(.55), edgeComplexity));
188
+ const noise5 = sin(uv$1.x.mul(noiseScale.mul(float(2.8))).sub(uv$1.y.mul(noiseScale.mul(float(2.4))).add(animTime.mul(float(.6))))).mul(float(.06)).mul(deformation).mul(smoothstep(float(.6), float(.7), edgeComplexity));
189
+ const noise6 = sin(uv$1.x.mul(noiseScale.mul(float(3.2))).add(animTime.mul(float(1.1)))).add(sin(uv$1.y.mul(noiseScale.mul(float(3.5))).sub(animTime.mul(float(.4))))).mul(float(.04)).mul(deformation).mul(smoothstep(float(.75), float(.85), edgeComplexity));
191
190
  const noiseAmount = noise1.add(noise2).add(noise3).add(noise4).add(noise5).add(noise6);
192
191
  const organicRadius = baseRadius.add(noiseAmount);
193
- const blobMask = pow$1(smoothstep(organicRadius.add(edgeWidth), organicRadius.sub(edgeWidth), dist), edgeCurve);
194
- const distFromCenter = length(uv);
192
+ const blobMask = pow(smoothstep(organicRadius.add(edgeWidth), organicRadius.sub(edgeWidth), dist), edgeCurve);
193
+ const distFromCenter = length(uv$1);
195
194
  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));
195
+ const normalTilt = smoothstep(float(0), sphereRadius, distFromCenter);
196
+ const fakeZ = float(1).sub(normalTilt.mul(float(.1)));
197
+ const surfaceNormal = normalize(vec3(uv$1.x.mul(normalTilt.add(float(.2))), uv$1.y.mul(normalTilt.add(float(.2))), fakeZ));
198
+ const lightDir = normalize(vec3(highlightX, highlightY, highlightZ));
199
+ const viewDir = vec3(float(0), float(0), float(1));
201
200
  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));
201
+ const specularPower = float(32);
202
+ const specular = pow(max(float(0), dot(reflectDir, viewDir)), specularPower);
203
+ const curvatureBoost = normalTilt.mul(float(.5)).add(float(.5));
205
204
  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));
205
+ const posX = uv$1.x.mul(float(3));
206
+ const posY = uv$1.y.mul(float(3));
207
+ const colorNoise1 = sin(posX.add(animTime.mul(float(.4)))).mul(sin(posY.add(animTime.mul(float(.3))))).add(sin(posX.mul(float(.7)).add(posY.mul(float(.8))).add(animTime.mul(float(.2))))).mul(float(.5)).add(float(.5));
208
+ const colorNoise2 = sin(posX.mul(float(1.3)).sub(animTime.mul(float(.5)))).mul(sin(posY.mul(float(1.1)).add(animTime.mul(float(.6))))).add(sin(posX.mul(float(.5)).sub(posY.mul(float(.6)).sub(animTime.mul(float(.3)))))).mul(float(.5)).add(float(.5));
209
+ const combinedNoise = colorNoise1.mul(float(.6)).add(colorNoise2.mul(float(.4)));
210
+ const finalColorRGB = mixColors(colorA, colorB, smoothstep(float(.1), float(.9), combinedNoise), uniforms.colorSpace.uniform).rgb;
211
+ const avgAlpha = colorA.a.add(colorB.a).div(float(2));
213
212
  const highlightContribution = highlightColor.rgb.mul(finalHighlight);
214
- return vec4$1(finalColorRGB.add(highlightContribution), avgAlpha.mul(blobMask));
213
+ return vec4(finalColorRGB.add(highlightContribution), avgAlpha.mul(blobMask));
215
214
  }
216
215
  };
217
216
  var Blob_default = componentDefinition;
@@ -1,4 +1,4 @@
1
- import * as TSL from "three/tsl";
1
+ import { Fn, convertToTexture, float, screenUV, vec2, vec4, viewportSize } from "three/tsl";
2
2
  const componentDefinition = {
3
3
  name: "Blur",
4
4
  category: "Blurs",
@@ -17,9 +17,8 @@ const componentDefinition = {
17
17
  }
18
18
  } },
19
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);
20
+ if (!childNode) return vec4(0, 0, 0, 0);
21
+ const childTexture = convertToTexture(childNode);
23
22
  onCleanup(() => {
24
23
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
25
24
  });
@@ -40,15 +39,15 @@ const componentDefinition = {
40
39
  ];
41
40
  const weightSum = 6.214;
42
41
  const scaledIntensity = uniforms.intensity.uniform.mul(.06);
43
- const horizontalTexture = convertToTexture$1(Fn(() => {
44
- const uv = screenUV$1;
42
+ const horizontalTexture = convertToTexture(Fn(() => {
43
+ const uv$1 = screenUV;
45
44
  const blurRadius = scaledIntensity;
46
- const pixelSize = vec2$1(1).div(viewportSize$1);
47
- const total = vec4$1(0).toVar();
45
+ const pixelSize = vec2(1).div(viewportSize);
46
+ const total = vec4(0).toVar();
48
47
  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);
48
+ const weight = float(weights[x + 6] / weightSum);
49
+ const offset = vec2(float(x), float(0)).mul(blurRadius).mul(pixelSize);
50
+ const sampleCoord = uv$1.add(offset);
52
51
  const sample = childTexture.sample(sampleCoord).mul(weight);
53
52
  total.assign(total.add(sample));
54
53
  }
@@ -58,14 +57,14 @@ const componentDefinition = {
58
57
  if (horizontalTexture?.renderTarget?.dispose) horizontalTexture.renderTarget.dispose();
59
58
  });
60
59
  return Fn(() => {
61
- const uv = screenUV$1;
60
+ const uv$1 = screenUV;
62
61
  const blurRadius = scaledIntensity;
63
- const pixelSize = vec2$1(1).div(viewportSize$1);
64
- const total = vec4$1(0).toVar();
62
+ const pixelSize = vec2(1).div(viewportSize);
63
+ const total = vec4(0).toVar();
65
64
  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);
65
+ const weight = float(weights[y + 6] / weightSum);
66
+ const offset = vec2(float(0), float(y)).mul(blurRadius).mul(pixelSize);
67
+ const sampleCoord = uv$1.add(offset);
69
68
  const sample = horizontalTexture.sample(sampleCoord).mul(weight);
70
69
  total.assign(total.add(sample));
71
70
  }
@@ -1,6 +1,6 @@
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";
1
+ import { t as applyEdgeHandling } from "./edges-Djr_12SL.js";
2
+ import { a as transformEdges, o as transformPosition } from "./transformations-Dv5JW9ck.js";
3
+ import { convertToTexture, float, length, max, screenUV, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
4
4
  const componentDefinition = {
5
5
  name: "Bulge",
6
6
  category: "Distortions",
@@ -81,50 +81,48 @@ const componentDefinition = {
81
81
  }
82
82
  }
83
83
  },
84
- uvTransformNode: ({ uv, uniforms, viewportSize: viewportSize$1 }) => {
85
- const { vec2: vec2$1, length, smoothstep, float: float$1, max: max$1 } = TSL;
84
+ uvTransformNode: ({ uv: uv$1, uniforms, viewportSize: viewportSize$1 }) => {
86
85
  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());
86
+ const aspectCorrectedUV = vec2(uv$1.x.mul(aspect), uv$1.y);
87
+ const centerPos = vec2(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus());
89
88
  const delta = aspectCorrectedUV.sub(centerPos);
90
- const distance = length(delta);
89
+ const distance$1 = length(delta);
91
90
  const effectRadius = uniforms.radius.uniform.mul(.5);
92
91
  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);
92
+ const smoothFalloff = smoothstep(effectRadius.mul(float(1).sub(falloffAmount).sub(float(.001)).max(float(0))), effectRadius, distance$1).oneMinus();
93
+ const normalizedDist = distance$1.div(effectRadius);
95
94
  const distSq = normalizedDist.mul(normalizedDist);
96
- const quadraticFalloff = max$1(float$1(0), float$1(1).sub(distSq));
95
+ const quadraticFalloff = max(float(0), float(1).sub(distSq));
97
96
  const falloff = smoothFalloff.mul(quadraticFalloff);
98
97
  const displacementAmount = uniforms.strength.uniform.negate().mul(falloff);
99
- const scaleFactor = float$1(1).add(displacementAmount);
98
+ const scaleFactor = float(1).add(displacementAmount);
100
99
  const bulgedDelta = delta.mul(scaleFactor);
101
100
  const bulgedUV = centerPos.add(bulgedDelta);
102
- return vec2$1(bulgedUV.x.div(aspect), bulgedUV.y);
101
+ return vec2(bulgedUV.x.div(aspect), bulgedUV.y);
103
102
  },
104
103
  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);
104
+ if (!childNode) return vec4(0, 0, 0, 0);
105
+ const childTexture = convertToTexture(childNode);
108
106
  onCleanup(() => {
109
107
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
110
108
  });
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());
109
+ const aspect = viewportSize.x.div(viewportSize.y);
110
+ const aspectCorrectedUV = vec2(screenUV.x.mul(aspect), screenUV.y);
111
+ const centerPos = vec2(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus());
114
112
  const delta = aspectCorrectedUV.sub(centerPos);
115
- const distance = length(delta);
113
+ const distance$1 = length(delta);
116
114
  const effectRadius = uniforms.radius.uniform.mul(.5);
117
115
  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);
116
+ const smoothFalloff = smoothstep(effectRadius.mul(float(1).sub(falloffAmount).sub(float(.001)).max(float(0))), effectRadius, distance$1).oneMinus();
117
+ const normalizedDist = distance$1.div(effectRadius);
120
118
  const distSq = normalizedDist.mul(normalizedDist);
121
- const quadraticFalloff = TSL.max(TSL.float(0), TSL.float(1).sub(distSq));
119
+ const quadraticFalloff = max(float(0), float(1).sub(distSq));
122
120
  const falloff = smoothFalloff.mul(quadraticFalloff);
123
121
  const displacementAmount = uniforms.strength.uniform.negate().mul(falloff);
124
- const scaleFactor = TSL.float(1).add(displacementAmount);
122
+ const scaleFactor = float(1).add(displacementAmount);
125
123
  const bulgedDelta = delta.mul(scaleFactor);
126
124
  const bulgedUV = centerPos.add(bulgedDelta);
127
- const finalUV = vec2$1(bulgedUV.x.div(aspect), bulgedUV.y);
125
+ const finalUV = vec2(bulgedUV.x.div(aspect), bulgedUV.y);
128
126
  return applyEdgeHandling(finalUV, childTexture.sample(finalUV), childTexture, uniforms.edges.uniform);
129
127
  }
130
128
  };
@@ -1,4 +1,4 @@
1
- import * as TSL from "three/tsl";
1
+ import { convertToTexture, float, fract, length, screenUV, sin, smoothstep, vec2, vec3, vec4 } from "three/tsl";
2
2
  const componentDefinition = {
3
3
  name: "CRTScreen",
4
4
  category: "Stylize",
@@ -74,9 +74,8 @@ const componentDefinition = {
74
74
  }
75
75
  },
76
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);
77
+ if (!childNode) return vec4(0, 0, 0, 0);
78
+ const childTexture = convertToTexture(childNode);
80
79
  onCleanup(() => {
81
80
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
82
81
  });
@@ -86,26 +85,26 @@ const componentDefinition = {
86
85
  const scanlineFrequency = uniforms.scanlineFrequency.uniform;
87
86
  const brightness = uniforms.brightness.uniform;
88
87
  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)));
88
+ const scaledColorShift = colorShift.mul(float(.002));
89
+ const redUV = screenUV.add(vec2(scaledColorShift, float(0)));
90
+ const greenUV = screenUV;
91
+ const blueUV = screenUV.sub(vec2(scaledColorShift, float(0)));
93
92
  const redSample = childTexture.sample(redUV).r;
94
93
  const greenSample = childTexture.sample(greenUV).g;
95
94
  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))));
95
+ const adjustedColor = vec3(redSample, greenSample, blueSample).sub(float(.5)).mul(contrast).add(float(.5)).mul(brightness);
96
+ const scanlineWave = sin(screenUV.y.mul(scanlineFrequency).mul(float(3.14159 * 2)));
97
+ const scanlineEffect = float(1).sub(scanlineIntensity.mul(scanlineWave.mul(float(.5)).add(float(.5))));
99
98
  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));
99
+ const phosphorScale = pixelSize.mul(float(.5));
100
+ const pixelPhase = fract(screenUV.mul(phosphorScale));
101
+ const redMask = sin(pixelPhase.x.mul(float(6.28318))).mul(float(.1)).add(float(.95));
102
+ const greenMask = sin(pixelPhase.x.mul(float(6.28318)).add(float(2.09))).mul(float(.1)).add(float(.95));
103
+ const blueMask = sin(pixelPhase.x.mul(float(6.28318)).add(float(4.18))).mul(float(.1)).add(float(.95));
104
+ const phosphorColor = vec3(scanlinedColor.r.mul(redMask), scanlinedColor.g.mul(greenMask), scanlinedColor.b.mul(blueMask));
105
+ const vignetteDistance = length(screenUV.sub(vec2(.5, .5)));
106
+ const vignette = smoothstep(float(.8), float(.3), vignetteDistance);
107
+ return vec4(phosphorColor.mul(vignette), float(1));
109
108
  }
110
109
  };
111
110
  var CRTScreen_default = componentDefinition;
@@ -0,0 +1,117 @@
1
+ import { Fn, convertToTexture, float, screenUV, vec2, vec4, viewportSize } 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
+ if (!childNode) return vec4(0, 0, 0, 0);
45
+ const childTexture = convertToTexture(childNode);
46
+ onCleanup(() => {
47
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
48
+ });
49
+ const weights = [
50
+ .056,
51
+ .135,
52
+ .278,
53
+ .487,
54
+ .726,
55
+ .923,
56
+ 1,
57
+ .923,
58
+ .726,
59
+ .487,
60
+ .278,
61
+ .135,
62
+ .056
63
+ ];
64
+ const weightSum = 6.214;
65
+ const redRadius = uniforms.redIntensity.uniform.mul(.1);
66
+ const greenRadius = uniforms.greenIntensity.uniform.mul(.1);
67
+ const blueRadius = uniforms.blueIntensity.uniform.mul(.1);
68
+ const horizontalTexture = convertToTexture(Fn(() => {
69
+ const uv$1 = screenUV;
70
+ const pixelSize = vec2(1).div(viewportSize);
71
+ const redTotal = float(0).toVar();
72
+ const greenTotal = float(0).toVar();
73
+ const blueTotal = float(0).toVar();
74
+ for (let x = -6; x <= 6; x++) {
75
+ const weight = float(weights[x + 6] / weightSum);
76
+ const xOffset = float(x).mul(pixelSize.x);
77
+ const redOffset = vec2(xOffset.mul(redRadius), float(0));
78
+ const greenOffset = vec2(xOffset.mul(greenRadius), float(0));
79
+ const blueOffset = vec2(xOffset.mul(blueRadius), float(0));
80
+ const redSample = childTexture.sample(uv$1.add(redOffset)).r.mul(weight);
81
+ const greenSample = childTexture.sample(uv$1.add(greenOffset)).g.mul(weight);
82
+ const blueSample = childTexture.sample(uv$1.add(blueOffset)).b.mul(weight);
83
+ redTotal.assign(redTotal.add(redSample));
84
+ greenTotal.assign(greenTotal.add(greenSample));
85
+ blueTotal.assign(blueTotal.add(blueSample));
86
+ }
87
+ return vec4(redTotal, greenTotal, blueTotal, float(1));
88
+ })());
89
+ onCleanup(() => {
90
+ if (horizontalTexture?.renderTarget?.dispose) horizontalTexture.renderTarget.dispose();
91
+ });
92
+ return Fn(() => {
93
+ const uv$1 = screenUV;
94
+ const pixelSize = vec2(1).div(viewportSize);
95
+ const redTotal = float(0).toVar();
96
+ const greenTotal = float(0).toVar();
97
+ const blueTotal = float(0).toVar();
98
+ for (let y = -6; y <= 6; y++) {
99
+ const weight = float(weights[y + 6] / weightSum);
100
+ const yOffset = float(y).mul(pixelSize.y);
101
+ const redOffset = vec2(float(0), yOffset.mul(redRadius));
102
+ const greenOffset = vec2(float(0), yOffset.mul(greenRadius));
103
+ const blueOffset = vec2(float(0), yOffset.mul(blueRadius));
104
+ const redSample = horizontalTexture.sample(uv$1.add(redOffset)).r.mul(weight);
105
+ const greenSample = horizontalTexture.sample(uv$1.add(greenOffset)).g.mul(weight);
106
+ const blueSample = horizontalTexture.sample(uv$1.add(blueOffset)).b.mul(weight);
107
+ redTotal.assign(redTotal.add(redSample));
108
+ greenTotal.assign(greenTotal.add(greenSample));
109
+ blueTotal.assign(blueTotal.add(blueSample));
110
+ }
111
+ const originalAlpha = childTexture.sample(uv$1).a;
112
+ return vec4(redTotal, greenTotal, blueTotal, originalAlpha);
113
+ })();
114
+ }
115
+ };
116
+ var ChannelBlur_default = componentDefinition;
117
+ export { componentDefinition as n, ChannelBlur_default as t };