@basementstudio/shader-lab 0.1.0

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 (261) hide show
  1. package/.biome/plugins/README.md +21 -0
  2. package/.biome/plugins/no-anchor-element.grit +12 -0
  3. package/.biome/plugins/no-relative-parent-imports.grit +10 -0
  4. package/.biome/plugins/no-unnecessary-forwardref.grit +9 -0
  5. package/.changeset/README.md +17 -0
  6. package/.changeset/config.json +11 -0
  7. package/.editorconfig +40 -0
  8. package/.env.example +81 -0
  9. package/.gitattributes +19 -0
  10. package/.github/workflows/canary.yml +80 -0
  11. package/.github/workflows/ci.yml +37 -0
  12. package/.github/workflows/release.yml +56 -0
  13. package/.tldrignore +84 -0
  14. package/.vscode/extensions.json +20 -0
  15. package/.vscode/settings.json +105 -0
  16. package/README.md +119 -0
  17. package/biome.json +249 -0
  18. package/bun.lock +1224 -0
  19. package/next.config.ts +131 -0
  20. package/package.json +73 -0
  21. package/packages/shader-lab-react/CHANGELOG.md +9 -0
  22. package/packages/shader-lab-react/README.md +119 -0
  23. package/packages/shader-lab-react/assets/patterns/bars/1.svg +3 -0
  24. package/packages/shader-lab-react/assets/patterns/bars/2.svg +3 -0
  25. package/packages/shader-lab-react/assets/patterns/bars/3.svg +3 -0
  26. package/packages/shader-lab-react/assets/patterns/bars/4.svg +3 -0
  27. package/packages/shader-lab-react/assets/patterns/bars/5.svg +3 -0
  28. package/packages/shader-lab-react/assets/patterns/bars/6.svg +3 -0
  29. package/packages/shader-lab-react/assets/patterns/candles/1.svg +3 -0
  30. package/packages/shader-lab-react/assets/patterns/candles/2.svg +3 -0
  31. package/packages/shader-lab-react/assets/patterns/candles/3.svg +3 -0
  32. package/packages/shader-lab-react/assets/patterns/candles/4.svg +3 -0
  33. package/packages/shader-lab-react/assets/patterns/shapes/1.svg +3 -0
  34. package/packages/shader-lab-react/assets/patterns/shapes/2.svg +3 -0
  35. package/packages/shader-lab-react/assets/patterns/shapes/3.svg +3 -0
  36. package/packages/shader-lab-react/assets/patterns/shapes/4.svg +4 -0
  37. package/packages/shader-lab-react/assets/patterns/shapes/5.svg +3 -0
  38. package/packages/shader-lab-react/assets/patterns/shapes/6.svg +4 -0
  39. package/packages/shader-lab-react/assets/textures/blue-noise.png +0 -0
  40. package/packages/shader-lab-react/package.json +36 -0
  41. package/packages/shader-lab-react/scripts/fix-esm-specifiers.mjs +57 -0
  42. package/packages/shader-lab-react/scripts/prepare-dist.mjs +4 -0
  43. package/packages/shader-lab-react/src/ambient/three-tsl.d.ts +146 -0
  44. package/packages/shader-lab-react/src/ambient/three-webgpu.d.ts +51 -0
  45. package/packages/shader-lab-react/src/easings.ts +4 -0
  46. package/packages/shader-lab-react/src/index.ts +35 -0
  47. package/packages/shader-lab-react/src/lib/editor/custom-shader/shared.ts +2 -0
  48. package/packages/shader-lab-react/src/renderer/ascii-atlas.ts +83 -0
  49. package/packages/shader-lab-react/src/renderer/ascii-pass.ts +416 -0
  50. package/packages/shader-lab-react/src/renderer/asset-url.ts +3 -0
  51. package/packages/shader-lab-react/src/renderer/blend-modes.ts +229 -0
  52. package/packages/shader-lab-react/src/renderer/contracts.ts +54 -0
  53. package/packages/shader-lab-react/src/renderer/create-webgpu-renderer.ts +48 -0
  54. package/packages/shader-lab-react/src/renderer/crt-pass.ts +1040 -0
  55. package/packages/shader-lab-react/src/renderer/custom-shader-pass.ts +108 -0
  56. package/packages/shader-lab-react/src/renderer/custom-shader-runtime.ts +309 -0
  57. package/packages/shader-lab-react/src/renderer/dither-textures.ts +99 -0
  58. package/packages/shader-lab-react/src/renderer/dithering-pass.ts +322 -0
  59. package/packages/shader-lab-react/src/renderer/gradient-pass.ts +521 -0
  60. package/packages/shader-lab-react/src/renderer/halftone-pass.ts +932 -0
  61. package/packages/shader-lab-react/src/renderer/ink-pass.ts +802 -0
  62. package/packages/shader-lab-react/src/renderer/live-pass.ts +194 -0
  63. package/packages/shader-lab-react/src/renderer/media-pass.ts +187 -0
  64. package/packages/shader-lab-react/src/renderer/media-texture.ts +66 -0
  65. package/packages/shader-lab-react/src/renderer/particle-grid-pass.ts +389 -0
  66. package/packages/shader-lab-react/src/renderer/pass-node.ts +209 -0
  67. package/packages/shader-lab-react/src/renderer/pattern-atlas.ts +133 -0
  68. package/packages/shader-lab-react/src/renderer/pattern-pass.ts +552 -0
  69. package/packages/shader-lab-react/src/renderer/pipeline-manager.ts +369 -0
  70. package/packages/shader-lab-react/src/renderer/pixel-sorting-pass.ts +277 -0
  71. package/packages/shader-lab-react/src/renderer/shaders/tsl/color/tonemapping.ts +87 -0
  72. package/packages/shader-lab-react/src/renderer/shaders/tsl/cosine-palette.ts +9 -0
  73. package/packages/shader-lab-react/src/renderer/shaders/tsl/noise/common.ts +31 -0
  74. package/packages/shader-lab-react/src/renderer/shaders/tsl/noise/curl-noise-3d.ts +36 -0
  75. package/packages/shader-lab-react/src/renderer/shaders/tsl/noise/curl-noise-4d.ts +36 -0
  76. package/packages/shader-lab-react/src/renderer/shaders/tsl/noise/fbm.ts +13 -0
  77. package/packages/shader-lab-react/src/renderer/shaders/tsl/noise/perlin-noise-3d.ts +96 -0
  78. package/packages/shader-lab-react/src/renderer/shaders/tsl/noise/ridge-noise.ts +24 -0
  79. package/packages/shader-lab-react/src/renderer/shaders/tsl/noise/simplex-noise-3d.ts +79 -0
  80. package/packages/shader-lab-react/src/renderer/shaders/tsl/noise/simplex-noise-4d.ts +89 -0
  81. package/packages/shader-lab-react/src/renderer/shaders/tsl/noise/turbulence.ts +56 -0
  82. package/packages/shader-lab-react/src/renderer/shaders/tsl/noise/value-noise-3d.ts +32 -0
  83. package/packages/shader-lab-react/src/renderer/shaders/tsl/noise/voronoi-noise-3d.ts +60 -0
  84. package/packages/shader-lab-react/src/renderer/shaders/tsl/patterns/bloom-edge-pattern.ts +15 -0
  85. package/packages/shader-lab-react/src/renderer/shaders/tsl/patterns/bloom.ts +11 -0
  86. package/packages/shader-lab-react/src/renderer/shaders/tsl/patterns/canvas-weave-pattern.ts +24 -0
  87. package/packages/shader-lab-react/src/renderer/shaders/tsl/patterns/grain-texture-pattern.ts +9 -0
  88. package/packages/shader-lab-react/src/renderer/shaders/tsl/patterns/repeating-pattern.ts +11 -0
  89. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/atan2.ts +9 -0
  90. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/complex-conj.ts +9 -0
  91. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/complex-cos.ts +10 -0
  92. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/complex-div.ts +11 -0
  93. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/complex-log.ts +7 -0
  94. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/complex-mobius.ts +12 -0
  95. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/complex-mul.ts +9 -0
  96. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/complex-pow.ts +16 -0
  97. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/complex-sin.ts +10 -0
  98. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/complex-sqrt.ts +18 -0
  99. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/complex-tan.ts +12 -0
  100. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/complex-to-polar.ts +10 -0
  101. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/hyperbolic.ts +20 -0
  102. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/index.ts +48 -0
  103. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/rotate.ts +15 -0
  104. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/screen-aspect-uv.ts +15 -0
  105. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/sd-box-2d.ts +6 -0
  106. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/sd-diamond.ts +6 -0
  107. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/sd-rhombus.ts +27 -0
  108. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/sd-sphere.ts +6 -0
  109. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/smax.ts +7 -0
  110. package/packages/shader-lab-react/src/renderer/shaders/tsl/utils/smin.ts +7 -0
  111. package/packages/shader-lab-react/src/renderer/text-pass.ts +176 -0
  112. package/packages/shader-lab-react/src/runtime-clock.ts +42 -0
  113. package/packages/shader-lab-react/src/runtime-frame.ts +29 -0
  114. package/packages/shader-lab-react/src/shader-lab-composition.tsx +163 -0
  115. package/packages/shader-lab-react/src/timeline.ts +283 -0
  116. package/packages/shader-lab-react/src/types/editor.ts +5 -0
  117. package/packages/shader-lab-react/src/types.ts +141 -0
  118. package/packages/shader-lab-react/tsconfig.build.json +8 -0
  119. package/packages/shader-lab-react/tsconfig.json +21 -0
  120. package/postcss.config.mjs +5 -0
  121. package/public/assets/fonts/msdf/geist-mono/GeistMono-Regular-msdf-atlas.png +0 -0
  122. package/public/assets/fonts/msdf/geist-mono/GeistMono-Regular-msdf.json +1412 -0
  123. package/public/assets/patterns/bars/1.svg +3 -0
  124. package/public/assets/patterns/bars/2.svg +3 -0
  125. package/public/assets/patterns/bars/3.svg +3 -0
  126. package/public/assets/patterns/bars/4.svg +3 -0
  127. package/public/assets/patterns/bars/5.svg +3 -0
  128. package/public/assets/patterns/bars/6.svg +3 -0
  129. package/public/assets/patterns/candles/1.svg +3 -0
  130. package/public/assets/patterns/candles/2.svg +3 -0
  131. package/public/assets/patterns/candles/3.svg +3 -0
  132. package/public/assets/patterns/candles/4.svg +3 -0
  133. package/public/assets/patterns/shapes/1.svg +3 -0
  134. package/public/assets/patterns/shapes/2.svg +3 -0
  135. package/public/assets/patterns/shapes/3.svg +3 -0
  136. package/public/assets/patterns/shapes/4.svg +4 -0
  137. package/public/assets/patterns/shapes/5.svg +3 -0
  138. package/public/assets/patterns/shapes/6.svg +4 -0
  139. package/public/fonts/geist/Geist-Mono.woff2 +0 -0
  140. package/public/textures/blue-noise.png +0 -0
  141. package/public/textures/crt-mask.png +0 -0
  142. package/src/app/design/page.tsx +398 -0
  143. package/src/app/favicon.ico +0 -0
  144. package/src/app/globals.css +280 -0
  145. package/src/app/layout.tsx +89 -0
  146. package/src/app/page.tsx +20 -0
  147. package/src/app/robots.ts +13 -0
  148. package/src/app/sitemap.ts +13 -0
  149. package/src/components/editor/editor-canvas-viewport.tsx +116 -0
  150. package/src/components/editor/editor-export-dialog.tsx +1177 -0
  151. package/src/components/editor/editor-timeline-overlay.tsx +983 -0
  152. package/src/components/editor/editor-topbar.tsx +287 -0
  153. package/src/components/editor/layer-sidebar.tsx +738 -0
  154. package/src/components/editor/properties-sidebar-content.tsx +574 -0
  155. package/src/components/editor/properties-sidebar-fields.tsx +389 -0
  156. package/src/components/editor/properties-sidebar-utils.ts +178 -0
  157. package/src/components/editor/properties-sidebar.tsx +421 -0
  158. package/src/components/ui/button/index.tsx +57 -0
  159. package/src/components/ui/color-picker/index.tsx +358 -0
  160. package/src/components/ui/glass-panel/index.tsx +45 -0
  161. package/src/components/ui/icon-button/index.tsx +46 -0
  162. package/src/components/ui/select/index.tsx +136 -0
  163. package/src/components/ui/slider/index.tsx +192 -0
  164. package/src/components/ui/toggle/index.tsx +34 -0
  165. package/src/components/ui/typography/index.tsx +61 -0
  166. package/src/components/ui/xy-pad/index.tsx +160 -0
  167. package/src/features/editor/components/editor-export-dialog.module.css +271 -0
  168. package/src/hooks/use-editor-renderer.ts +182 -0
  169. package/src/lib/app.ts +6 -0
  170. package/src/lib/cn.ts +7 -0
  171. package/src/lib/easings.ts +240 -0
  172. package/src/lib/editor/config/layer-registry.ts +2434 -0
  173. package/src/lib/editor/custom-shader/shared.ts +28 -0
  174. package/src/lib/editor/export.ts +420 -0
  175. package/src/lib/editor/history.ts +71 -0
  176. package/src/lib/editor/layers.ts +76 -0
  177. package/src/lib/editor/parameter-schema.ts +75 -0
  178. package/src/lib/editor/project-file.ts +145 -0
  179. package/src/lib/editor/shader-export-snippet.ts +37 -0
  180. package/src/lib/editor/shader-export.ts +315 -0
  181. package/src/lib/editor/timeline/evaluate.ts +252 -0
  182. package/src/lib/editor/view-transform.ts +58 -0
  183. package/src/lib/fonts.ts +28 -0
  184. package/src/renderer/ascii-atlas.ts +83 -0
  185. package/src/renderer/ascii-pass.ts +416 -0
  186. package/src/renderer/blend-modes.ts +229 -0
  187. package/src/renderer/contracts.ts +161 -0
  188. package/src/renderer/create-webgpu-renderer.ts +48 -0
  189. package/src/renderer/crt-pass.ts +1040 -0
  190. package/src/renderer/custom-shader-pass.ts +117 -0
  191. package/src/renderer/custom-shader-runtime.ts +309 -0
  192. package/src/renderer/dither-textures.ts +99 -0
  193. package/src/renderer/dithering-pass.ts +322 -0
  194. package/src/renderer/gradient-pass.ts +520 -0
  195. package/src/renderer/halftone-pass.ts +932 -0
  196. package/src/renderer/ink-pass.ts +683 -0
  197. package/src/renderer/live-pass.ts +194 -0
  198. package/src/renderer/media-pass.ts +187 -0
  199. package/src/renderer/media-texture.ts +66 -0
  200. package/src/renderer/particle-grid-pass.ts +389 -0
  201. package/src/renderer/pass-node-factory.ts +33 -0
  202. package/src/renderer/pass-node.ts +209 -0
  203. package/src/renderer/pattern-atlas.ts +97 -0
  204. package/src/renderer/pattern-pass.ts +552 -0
  205. package/src/renderer/pipeline-manager.ts +343 -0
  206. package/src/renderer/pixel-sorting-pass.ts +277 -0
  207. package/src/renderer/project-clock.ts +57 -0
  208. package/src/renderer/shaders/tsl/color/tonemapping.ts +86 -0
  209. package/src/renderer/shaders/tsl/cosine-palette.ts +8 -0
  210. package/src/renderer/shaders/tsl/noise/common.ts +30 -0
  211. package/src/renderer/shaders/tsl/noise/curl-noise-3d.ts +35 -0
  212. package/src/renderer/shaders/tsl/noise/curl-noise-4d.ts +35 -0
  213. package/src/renderer/shaders/tsl/noise/fbm.ts +12 -0
  214. package/src/renderer/shaders/tsl/noise/perlin-noise-3d.ts +97 -0
  215. package/src/renderer/shaders/tsl/noise/ridge-noise.ts +23 -0
  216. package/src/renderer/shaders/tsl/noise/simplex-noise-3d.ts +78 -0
  217. package/src/renderer/shaders/tsl/noise/simplex-noise-4d.ts +88 -0
  218. package/src/renderer/shaders/tsl/noise/turbulence.ts +55 -0
  219. package/src/renderer/shaders/tsl/noise/value-noise-3d.ts +31 -0
  220. package/src/renderer/shaders/tsl/noise/voronoi-noise-3d.ts +59 -0
  221. package/src/renderer/shaders/tsl/patterns/bloom-edge-pattern.ts +14 -0
  222. package/src/renderer/shaders/tsl/patterns/bloom.ts +10 -0
  223. package/src/renderer/shaders/tsl/patterns/canvas-weave-pattern.ts +23 -0
  224. package/src/renderer/shaders/tsl/patterns/grain-texture-pattern.ts +8 -0
  225. package/src/renderer/shaders/tsl/patterns/repeating-pattern.ts +10 -0
  226. package/src/renderer/shaders/tsl/utils/atan2.ts +8 -0
  227. package/src/renderer/shaders/tsl/utils/complex-conj.ts +8 -0
  228. package/src/renderer/shaders/tsl/utils/complex-cos.ts +9 -0
  229. package/src/renderer/shaders/tsl/utils/complex-div.ts +10 -0
  230. package/src/renderer/shaders/tsl/utils/complex-log.ts +6 -0
  231. package/src/renderer/shaders/tsl/utils/complex-mobius.ts +11 -0
  232. package/src/renderer/shaders/tsl/utils/complex-mul.ts +8 -0
  233. package/src/renderer/shaders/tsl/utils/complex-pow.ts +15 -0
  234. package/src/renderer/shaders/tsl/utils/complex-sin.ts +9 -0
  235. package/src/renderer/shaders/tsl/utils/complex-sqrt.ts +17 -0
  236. package/src/renderer/shaders/tsl/utils/complex-tan.ts +11 -0
  237. package/src/renderer/shaders/tsl/utils/complex-to-polar.ts +9 -0
  238. package/src/renderer/shaders/tsl/utils/hyperbolic.ts +19 -0
  239. package/src/renderer/shaders/tsl/utils/index.ts +47 -0
  240. package/src/renderer/shaders/tsl/utils/rotate.ts +14 -0
  241. package/src/renderer/shaders/tsl/utils/screen-aspect-uv.ts +14 -0
  242. package/src/renderer/shaders/tsl/utils/sd-box-2d.ts +5 -0
  243. package/src/renderer/shaders/tsl/utils/sd-diamond.ts +5 -0
  244. package/src/renderer/shaders/tsl/utils/sd-rhombus.ts +26 -0
  245. package/src/renderer/shaders/tsl/utils/sd-sphere.ts +5 -0
  246. package/src/renderer/shaders/tsl/utils/smax.ts +7 -0
  247. package/src/renderer/shaders/tsl/utils/smin.ts +6 -0
  248. package/src/renderer/text-pass.ts +176 -0
  249. package/src/store/asset-store.ts +193 -0
  250. package/src/store/editor-store.ts +223 -0
  251. package/src/store/history-store.ts +172 -0
  252. package/src/store/index.ts +31 -0
  253. package/src/store/layer-store.ts +675 -0
  254. package/src/store/timeline-store.ts +572 -0
  255. package/src/types/assets.d.ts +6 -0
  256. package/src/types/css.d.ts +21 -0
  257. package/src/types/editor.ts +357 -0
  258. package/src/types/react.d.ts +15 -0
  259. package/src/types/three-tsl.d.ts +146 -0
  260. package/src/types/three-webgpu.d.ts +51 -0
  261. package/tsconfig.json +49 -0
@@ -0,0 +1,2434 @@
1
+ import {
2
+ CUSTOM_SHADER_ENTRY_EXPORT,
3
+ CUSTOM_SHADER_INTERNAL_VISIBILITY,
4
+ CUSTOM_SHADER_STARTER,
5
+ } from "@/lib/editor/custom-shader/shared"
6
+ import type {
7
+ EffectLayerType,
8
+ LayerDefinition,
9
+ LayerKind,
10
+ LayerType,
11
+ ModelLayerType,
12
+ ParameterDefinitions,
13
+ SourceLayerType,
14
+ } from "@/types/editor"
15
+
16
+ const imageParams = [
17
+ {
18
+ defaultValue: "cover",
19
+ key: "fitMode",
20
+ label: "Fit",
21
+ options: [
22
+ { label: "Cover", value: "cover" },
23
+ { label: "Contain", value: "contain" },
24
+ { label: "Stretch", value: "stretch" },
25
+ ],
26
+ type: "select",
27
+ },
28
+ {
29
+ defaultValue: 1,
30
+ key: "scale",
31
+ label: "Scale",
32
+ max: 4,
33
+ min: 0.25,
34
+ step: 0.01,
35
+ type: "number",
36
+ },
37
+ {
38
+ defaultValue: [0, 0] as [number, number],
39
+ key: "offset",
40
+ label: "Offset",
41
+ max: 1,
42
+ min: -1,
43
+ step: 0.01,
44
+ type: "vec2",
45
+ },
46
+ ] as const satisfies ParameterDefinitions
47
+
48
+ const videoParams = [
49
+ ...imageParams,
50
+ {
51
+ defaultValue: 1,
52
+ key: "playbackRate",
53
+ label: "Playback Rate",
54
+ max: 4,
55
+ min: 0.25,
56
+ step: 0.05,
57
+ type: "number",
58
+ },
59
+ ] as const satisfies ParameterDefinitions
60
+
61
+ const liveParams = [
62
+ {
63
+ defaultValue: "user",
64
+ key: "facingMode",
65
+ label: "Camera",
66
+ options: [
67
+ { label: "Front", value: "user" },
68
+ { label: "Back", value: "environment" },
69
+ ],
70
+ type: "select",
71
+ },
72
+ {
73
+ defaultValue: true,
74
+ key: "mirror",
75
+ label: "Mirror",
76
+ type: "boolean",
77
+ },
78
+ {
79
+ defaultValue: "cover",
80
+ key: "fitMode",
81
+ label: "Fit",
82
+ options: [
83
+ { label: "Cover", value: "cover" },
84
+ { label: "Contain", value: "contain" },
85
+ { label: "Stretch", value: "stretch" },
86
+ ],
87
+ type: "select",
88
+ },
89
+ {
90
+ defaultValue: 1,
91
+ key: "scale",
92
+ label: "Scale",
93
+ max: 4,
94
+ min: 0.25,
95
+ step: 0.01,
96
+ type: "number",
97
+ },
98
+ {
99
+ defaultValue: [0, 0] as [number, number],
100
+ key: "offset",
101
+ label: "Offset",
102
+ max: 1,
103
+ min: -1,
104
+ step: 0.01,
105
+ type: "vec2",
106
+ },
107
+ ] as const satisfies ParameterDefinitions
108
+
109
+ const customShaderParams = [
110
+ {
111
+ animatable: false,
112
+ defaultValue: "paste",
113
+ key: "sourceMode",
114
+ label: "Source Mode",
115
+ options: [
116
+ { label: "Paste", value: "paste" },
117
+ { label: "File", value: "file" },
118
+ ],
119
+ type: "select",
120
+ visibleWhen: CUSTOM_SHADER_INTERNAL_VISIBILITY,
121
+ },
122
+ {
123
+ animatable: false,
124
+ defaultValue: CUSTOM_SHADER_STARTER,
125
+ key: "sourceCode",
126
+ label: "Source Code",
127
+ type: "text",
128
+ visibleWhen: CUSTOM_SHADER_INTERNAL_VISIBILITY,
129
+ },
130
+ {
131
+ animatable: false,
132
+ defaultValue: "",
133
+ key: "sourceFileName",
134
+ label: "Source File",
135
+ type: "text",
136
+ visibleWhen: CUSTOM_SHADER_INTERNAL_VISIBILITY,
137
+ },
138
+ {
139
+ animatable: false,
140
+ defaultValue: CUSTOM_SHADER_ENTRY_EXPORT,
141
+ key: "entryExport",
142
+ label: "Entry Export",
143
+ maxLength: 64,
144
+ type: "text",
145
+ visibleWhen: CUSTOM_SHADER_INTERNAL_VISIBILITY,
146
+ },
147
+ {
148
+ animatable: false,
149
+ defaultValue: 0,
150
+ key: "sourceRevision",
151
+ label: "Source Revision",
152
+ max: Number.MAX_SAFE_INTEGER,
153
+ min: 0,
154
+ step: 1,
155
+ type: "number",
156
+ visibleWhen: CUSTOM_SHADER_INTERNAL_VISIBILITY,
157
+ },
158
+ ] as const satisfies ParameterDefinitions
159
+
160
+ const textParams = [
161
+ {
162
+ defaultValue: "basement.studio",
163
+ key: "text",
164
+ label: "Text",
165
+ maxLength: 32,
166
+ type: "text",
167
+ },
168
+ {
169
+ defaultValue: 48,
170
+ key: "fontSize",
171
+ label: "Font Size",
172
+ max: 600,
173
+ min: 48,
174
+ step: 1,
175
+ type: "number",
176
+ },
177
+ {
178
+ defaultValue: "sans",
179
+ key: "fontFamily",
180
+ label: "Font",
181
+ options: [
182
+ { label: "Display Serif", value: "display-serif" },
183
+ { label: "Mono", value: "mono" },
184
+ { label: "Sans", value: "sans" },
185
+ { label: "Impact", value: "impact" },
186
+ ],
187
+ type: "select",
188
+ },
189
+ {
190
+ defaultValue: 700,
191
+ key: "fontWeight",
192
+ label: "Weight",
193
+ max: 900,
194
+ min: 300,
195
+ step: 100,
196
+ type: "number",
197
+ },
198
+ {
199
+ defaultValue: -0.05,
200
+ key: "letterSpacing",
201
+ label: "Letter Spacing",
202
+ max: 0.3,
203
+ min: -0.2,
204
+ step: 0.01,
205
+ type: "number",
206
+ },
207
+ {
208
+ defaultValue: "#ffffff",
209
+ key: "textColor",
210
+ label: "Text Color",
211
+ type: "color",
212
+ },
213
+ {
214
+ defaultValue: "#000000",
215
+ key: "backgroundColor",
216
+ label: "Background",
217
+ type: "color",
218
+ },
219
+ ] as const satisfies ParameterDefinitions
220
+
221
+ const inkParams = [
222
+ {
223
+ defaultValue: 13,
224
+ group: "Ink Bleed",
225
+ key: "blurPasses",
226
+ label: "Trail Passes",
227
+ max: 20,
228
+ min: 1,
229
+ step: 1,
230
+ type: "number",
231
+ },
232
+ {
233
+ defaultValue: 3,
234
+ group: "Ink Bleed",
235
+ key: "crispPasses",
236
+ label: "Crisp Passes",
237
+ max: 6,
238
+ min: 1,
239
+ step: 1,
240
+ type: "number",
241
+ },
242
+ {
243
+ defaultValue: 0.81,
244
+ group: "Ink Bleed",
245
+ key: "crispBlend",
246
+ label: "Text Clarity",
247
+ max: 1,
248
+ min: 0,
249
+ step: 0.01,
250
+ type: "number",
251
+ },
252
+ {
253
+ defaultValue: 0.044,
254
+ group: "Ink Bleed",
255
+ key: "blurStrength",
256
+ label: "Bleed Strength",
257
+ max: 0.08,
258
+ min: 0.001,
259
+ step: 0.001,
260
+ type: "number",
261
+ },
262
+ {
263
+ defaultValue: 90,
264
+ group: "Ink Bleed",
265
+ key: "blurDirection",
266
+ label: "Flow Direction",
267
+ max: 180,
268
+ min: -180,
269
+ step: 1,
270
+ type: "number",
271
+ },
272
+ {
273
+ defaultValue: 1,
274
+ group: "Ink Bleed",
275
+ key: "dripLength",
276
+ label: "Drip Length",
277
+ max: 10,
278
+ min: 1,
279
+ step: 0.1,
280
+ type: "number",
281
+ },
282
+ {
283
+ defaultValue: 0.4,
284
+ group: "Ink Bleed",
285
+ key: "dripWeight",
286
+ label: "Drip Weight",
287
+ max: 2,
288
+ min: 0.2,
289
+ step: 0.1,
290
+ type: "number",
291
+ },
292
+ {
293
+ defaultValue: 0.02,
294
+ group: "Ink Bleed",
295
+ key: "fluidNoise",
296
+ label: "Fluid Noise",
297
+ max: 2,
298
+ min: 0,
299
+ step: 0.01,
300
+ type: "number",
301
+ },
302
+ {
303
+ defaultValue: 1.2,
304
+ group: "Ink Bleed",
305
+ key: "noiseScale",
306
+ label: "Noise Scale",
307
+ max: 8,
308
+ min: 0.5,
309
+ step: 0.1,
310
+ type: "number",
311
+ },
312
+ {
313
+ defaultValue: 0.36,
314
+ group: "Ink Bleed",
315
+ key: "smokeSpeed",
316
+ label: "Smoke Speed",
317
+ max: 2,
318
+ min: 0,
319
+ step: 0.01,
320
+ type: "number",
321
+ },
322
+ {
323
+ defaultValue: 0,
324
+ group: "Ink Bleed",
325
+ key: "smokeTurbulence",
326
+ label: "Smoke Turbulence",
327
+ max: 1.5,
328
+ min: 0,
329
+ step: 0.01,
330
+ type: "number",
331
+ },
332
+ {
333
+ defaultValue: 1.6,
334
+ group: "Ink Bleed",
335
+ key: "blurSpread",
336
+ label: "Spread",
337
+ max: 4,
338
+ min: 0.5,
339
+ step: 0.1,
340
+ type: "number",
341
+ },
342
+ {
343
+ defaultValue: "#fffde8",
344
+ group: "Glow Colors",
345
+ key: "coreColor",
346
+ label: "Core Color",
347
+ type: "color",
348
+ },
349
+ {
350
+ defaultValue: "#FFA700",
351
+ group: "Glow Colors",
352
+ key: "midColor",
353
+ label: "Mid Color",
354
+ type: "color",
355
+ },
356
+ {
357
+ defaultValue: "#7192F1",
358
+ group: "Glow Colors",
359
+ key: "edgeColor",
360
+ label: "Edge Color",
361
+ type: "color",
362
+ },
363
+ {
364
+ defaultValue: "#000000",
365
+ group: "Colors",
366
+ key: "backgroundColor",
367
+ label: "Background",
368
+ type: "color",
369
+ },
370
+ {
371
+ defaultValue: false,
372
+ group: "Grain",
373
+ key: "grainEnabled",
374
+ label: "Enable Grain",
375
+ type: "boolean",
376
+ },
377
+ {
378
+ defaultValue: 0.3,
379
+ group: "Grain",
380
+ key: "grainIntensity",
381
+ label: "Grain Intensity",
382
+ max: 0.3,
383
+ min: 0,
384
+ step: 0.005,
385
+ type: "number",
386
+ },
387
+ {
388
+ defaultValue: 1.5,
389
+ group: "Grain",
390
+ key: "grainScale",
391
+ label: "Grain Scale",
392
+ max: 5,
393
+ min: 0.5,
394
+ step: 0.1,
395
+ type: "number",
396
+ },
397
+ {
398
+ defaultValue: true,
399
+ group: "Bloom",
400
+ key: "bloomEnabled",
401
+ label: "Bloom",
402
+ type: "boolean",
403
+ },
404
+ {
405
+ defaultValue: 6.19,
406
+ group: "Bloom",
407
+ key: "bloomIntensity",
408
+ label: "Intensity",
409
+ max: 8,
410
+ min: 0,
411
+ step: 0.01,
412
+ type: "number",
413
+ visibleWhen: {
414
+ equals: true,
415
+ key: "bloomEnabled",
416
+ },
417
+ },
418
+ {
419
+ defaultValue: 0.97,
420
+ group: "Bloom",
421
+ key: "bloomThreshold",
422
+ label: "Threshold",
423
+ max: 1,
424
+ min: 0,
425
+ step: 0.01,
426
+ type: "number",
427
+ visibleWhen: {
428
+ equals: true,
429
+ key: "bloomEnabled",
430
+ },
431
+ },
432
+ {
433
+ defaultValue: 0,
434
+ group: "Bloom",
435
+ key: "bloomRadius",
436
+ label: "Radius",
437
+ max: 24,
438
+ min: 0,
439
+ step: 0.25,
440
+ type: "number",
441
+ visibleWhen: {
442
+ equals: true,
443
+ key: "bloomEnabled",
444
+ },
445
+ },
446
+ {
447
+ defaultValue: 0.96,
448
+ group: "Bloom",
449
+ key: "bloomSoftness",
450
+ label: "Softness",
451
+ max: 1,
452
+ min: 0,
453
+ step: 0.01,
454
+ type: "number",
455
+ visibleWhen: {
456
+ equals: true,
457
+ key: "bloomEnabled",
458
+ },
459
+ },
460
+ ] as const satisfies ParameterDefinitions
461
+
462
+ const gradientParams = [
463
+ {
464
+ defaultValue: "custom",
465
+ group: "Points",
466
+ key: "preset",
467
+ label: "Preset",
468
+ options: [
469
+ { label: "Custom", value: "custom" },
470
+ { label: "Forest", value: "aurora" },
471
+ { label: "Ember", value: "sunset" },
472
+ { label: "Abyss", value: "deep-ocean" },
473
+ { label: "Violet", value: "neon-glow" },
474
+ ],
475
+ type: "select",
476
+ },
477
+ {
478
+ defaultValue: 3,
479
+ group: "Points",
480
+ key: "activePoints",
481
+ label: "Active Points",
482
+ max: 5,
483
+ min: 2,
484
+ step: 1,
485
+ type: "number",
486
+ },
487
+ {
488
+ defaultValue: "#0E0C0C",
489
+ group: "Points",
490
+ key: "point1Color",
491
+ label: "Point 1 Color",
492
+ type: "color",
493
+ },
494
+ {
495
+ defaultValue: [-0.82, -0.62] as [number, number],
496
+ group: "Points",
497
+ key: "point1Position",
498
+ label: "Point 1 Position",
499
+ max: 1.5,
500
+ min: -1.5,
501
+ step: 0.01,
502
+ type: "vec2",
503
+ },
504
+ {
505
+ defaultValue: 0.42,
506
+ group: "Points",
507
+ key: "point1Weight",
508
+ label: "Point 1 Weight",
509
+ max: 3,
510
+ min: 0,
511
+ step: 0.01,
512
+ type: "number",
513
+ },
514
+ {
515
+ defaultValue: "#C1FF00",
516
+ group: "Points",
517
+ key: "point2Color",
518
+ label: "Point 2 Color",
519
+ type: "color",
520
+ },
521
+ {
522
+ defaultValue: [0.22, 0.72] as [number, number],
523
+ group: "Points",
524
+ key: "point2Position",
525
+ label: "Point 2 Position",
526
+ max: 1.5,
527
+ min: -1.5,
528
+ step: 0.01,
529
+ type: "vec2",
530
+ },
531
+ {
532
+ defaultValue: 1.55,
533
+ group: "Points",
534
+ key: "point2Weight",
535
+ label: "Point 2 Weight",
536
+ max: 3,
537
+ min: 0,
538
+ step: 0.01,
539
+ type: "number",
540
+ },
541
+ {
542
+ defaultValue: "#B2DAD5",
543
+ group: "Points",
544
+ key: "point3Color",
545
+ label: "Point 3 Color",
546
+ type: "color",
547
+ visibleWhen: {
548
+ gte: 3,
549
+ key: "activePoints",
550
+ },
551
+ },
552
+ {
553
+ defaultValue: [0.88, -0.26] as [number, number],
554
+ group: "Points",
555
+ key: "point3Position",
556
+ label: "Point 3 Position",
557
+ max: 1.5,
558
+ min: -1.5,
559
+ step: 0.01,
560
+ type: "vec2",
561
+ visibleWhen: {
562
+ gte: 3,
563
+ key: "activePoints",
564
+ },
565
+ },
566
+ {
567
+ defaultValue: 0.64,
568
+ group: "Points",
569
+ key: "point3Weight",
570
+ label: "Point 3 Weight",
571
+ max: 3,
572
+ min: 0,
573
+ step: 0.01,
574
+ type: "number",
575
+ visibleWhen: {
576
+ gte: 3,
577
+ key: "activePoints",
578
+ },
579
+ },
580
+ {
581
+ defaultValue: "#3B4148",
582
+ group: "Points",
583
+ key: "point4Color",
584
+ label: "Point 4 Color",
585
+ type: "color",
586
+ visibleWhen: {
587
+ gte: 4,
588
+ key: "activePoints",
589
+ },
590
+ },
591
+ {
592
+ defaultValue: [-0.34, 0.52] as [number, number],
593
+ group: "Points",
594
+ key: "point4Position",
595
+ label: "Point 4 Position",
596
+ max: 1.5,
597
+ min: -1.5,
598
+ step: 0.01,
599
+ type: "vec2",
600
+ visibleWhen: {
601
+ gte: 4,
602
+ key: "activePoints",
603
+ },
604
+ },
605
+ {
606
+ defaultValue: 0.82,
607
+ group: "Points",
608
+ key: "point4Weight",
609
+ label: "Point 4 Weight",
610
+ max: 3,
611
+ min: 0,
612
+ step: 0.01,
613
+ type: "number",
614
+ visibleWhen: {
615
+ gte: 4,
616
+ key: "activePoints",
617
+ },
618
+ },
619
+ {
620
+ defaultValue: "#F3E7D0",
621
+ group: "Points",
622
+ key: "point5Color",
623
+ label: "Point 5 Color",
624
+ type: "color",
625
+ visibleWhen: {
626
+ gte: 5,
627
+ key: "activePoints",
628
+ },
629
+ },
630
+ {
631
+ defaultValue: [0.58, -0.76] as [number, number],
632
+ group: "Points",
633
+ key: "point5Position",
634
+ label: "Point 5 Position",
635
+ max: 1.5,
636
+ min: -1.5,
637
+ step: 0.01,
638
+ type: "vec2",
639
+ visibleWhen: {
640
+ gte: 5,
641
+ key: "activePoints",
642
+ },
643
+ },
644
+ {
645
+ defaultValue: 0.48,
646
+ group: "Points",
647
+ key: "point5Weight",
648
+ label: "Point 5 Weight",
649
+ max: 3,
650
+ min: 0,
651
+ step: 0.01,
652
+ type: "number",
653
+ visibleWhen: {
654
+ gte: 5,
655
+ key: "activePoints",
656
+ },
657
+ },
658
+ {
659
+ defaultValue: "simplex",
660
+ group: "Distortion",
661
+ key: "noiseType",
662
+ label: "Noise",
663
+ options: [
664
+ { label: "Simplex", value: "simplex" },
665
+ { label: "Perlin", value: "perlin" },
666
+ { label: "Value", value: "value" },
667
+ { label: "Voronoi", value: "voronoi" },
668
+ { label: "Ridge", value: "ridge" },
669
+ { label: "Turbulence", value: "turbulence" },
670
+ ],
671
+ type: "select",
672
+ },
673
+ {
674
+ defaultValue: 0,
675
+ group: "Distortion",
676
+ key: "noiseSeed",
677
+ label: "Seed",
678
+ max: 100,
679
+ min: 0,
680
+ step: 0.1,
681
+ type: "number",
682
+ },
683
+ {
684
+ defaultValue: 0.64,
685
+ group: "Distortion",
686
+ key: "warpAmount",
687
+ label: "Warp Amount",
688
+ max: 1,
689
+ min: 0,
690
+ step: 0.01,
691
+ type: "number",
692
+ },
693
+ {
694
+ defaultValue: 5.56,
695
+ group: "Distortion",
696
+ key: "warpScale",
697
+ label: "Warp Scale",
698
+ max: 6,
699
+ min: 0.1,
700
+ step: 0.01,
701
+ type: "number",
702
+ },
703
+ {
704
+ defaultValue: 1,
705
+ group: "Distortion",
706
+ key: "warpIterations",
707
+ label: "Iterations",
708
+ max: 5,
709
+ min: 1,
710
+ step: 1,
711
+ type: "number",
712
+ },
713
+ {
714
+ defaultValue: 1,
715
+ group: "Distortion",
716
+ key: "warpDecay",
717
+ label: "Warp Decay",
718
+ max: 3,
719
+ min: 0.1,
720
+ step: 0.01,
721
+ type: "number",
722
+ },
723
+ {
724
+ defaultValue: 0.5,
725
+ group: "Distortion",
726
+ key: "warpBias",
727
+ label: "Warp Bias",
728
+ max: 1,
729
+ min: 0,
730
+ step: 0.01,
731
+ type: "number",
732
+ },
733
+ {
734
+ defaultValue: 0.69,
735
+ group: "Distortion",
736
+ key: "vortexAmount",
737
+ label: "Vortex",
738
+ max: 1,
739
+ min: -1,
740
+ step: 0.01,
741
+ type: "number",
742
+ },
743
+ {
744
+ defaultValue: true,
745
+ group: "Animation",
746
+ key: "animate",
747
+ label: "Animate",
748
+ type: "boolean",
749
+ },
750
+ {
751
+ defaultValue: 0,
752
+ group: "Animation",
753
+ key: "motionAmount",
754
+ label: "Motion Amount",
755
+ max: 1,
756
+ min: 0,
757
+ step: 0.01,
758
+ type: "number",
759
+ },
760
+ {
761
+ defaultValue: 0.2,
762
+ group: "Animation",
763
+ key: "motionSpeed",
764
+ label: "Motion Speed",
765
+ max: 2,
766
+ min: 0,
767
+ step: 0.01,
768
+ type: "number",
769
+ visibleWhen: {
770
+ equals: true,
771
+ key: "animate",
772
+ },
773
+ },
774
+ {
775
+ defaultValue: 2.05,
776
+ group: "Distortion",
777
+ key: "falloff",
778
+ label: "Falloff",
779
+ max: 4,
780
+ min: 0.5,
781
+ step: 0.01,
782
+ type: "number",
783
+ },
784
+ {
785
+ defaultValue: "reinhard",
786
+ group: "Finish",
787
+ key: "tonemapMode",
788
+ label: "Tonemap",
789
+ options: [
790
+ { label: "None", value: "none" },
791
+ { label: "ACES", value: "aces" },
792
+ { label: "Reinhard", value: "reinhard" },
793
+ { label: "Toto's", value: "totos" },
794
+ { label: "Cinematic", value: "cinematic" },
795
+ ],
796
+ type: "select",
797
+ },
798
+ {
799
+ defaultValue: 0,
800
+ group: "Finish",
801
+ key: "glowStrength",
802
+ label: "Glow Strength",
803
+ max: 1,
804
+ min: 0,
805
+ step: 0.01,
806
+ type: "number",
807
+ },
808
+ {
809
+ defaultValue: 0,
810
+ group: "Finish",
811
+ key: "glowThreshold",
812
+ label: "Glow Threshold",
813
+ max: 1,
814
+ min: 0,
815
+ step: 0.01,
816
+ type: "number",
817
+ },
818
+ {
819
+ defaultValue: 0.08,
820
+ group: "Finish",
821
+ key: "grainAmount",
822
+ label: "Grain",
823
+ max: 1,
824
+ min: 0,
825
+ step: 0.01,
826
+ type: "number",
827
+ },
828
+ {
829
+ defaultValue: 0.12,
830
+ group: "Finish",
831
+ key: "vignetteStrength",
832
+ label: "Vignette Strength",
833
+ max: 1,
834
+ min: 0,
835
+ step: 0.01,
836
+ type: "number",
837
+ },
838
+ {
839
+ defaultValue: 1.5,
840
+ group: "Finish",
841
+ key: "vignetteRadius",
842
+ label: "Vignette Radius",
843
+ max: 1.5,
844
+ min: 0,
845
+ step: 0.01,
846
+ type: "number",
847
+ },
848
+ {
849
+ defaultValue: 1,
850
+ group: "Finish",
851
+ key: "vignetteSoftness",
852
+ label: "Vignette Softness",
853
+ max: 1,
854
+ min: 0.01,
855
+ step: 0.01,
856
+ type: "number",
857
+ },
858
+ ] as const satisfies ParameterDefinitions
859
+
860
+ const fluidParams = [
861
+ {
862
+ defaultValue: 24,
863
+ key: "iterations",
864
+ label: "Iterations",
865
+ max: 128,
866
+ min: 4,
867
+ step: 1,
868
+ type: "number",
869
+ },
870
+ {
871
+ defaultValue: 0.92,
872
+ key: "dissipation",
873
+ label: "Dissipation",
874
+ max: 0.999,
875
+ min: 0.5,
876
+ step: 0.001,
877
+ type: "number",
878
+ },
879
+ {
880
+ defaultValue: 0.24,
881
+ key: "pressure",
882
+ label: "Pressure",
883
+ max: 1,
884
+ min: 0,
885
+ step: 0.01,
886
+ type: "number",
887
+ },
888
+ {
889
+ defaultValue: "#3c73ff",
890
+ key: "inkColor",
891
+ label: "Ink Color",
892
+ type: "color",
893
+ },
894
+ ] as const satisfies ParameterDefinitions
895
+
896
+ const modelParams = [
897
+ {
898
+ defaultValue: "studio",
899
+ key: "environment",
900
+ label: "Environment",
901
+ options: [
902
+ { label: "Studio", value: "studio" },
903
+ { label: "Sunset", value: "sunset" },
904
+ { label: "Warehouse", value: "warehouse" },
905
+ { label: "Night", value: "night" },
906
+ ],
907
+ type: "select",
908
+ },
909
+ {
910
+ defaultValue: 1,
911
+ key: "environmentStrength",
912
+ label: "Env Strength",
913
+ max: 2,
914
+ min: 0,
915
+ step: 0.01,
916
+ type: "number",
917
+ },
918
+ {
919
+ defaultValue: 1.2,
920
+ key: "cameraDistance",
921
+ label: "Camera Distance",
922
+ max: 6,
923
+ min: 0.2,
924
+ step: 0.01,
925
+ type: "number",
926
+ },
927
+ {
928
+ defaultValue: [0, 0, 0] as [number, number, number],
929
+ key: "cameraOrbit",
930
+ label: "Camera Orbit",
931
+ max: 6.283,
932
+ min: -6.283,
933
+ step: 0.01,
934
+ type: "vec3",
935
+ },
936
+ {
937
+ defaultValue: false,
938
+ key: "autoRotate",
939
+ label: "Auto Rotate",
940
+ type: "boolean",
941
+ },
942
+ {
943
+ defaultValue: 0.6,
944
+ key: "autoRotateSpeed",
945
+ label: "Rotate Speed",
946
+ max: 4,
947
+ min: -4,
948
+ step: 0.01,
949
+ type: "number",
950
+ },
951
+ ] as const satisfies ParameterDefinitions
952
+
953
+ const asciiParams = [
954
+ {
955
+ defaultValue: 12,
956
+ key: "cellSize",
957
+ label: "Cell Size",
958
+ max: 48,
959
+ min: 4,
960
+ step: 1,
961
+ type: "number",
962
+ },
963
+ {
964
+ animatable: false,
965
+ defaultValue: "light",
966
+ key: "charset",
967
+ label: "Charset",
968
+ options: [
969
+ { label: "Light", value: "light" },
970
+ { label: "Dense", value: "dense" },
971
+ { label: "Blocks", value: "blocks" },
972
+ { label: "Hatching", value: "hatching" },
973
+ { label: "Binary", value: "binary" },
974
+ { label: "Custom", value: "custom" },
975
+ ],
976
+ type: "select",
977
+ },
978
+ {
979
+ animatable: false,
980
+ defaultValue: " .:-=+*#%@",
981
+ key: "customChars",
982
+ label: "Custom Chars",
983
+ maxLength: 32,
984
+ type: "text",
985
+ visibleWhen: {
986
+ equals: "custom",
987
+ key: "charset",
988
+ },
989
+ },
990
+ {
991
+ defaultValue: "regular",
992
+ key: "fontWeight",
993
+ label: "Font Weight",
994
+ options: [
995
+ { label: "Thin", value: "thin" },
996
+ { label: "Regular", value: "regular" },
997
+ { label: "Bold", value: "bold" },
998
+ ],
999
+ type: "select",
1000
+ },
1001
+ {
1002
+ defaultValue: "monochrome",
1003
+ key: "colorMode",
1004
+ label: "Color Mode",
1005
+ options: [
1006
+ { label: "Source", value: "source" },
1007
+ { label: "Monochrome", value: "monochrome" },
1008
+ // { label: "Green Terminal", value: "green-terminal" },
1009
+ ],
1010
+ type: "select",
1011
+ },
1012
+ {
1013
+ defaultValue: "#f5f5f0",
1014
+ key: "monoColor",
1015
+ label: "Tint",
1016
+ type: "color",
1017
+ visibleWhen: {
1018
+ equals: "monochrome",
1019
+ key: "colorMode",
1020
+ },
1021
+ },
1022
+ {
1023
+ defaultValue: 0,
1024
+ key: "bgOpacity",
1025
+ label: "Background",
1026
+ max: 1,
1027
+ min: 0,
1028
+ step: 0.01,
1029
+ type: "number",
1030
+ visibleWhen: {
1031
+ equals: "source",
1032
+ key: "colorMode",
1033
+ },
1034
+ },
1035
+ {
1036
+ defaultValue: false,
1037
+ key: "invert",
1038
+ label: "Invert",
1039
+ type: "boolean",
1040
+ },
1041
+ {
1042
+ defaultValue: false,
1043
+ group: "Bloom",
1044
+ key: "bloomEnabled",
1045
+ label: "Bloom",
1046
+ type: "boolean",
1047
+ },
1048
+ {
1049
+ defaultValue: 1.25,
1050
+ group: "Bloom",
1051
+ key: "bloomIntensity",
1052
+ label: "Intensity",
1053
+ max: 8,
1054
+ min: 0,
1055
+ step: 0.01,
1056
+ type: "number",
1057
+ visibleWhen: {
1058
+ equals: true,
1059
+ key: "bloomEnabled",
1060
+ },
1061
+ },
1062
+ {
1063
+ defaultValue: 0.6,
1064
+ group: "Bloom",
1065
+ key: "bloomThreshold",
1066
+ label: "Threshold",
1067
+ max: 1,
1068
+ min: 0,
1069
+ step: 0.01,
1070
+ type: "number",
1071
+ visibleWhen: {
1072
+ equals: true,
1073
+ key: "bloomEnabled",
1074
+ },
1075
+ },
1076
+ {
1077
+ defaultValue: 6,
1078
+ group: "Bloom",
1079
+ key: "bloomRadius",
1080
+ label: "Radius",
1081
+ max: 24,
1082
+ min: 0,
1083
+ step: 0.25,
1084
+ type: "number",
1085
+ visibleWhen: {
1086
+ equals: true,
1087
+ key: "bloomEnabled",
1088
+ },
1089
+ },
1090
+ {
1091
+ defaultValue: 0.35,
1092
+ group: "Bloom",
1093
+ key: "bloomSoftness",
1094
+ label: "Softness",
1095
+ max: 1,
1096
+ min: 0,
1097
+ step: 0.01,
1098
+ type: "number",
1099
+ visibleWhen: {
1100
+ equals: true,
1101
+ key: "bloomEnabled",
1102
+ },
1103
+ },
1104
+ ] as const satisfies ParameterDefinitions
1105
+
1106
+ const patternParams = [
1107
+ {
1108
+ defaultValue: 12,
1109
+ key: "cellSize",
1110
+ label: "Cell Size",
1111
+ max: 48,
1112
+ min: 4,
1113
+ step: 1,
1114
+ type: "number",
1115
+ },
1116
+ {
1117
+ animatable: false,
1118
+ defaultValue: "bars",
1119
+ key: "preset",
1120
+ label: "Preset",
1121
+ options: [
1122
+ { label: "Bars", value: "bars" },
1123
+ { label: "Candles", value: "candles" },
1124
+ { label: "Shapes", value: "shapes" },
1125
+ ],
1126
+ type: "select",
1127
+ },
1128
+ {
1129
+ defaultValue: "source",
1130
+ key: "colorMode",
1131
+ label: "Color Mode",
1132
+ options: [
1133
+ { label: "Source", value: "source" },
1134
+ { label: "Quantized", value: "quantized" },
1135
+ { label: "Monochrome", value: "monochrome" },
1136
+ { label: "Custom", value: "custom" },
1137
+ ],
1138
+ type: "select",
1139
+ },
1140
+ {
1141
+ defaultValue: "#f5f5f0",
1142
+ key: "monoColor",
1143
+ label: "Tint",
1144
+ type: "color",
1145
+ visibleWhen: {
1146
+ equals: "monochrome",
1147
+ key: "colorMode",
1148
+ },
1149
+ },
1150
+ {
1151
+ defaultValue: 0,
1152
+ key: "bgOpacity",
1153
+ label: "Background",
1154
+ max: 1,
1155
+ min: 0,
1156
+ step: 0.01,
1157
+ type: "number",
1158
+ visibleWhen: {
1159
+ equals: "source",
1160
+ key: "colorMode",
1161
+ },
1162
+ },
1163
+ {
1164
+ defaultValue: false,
1165
+ key: "invert",
1166
+ label: "Invert",
1167
+ type: "boolean",
1168
+ },
1169
+ {
1170
+ defaultValue: 4,
1171
+ description: "Palette is distributed evenly across luminance bands.",
1172
+ key: "customColorCount",
1173
+ label: "Color Count",
1174
+ max: 4,
1175
+ min: 2,
1176
+ step: 1,
1177
+ type: "number",
1178
+ visibleWhen: { equals: "custom", key: "colorMode" },
1179
+ },
1180
+ {
1181
+ defaultValue: 0,
1182
+ description: "Shifts palette mapping toward shadows or highlights.",
1183
+ key: "customLuminanceBias",
1184
+ label: "Luminance Bias",
1185
+ max: 1,
1186
+ min: -1,
1187
+ step: 0.01,
1188
+ type: "number",
1189
+ visibleWhen: { equals: "custom", key: "colorMode" },
1190
+ },
1191
+ {
1192
+ defaultValue: "#F5F5F0",
1193
+ key: "customBgColor",
1194
+ label: "Background",
1195
+ type: "color",
1196
+ visibleWhen: { equals: "custom", key: "colorMode" },
1197
+ },
1198
+ {
1199
+ defaultValue: "#0d1014",
1200
+ key: "customColor1",
1201
+ label: "Shadows",
1202
+ type: "color",
1203
+ visibleWhen: { equals: "custom", key: "colorMode" },
1204
+ },
1205
+ {
1206
+ defaultValue: "#4d5057",
1207
+ key: "customColor2",
1208
+ label: "Midtones / Highlights",
1209
+ type: "color",
1210
+ visibleWhen: { equals: "custom", key: "colorMode" },
1211
+ },
1212
+ {
1213
+ defaultValue: "#969aa2",
1214
+ key: "customColor3",
1215
+ label: "High Mids",
1216
+ type: "color",
1217
+ visibleWhen: {
1218
+ gte: 3,
1219
+ key: "customColorCount",
1220
+ },
1221
+ },
1222
+ {
1223
+ defaultValue: "#e1e2de",
1224
+ key: "customColor4",
1225
+ label: "Highlights",
1226
+ type: "color",
1227
+ visibleWhen: {
1228
+ gte: 4,
1229
+ key: "customColorCount",
1230
+ },
1231
+ },
1232
+ {
1233
+ defaultValue: false,
1234
+ group: "Bloom",
1235
+ key: "bloomEnabled",
1236
+ label: "Bloom",
1237
+ type: "boolean",
1238
+ },
1239
+ {
1240
+ defaultValue: 1.25,
1241
+ group: "Bloom",
1242
+ key: "bloomIntensity",
1243
+ label: "Intensity",
1244
+ max: 8,
1245
+ min: 0,
1246
+ step: 0.01,
1247
+ type: "number",
1248
+ visibleWhen: {
1249
+ equals: true,
1250
+ key: "bloomEnabled",
1251
+ },
1252
+ },
1253
+ {
1254
+ defaultValue: 0.6,
1255
+ group: "Bloom",
1256
+ key: "bloomThreshold",
1257
+ label: "Threshold",
1258
+ max: 1,
1259
+ min: 0,
1260
+ step: 0.01,
1261
+ type: "number",
1262
+ visibleWhen: {
1263
+ equals: true,
1264
+ key: "bloomEnabled",
1265
+ },
1266
+ },
1267
+ {
1268
+ defaultValue: 6,
1269
+ group: "Bloom",
1270
+ key: "bloomRadius",
1271
+ label: "Radius",
1272
+ max: 24,
1273
+ min: 0,
1274
+ step: 0.25,
1275
+ type: "number",
1276
+ visibleWhen: {
1277
+ equals: true,
1278
+ key: "bloomEnabled",
1279
+ },
1280
+ },
1281
+ {
1282
+ defaultValue: 0.35,
1283
+ group: "Bloom",
1284
+ key: "bloomSoftness",
1285
+ label: "Softness",
1286
+ max: 1,
1287
+ min: 0,
1288
+ step: 0.01,
1289
+ type: "number",
1290
+ visibleWhen: {
1291
+ equals: true,
1292
+ key: "bloomEnabled",
1293
+ },
1294
+ },
1295
+ ] as const satisfies ParameterDefinitions
1296
+
1297
+ const ditheringParams = [
1298
+ {
1299
+ defaultValue: "custom",
1300
+ group: "Pattern",
1301
+ key: "preset",
1302
+ label: "Preset",
1303
+ options: [
1304
+ { label: "Custom", value: "custom" },
1305
+ { label: "Game Boy", value: "gameboy" },
1306
+ ],
1307
+ type: "select",
1308
+ },
1309
+ {
1310
+ defaultValue: "bayer-4x4",
1311
+ group: "Pattern",
1312
+ key: "algorithm",
1313
+ label: "Algorithm",
1314
+ options: [
1315
+ { label: "Bayer 2x2", value: "bayer-2x2" },
1316
+ { label: "Bayer 4x4", value: "bayer-4x4" },
1317
+ { label: "Bayer 8x8", value: "bayer-8x8" },
1318
+ { label: "Noise", value: "noise" },
1319
+ ],
1320
+ type: "select",
1321
+ },
1322
+ {
1323
+ defaultValue: "source",
1324
+ group: "Color",
1325
+ key: "colorMode",
1326
+ label: "Color Mode",
1327
+ options: [
1328
+ { label: "Monochrome", value: "monochrome" },
1329
+ { label: "Source Color", value: "source" },
1330
+ { label: "Duo Tone", value: "duo-tone" },
1331
+ ],
1332
+ type: "select",
1333
+ },
1334
+ {
1335
+ defaultValue: "#f5f5f0",
1336
+ group: "Color",
1337
+ key: "monoColor",
1338
+ label: "Color",
1339
+ type: "color",
1340
+ visibleWhen: {
1341
+ equals: "monochrome",
1342
+ key: "colorMode",
1343
+ },
1344
+ },
1345
+ {
1346
+ defaultValue: "#101010",
1347
+ group: "Color",
1348
+ key: "shadowColor",
1349
+ label: "Shadow",
1350
+ type: "color",
1351
+ visibleWhen: {
1352
+ equals: "duo-tone",
1353
+ key: "colorMode",
1354
+ },
1355
+ },
1356
+ {
1357
+ defaultValue: "#f5f2e8",
1358
+ group: "Color",
1359
+ key: "highlightColor",
1360
+ label: "Highlight",
1361
+ type: "color",
1362
+ visibleWhen: {
1363
+ equals: "duo-tone",
1364
+ key: "colorMode",
1365
+ },
1366
+ },
1367
+ {
1368
+ defaultValue: 1,
1369
+ group: "Pattern",
1370
+ key: "pixelSize",
1371
+ label: "Pixel Size",
1372
+ max: 24,
1373
+ min: 1,
1374
+ step: 1,
1375
+ type: "number",
1376
+ },
1377
+ {
1378
+ defaultValue: 0.5,
1379
+ group: "Pattern",
1380
+ key: "spread",
1381
+ label: "Strength",
1382
+ max: 1,
1383
+ min: 0,
1384
+ step: 0.01,
1385
+ type: "number",
1386
+ },
1387
+ {
1388
+ defaultValue: 4,
1389
+ group: "Color",
1390
+ key: "levels",
1391
+ label: "Levels",
1392
+ max: 16,
1393
+ min: 2,
1394
+ step: 1,
1395
+ type: "number",
1396
+ },
1397
+ {
1398
+ defaultValue: 1,
1399
+ group: "Effects",
1400
+ key: "dotScale",
1401
+ label: "Dot Scale",
1402
+ max: 1,
1403
+ min: 0.1,
1404
+ step: 0.1,
1405
+ type: "number",
1406
+ },
1407
+ {
1408
+ defaultValue: false,
1409
+ group: "Effects",
1410
+ key: "animateDither",
1411
+ label: "Animate Dither",
1412
+ type: "boolean",
1413
+ },
1414
+ {
1415
+ defaultValue: 1,
1416
+ group: "Effects",
1417
+ key: "ditherSpeed",
1418
+ label: "Dither Speed",
1419
+ max: 3,
1420
+ min: 0,
1421
+ step: 0.5,
1422
+ type: "number",
1423
+ visibleWhen: {
1424
+ equals: true,
1425
+ key: "animateDither",
1426
+ },
1427
+ },
1428
+ {
1429
+ defaultValue: false,
1430
+ group: "Effects",
1431
+ key: "chromaticSplit",
1432
+ label: "Chromatic Split",
1433
+ type: "boolean",
1434
+ },
1435
+ ] as const satisfies ParameterDefinitions
1436
+
1437
+ const halftoneParams = [
1438
+ {
1439
+ defaultValue: "cmyk",
1440
+ key: "colorMode",
1441
+ label: "Color Mode",
1442
+ options: [
1443
+ { label: "Source", value: "source" },
1444
+ { label: "Monochrome", value: "monochrome" },
1445
+ { label: "Duotone", value: "duotone" },
1446
+ { label: "Custom", value: "custom" },
1447
+ { label: "CMYK", value: "cmyk" },
1448
+ ],
1449
+ type: "select",
1450
+ },
1451
+ {
1452
+ defaultValue: "circle",
1453
+ key: "shape",
1454
+ label: "Shape",
1455
+ options: [
1456
+ { label: "Circle", value: "circle" },
1457
+ { label: "Square", value: "square" },
1458
+ { label: "Diamond", value: "diamond" },
1459
+ { label: "Line", value: "line" },
1460
+ ],
1461
+ type: "select",
1462
+ },
1463
+ {
1464
+ defaultValue: 5,
1465
+ key: "spacing",
1466
+ label: "Spacing",
1467
+ max: 48,
1468
+ min: 2,
1469
+ step: 1,
1470
+ type: "number",
1471
+ },
1472
+ {
1473
+ defaultValue: 1,
1474
+ key: "dotSize",
1475
+ label: "Dot Size",
1476
+ max: 3,
1477
+ min: 0.1,
1478
+ step: 0.01,
1479
+ type: "number",
1480
+ },
1481
+ {
1482
+ defaultValue: 0,
1483
+ key: "dotMin",
1484
+ label: "Dot Min",
1485
+ max: 0.5,
1486
+ min: 0,
1487
+ step: 0.01,
1488
+ type: "number",
1489
+ },
1490
+ {
1491
+ defaultValue: 28,
1492
+ key: "angle",
1493
+ label: "Angle",
1494
+ max: 360,
1495
+ min: 0,
1496
+ step: 1,
1497
+ type: "number",
1498
+ },
1499
+ {
1500
+ defaultValue: 1,
1501
+ key: "contrast",
1502
+ label: "Contrast",
1503
+ max: 2,
1504
+ min: 0,
1505
+ step: 0.01,
1506
+ type: "number",
1507
+ },
1508
+ {
1509
+ defaultValue: 0.25,
1510
+ key: "softness",
1511
+ label: "Softness",
1512
+ max: 1,
1513
+ min: 0,
1514
+ step: 0.01,
1515
+ type: "number",
1516
+ },
1517
+ {
1518
+ defaultValue: 0,
1519
+ key: "dotGain",
1520
+ label: "Dot Gain",
1521
+ description: "Simulates ink bleeding into paper fibers",
1522
+ max: 1,
1523
+ min: 0,
1524
+ step: 0.01,
1525
+ type: "number",
1526
+ },
1527
+ {
1528
+ defaultValue: 0,
1529
+ key: "dotMorph",
1530
+ label: "Dot Morph",
1531
+ description:
1532
+ "Blends dot shape based on tonal value (circles → squares in midtones)",
1533
+ max: 1,
1534
+ min: 0,
1535
+ step: 0.01,
1536
+ type: "number",
1537
+ },
1538
+ {
1539
+ defaultValue: false,
1540
+ key: "invertLuma",
1541
+ label: "Invert",
1542
+ type: "boolean",
1543
+ },
1544
+ {
1545
+ defaultValue: 4,
1546
+ description: "Palette is distributed evenly across luminance bands.",
1547
+ key: "customColorCount",
1548
+ label: "Color Count",
1549
+ max: 4,
1550
+ min: 2,
1551
+ step: 1,
1552
+ type: "number",
1553
+ visibleWhen: { equals: "custom", key: "colorMode" },
1554
+ },
1555
+ {
1556
+ defaultValue: 0,
1557
+ description: "Shifts palette mapping toward shadows or highlights.",
1558
+ key: "customLuminanceBias",
1559
+ label: "Luminance Bias",
1560
+ max: 1,
1561
+ min: -1,
1562
+ step: 0.01,
1563
+ type: "number",
1564
+ visibleWhen: { equals: "custom", key: "colorMode" },
1565
+ },
1566
+ {
1567
+ defaultValue: false,
1568
+ group: "Bloom",
1569
+ key: "bloomEnabled",
1570
+ label: "Bloom",
1571
+ type: "boolean",
1572
+ visibleWhen: { equals: "custom", key: "colorMode" },
1573
+ },
1574
+ {
1575
+ defaultValue: 1.25,
1576
+ group: "Bloom",
1577
+ key: "bloomIntensity",
1578
+ label: "Intensity",
1579
+ max: 8,
1580
+ min: 0,
1581
+ step: 0.01,
1582
+ type: "number",
1583
+ visibleWhen: { equals: true, key: "bloomEnabled" },
1584
+ },
1585
+ {
1586
+ defaultValue: 0.6,
1587
+ group: "Bloom",
1588
+ key: "bloomThreshold",
1589
+ label: "Threshold",
1590
+ max: 1,
1591
+ min: 0,
1592
+ step: 0.01,
1593
+ type: "number",
1594
+ visibleWhen: { equals: true, key: "bloomEnabled" },
1595
+ },
1596
+ {
1597
+ defaultValue: 6,
1598
+ group: "Bloom",
1599
+ key: "bloomRadius",
1600
+ label: "Radius",
1601
+ max: 24,
1602
+ min: 0,
1603
+ step: 0.25,
1604
+ type: "number",
1605
+ visibleWhen: { equals: true, key: "bloomEnabled" },
1606
+ },
1607
+ {
1608
+ defaultValue: 0.35,
1609
+ group: "Bloom",
1610
+ key: "bloomSoftness",
1611
+ label: "Softness",
1612
+ max: 1,
1613
+ min: 0,
1614
+ step: 0.01,
1615
+ type: "number",
1616
+ visibleWhen: { equals: true, key: "bloomEnabled" },
1617
+ },
1618
+ {
1619
+ defaultValue: "#F5F5F0",
1620
+ key: "customBgColor",
1621
+ label: "Background",
1622
+ type: "color",
1623
+ visibleWhen: { equals: "custom", key: "colorMode" },
1624
+ },
1625
+ {
1626
+ defaultValue: "#0d1014",
1627
+ key: "customColor1",
1628
+ label: "Shadows",
1629
+ type: "color",
1630
+ visibleWhen: { equals: "custom", key: "colorMode" },
1631
+ },
1632
+ {
1633
+ defaultValue: "#4d5057",
1634
+ key: "customColor2",
1635
+ label: "Midtones / Highlights",
1636
+ type: "color",
1637
+ visibleWhen: { equals: "custom", key: "colorMode" },
1638
+ },
1639
+ {
1640
+ defaultValue: "#969aa2",
1641
+ key: "customColor3",
1642
+ label: "High Mids",
1643
+ type: "color",
1644
+ visibleWhen: {
1645
+ gte: 3,
1646
+ key: "customColorCount",
1647
+ },
1648
+ },
1649
+ {
1650
+ defaultValue: "#e1e2de",
1651
+ key: "customColor4",
1652
+ label: "Highlights",
1653
+ type: "color",
1654
+ visibleWhen: {
1655
+ gte: 4,
1656
+ key: "customColorCount",
1657
+ },
1658
+ },
1659
+ {
1660
+ defaultValue: "#0d1014",
1661
+ key: "ink",
1662
+ label: "Ink",
1663
+ type: "color",
1664
+ visibleWhen: { equals: "monochrome", key: "colorMode" },
1665
+ },
1666
+ {
1667
+ defaultValue: "#F5F5F0",
1668
+ key: "duotoneLight",
1669
+ label: "Light Color",
1670
+ type: "color",
1671
+ visibleWhen: { equals: "duotone", key: "colorMode" },
1672
+ },
1673
+ {
1674
+ defaultValue: "#1d1d1c",
1675
+ key: "duotoneDark",
1676
+ label: "Dark Color",
1677
+ type: "color",
1678
+ visibleWhen: { equals: "duotone", key: "colorMode" },
1679
+ },
1680
+ {
1681
+ defaultValue: "process",
1682
+ key: "preset",
1683
+ label: "Ink Preset",
1684
+ options: [
1685
+ { label: "Process CMYK", value: "process" },
1686
+ { label: "Risograph", value: "risograph" },
1687
+ { label: "Newspaper", value: "newspaper" },
1688
+ { label: "Vintage", value: "vintage" },
1689
+ { label: "Custom", value: "custom" },
1690
+ ],
1691
+ type: "select",
1692
+ visibleWhen: { equals: "cmyk", key: "colorMode" },
1693
+ },
1694
+ {
1695
+ defaultValue: 0.5,
1696
+ key: "gcr",
1697
+ label: "Black Generation",
1698
+ description: "Controls how much goes to the K plate vs C+M+Y",
1699
+ max: 1,
1700
+ min: 0,
1701
+ step: 0.01,
1702
+ type: "number",
1703
+ visibleWhen: { equals: "cmyk", key: "colorMode" },
1704
+ },
1705
+ {
1706
+ defaultValue: "subtractive",
1707
+ key: "cmykBlend",
1708
+ label: "CMYK Blend",
1709
+ options: [
1710
+ { label: "Subtractive", value: "subtractive" },
1711
+ { label: "Overprint", value: "overprint" },
1712
+ ],
1713
+ type: "select",
1714
+ visibleWhen: { equals: "cmyk", key: "colorMode" },
1715
+ },
1716
+ {
1717
+ defaultValue: 15,
1718
+ key: "cyanAngle",
1719
+ label: "Cyan Angle",
1720
+ max: 90,
1721
+ min: 0,
1722
+ step: 1,
1723
+ type: "number",
1724
+ visibleWhen: { equals: "cmyk", key: "colorMode" },
1725
+ },
1726
+ {
1727
+ defaultValue: 75,
1728
+ key: "magentaAngle",
1729
+ label: "Magenta Angle",
1730
+ max: 90,
1731
+ min: 0,
1732
+ step: 1,
1733
+ type: "number",
1734
+ visibleWhen: { equals: "cmyk", key: "colorMode" },
1735
+ },
1736
+ {
1737
+ defaultValue: 0,
1738
+ key: "yellowAngle",
1739
+ label: "Yellow Angle",
1740
+ max: 90,
1741
+ min: 0,
1742
+ step: 1,
1743
+ type: "number",
1744
+ visibleWhen: { equals: "cmyk", key: "colorMode" },
1745
+ },
1746
+ {
1747
+ defaultValue: 45,
1748
+ key: "keyAngle",
1749
+ label: "Key Angle",
1750
+ max: 90,
1751
+ min: 0,
1752
+ step: 1,
1753
+ type: "number",
1754
+ visibleWhen: { equals: "cmyk", key: "colorMode" },
1755
+ },
1756
+ {
1757
+ defaultValue: "#F5F5F0",
1758
+ key: "paperColor",
1759
+ label: "Paper Color",
1760
+ type: "color",
1761
+ visibleWhen: { equals: "cmyk", key: "colorMode" },
1762
+ },
1763
+ {
1764
+ defaultValue: 0.15,
1765
+ key: "paperGrain",
1766
+ label: "Paper Grain",
1767
+ max: 0.5,
1768
+ min: 0,
1769
+ step: 0.01,
1770
+ type: "number",
1771
+ visibleWhen: { equals: "cmyk", key: "colorMode" },
1772
+ },
1773
+ {
1774
+ defaultValue: 0,
1775
+ key: "registration",
1776
+ label: "Registration",
1777
+ description: "Simulates plate misalignment in CMYK printing",
1778
+ max: 5,
1779
+ min: 0,
1780
+ step: 0.1,
1781
+ type: "number",
1782
+ visibleWhen: { equals: "cmyk", key: "colorMode" },
1783
+ },
1784
+ {
1785
+ defaultValue: "#00AEEF",
1786
+ key: "inkCyan",
1787
+ label: "Cyan Ink",
1788
+ type: "color",
1789
+ visibleWhen: { equals: "cmyk", key: "colorMode" },
1790
+ },
1791
+ {
1792
+ defaultValue: "#EC008C",
1793
+ key: "inkMagenta",
1794
+ label: "Magenta Ink",
1795
+ type: "color",
1796
+ visibleWhen: { equals: "cmyk", key: "colorMode" },
1797
+ },
1798
+ {
1799
+ defaultValue: "#FFF200",
1800
+ key: "inkYellow",
1801
+ label: "Yellow Ink",
1802
+ type: "color",
1803
+ visibleWhen: { equals: "cmyk", key: "colorMode" },
1804
+ },
1805
+ {
1806
+ defaultValue: "#1a1a1a",
1807
+ key: "inkKey",
1808
+ label: "Key Ink",
1809
+ type: "color",
1810
+ visibleWhen: { equals: "cmyk", key: "colorMode" },
1811
+ },
1812
+ ] as const satisfies ParameterDefinitions
1813
+
1814
+ const particleGridParams = [
1815
+ {
1816
+ defaultValue: 256,
1817
+ key: "gridResolution",
1818
+ label: "Resolution",
1819
+ max: 512,
1820
+ min: 32,
1821
+ step: 4,
1822
+ type: "number",
1823
+ },
1824
+ {
1825
+ defaultValue: 4,
1826
+ key: "pointSize",
1827
+ label: "Point Size",
1828
+ max: 32,
1829
+ min: 1,
1830
+ step: 1,
1831
+ type: "number",
1832
+ },
1833
+ {
1834
+ defaultValue: 0.1,
1835
+ key: "displacement",
1836
+ label: "Displacement",
1837
+ max: 2,
1838
+ min: -2,
1839
+ step: 0.01,
1840
+ type: "number",
1841
+ },
1842
+ {
1843
+ defaultValue: "#000000",
1844
+ key: "backgroundColor",
1845
+ label: "Background",
1846
+ type: "color",
1847
+ },
1848
+ {
1849
+ defaultValue: 0,
1850
+ group: "Motion",
1851
+ key: "noiseAmount",
1852
+ label: "Amount",
1853
+ max: 2,
1854
+ min: 0,
1855
+ step: 0.01,
1856
+ type: "number",
1857
+ },
1858
+ {
1859
+ defaultValue: 3,
1860
+ group: "Motion",
1861
+ key: "noiseScale",
1862
+ label: "Scale",
1863
+ max: 10,
1864
+ min: 0.5,
1865
+ step: 0.1,
1866
+ type: "number",
1867
+ },
1868
+ {
1869
+ defaultValue: 0.5,
1870
+ group: "Motion",
1871
+ key: "noiseSpeed",
1872
+ label: "Speed",
1873
+ max: 3,
1874
+ min: 0,
1875
+ step: 0.01,
1876
+ type: "number",
1877
+ },
1878
+ {
1879
+ defaultValue: false,
1880
+ group: "Bloom",
1881
+ key: "bloomEnabled",
1882
+ label: "Bloom",
1883
+ type: "boolean",
1884
+ },
1885
+ {
1886
+ defaultValue: 1.25,
1887
+ group: "Bloom",
1888
+ key: "bloomIntensity",
1889
+ label: "Intensity",
1890
+ max: 8,
1891
+ min: 0,
1892
+ step: 0.01,
1893
+ type: "number",
1894
+ visibleWhen: {
1895
+ equals: true,
1896
+ key: "bloomEnabled",
1897
+ },
1898
+ },
1899
+ {
1900
+ defaultValue: 0.6,
1901
+ group: "Bloom",
1902
+ key: "bloomThreshold",
1903
+ label: "Threshold",
1904
+ max: 1,
1905
+ min: 0,
1906
+ step: 0.01,
1907
+ type: "number",
1908
+ visibleWhen: {
1909
+ equals: true,
1910
+ key: "bloomEnabled",
1911
+ },
1912
+ },
1913
+ {
1914
+ defaultValue: 6,
1915
+ group: "Bloom",
1916
+ key: "bloomRadius",
1917
+ label: "Radius",
1918
+ max: 24,
1919
+ min: 0,
1920
+ step: 0.25,
1921
+ type: "number",
1922
+ visibleWhen: {
1923
+ equals: true,
1924
+ key: "bloomEnabled",
1925
+ },
1926
+ },
1927
+ {
1928
+ defaultValue: 0.35,
1929
+ group: "Bloom",
1930
+ key: "bloomSoftness",
1931
+ label: "Softness",
1932
+ max: 1,
1933
+ min: 0,
1934
+ step: 0.01,
1935
+ type: "number",
1936
+ visibleWhen: {
1937
+ equals: true,
1938
+ key: "bloomEnabled",
1939
+ },
1940
+ },
1941
+ ] as const satisfies ParameterDefinitions
1942
+
1943
+ const pixelationParams = [
1944
+ {
1945
+ defaultValue: 8,
1946
+ key: "cellSize",
1947
+ label: "Cell Size",
1948
+ max: 64,
1949
+ min: 2,
1950
+ step: 1,
1951
+ type: "number",
1952
+ },
1953
+ {
1954
+ defaultValue: "square",
1955
+ key: "shape",
1956
+ label: "Shape",
1957
+ options: [
1958
+ { label: "Square", value: "square" },
1959
+ { label: "Circle", value: "circle" },
1960
+ { label: "Diamond", value: "diamond" },
1961
+ ],
1962
+ type: "select",
1963
+ },
1964
+ ] as const satisfies ParameterDefinitions
1965
+
1966
+ const pixelSortingParams = [
1967
+ {
1968
+ defaultValue: 0.25,
1969
+ key: "threshold",
1970
+ label: "Threshold",
1971
+ max: 1,
1972
+ min: 0,
1973
+ step: 0.01,
1974
+ type: "number",
1975
+ },
1976
+ {
1977
+ defaultValue: 1,
1978
+ key: "upperThreshold",
1979
+ label: "Upper Threshold",
1980
+ max: 1,
1981
+ min: 0,
1982
+ step: 0.01,
1983
+ type: "number",
1984
+ },
1985
+ {
1986
+ defaultValue: "horizontal",
1987
+ key: "direction",
1988
+ label: "Direction",
1989
+ options: [
1990
+ { label: "Horizontal", value: "horizontal" },
1991
+ { label: "Vertical", value: "vertical" },
1992
+ ],
1993
+ type: "select",
1994
+ },
1995
+ {
1996
+ defaultValue: "luma",
1997
+ key: "mode",
1998
+ label: "Mode",
1999
+ options: [
2000
+ { label: "Luma", value: "luma" },
2001
+ { label: "Hue", value: "hue" },
2002
+ { label: "Saturation", value: "saturation" },
2003
+ ],
2004
+ type: "select",
2005
+ },
2006
+ {
2007
+ defaultValue: false,
2008
+ key: "reverse",
2009
+ label: "Reverse",
2010
+ type: "boolean",
2011
+ },
2012
+ {
2013
+ defaultValue: 0.3,
2014
+ key: "range",
2015
+ label: "Range",
2016
+ max: 1,
2017
+ min: 0,
2018
+ step: 0.01,
2019
+ type: "number",
2020
+ },
2021
+ ] as const satisfies ParameterDefinitions
2022
+
2023
+ const crtParams = [
2024
+ {
2025
+ defaultValue: "slot-mask",
2026
+ key: "crtMode",
2027
+ label: "Mode",
2028
+ options: [
2029
+ { label: "Slot-Mask Monitor", value: "slot-mask" },
2030
+ { label: "Aperture-Grille Monitor", value: "aperture-grille" },
2031
+ { label: "Composite TV", value: "composite-tv" },
2032
+ ],
2033
+ type: "select",
2034
+ },
2035
+ {
2036
+ defaultValue: 3,
2037
+ key: "cellSize",
2038
+ label: "Mask Scale",
2039
+ max: 32,
2040
+ min: 2,
2041
+ step: 2,
2042
+ type: "number",
2043
+ },
2044
+ {
2045
+ defaultValue: 0.17,
2046
+ key: "scanlineIntensity",
2047
+ label: "Scanline Intensity",
2048
+ max: 1,
2049
+ min: 0,
2050
+ step: 0.01,
2051
+ type: "number",
2052
+ },
2053
+ {
2054
+ defaultValue: 1,
2055
+ key: "maskIntensity",
2056
+ label: "Mask Intensity",
2057
+ max: 1,
2058
+ min: 0,
2059
+ step: 0.01,
2060
+ type: "number",
2061
+ },
2062
+ {
2063
+ defaultValue: 0.15,
2064
+ group: "Distortion",
2065
+ key: "barrelDistortion",
2066
+ label: "Barrel Distortion",
2067
+ max: 0.3,
2068
+ min: 0,
2069
+ step: 0.001,
2070
+ type: "number",
2071
+ },
2072
+ {
2073
+ defaultValue: 2,
2074
+ group: "Distortion",
2075
+ key: "chromaticAberration",
2076
+ label: "Convergence",
2077
+ max: 2,
2078
+ min: 0,
2079
+ step: 0.01,
2080
+ type: "number",
2081
+ },
2082
+ {
2083
+ defaultValue: 0.58,
2084
+ group: "Phosphor",
2085
+ key: "beamFocus",
2086
+ label: "Beam Focus",
2087
+ max: 1,
2088
+ min: 0,
2089
+ step: 0.01,
2090
+ type: "number",
2091
+ },
2092
+ {
2093
+ defaultValue: 1.2,
2094
+ group: "Phosphor",
2095
+ key: "brightness",
2096
+ label: "Brightness",
2097
+ max: 100,
2098
+ min: 0.5,
2099
+ step: 0.01,
2100
+ type: "number",
2101
+ },
2102
+ {
2103
+ defaultValue: 1,
2104
+ group: "Phosphor",
2105
+ key: "highlightDrive",
2106
+ label: "Highlight Drive",
2107
+ max: 100,
2108
+ min: 1,
2109
+ step: 0.01,
2110
+ type: "number",
2111
+ },
2112
+ {
2113
+ defaultValue: 0.62,
2114
+ group: "Phosphor",
2115
+ key: "highlightThreshold",
2116
+ label: "Highlight Threshold",
2117
+ max: 1,
2118
+ min: 0,
2119
+ step: 0.01,
2120
+ type: "number",
2121
+ },
2122
+ {
2123
+ defaultValue: 0.25,
2124
+ group: "Phosphor",
2125
+ key: "shoulder",
2126
+ label: "Shoulder",
2127
+ max: 4,
2128
+ min: 0,
2129
+ step: 0.01,
2130
+ type: "number",
2131
+ },
2132
+ {
2133
+ defaultValue: 1.15,
2134
+ group: "Phosphor",
2135
+ key: "chromaRetention",
2136
+ label: "Chroma Retention",
2137
+ max: 2,
2138
+ min: 0,
2139
+ step: 0.01,
2140
+ type: "number",
2141
+ },
2142
+ {
2143
+ defaultValue: 0.16,
2144
+ group: "Phosphor",
2145
+ key: "shadowLift",
2146
+ label: "Shadow Lift",
2147
+ max: 1,
2148
+ min: 0,
2149
+ step: 0.01,
2150
+ type: "number",
2151
+ },
2152
+ {
2153
+ defaultValue: 0.18,
2154
+ group: "Phosphor",
2155
+ key: "persistence",
2156
+ label: "Persistence",
2157
+ max: 1,
2158
+ min: 0,
2159
+ step: 0.01,
2160
+ type: "number",
2161
+ },
2162
+ {
2163
+ defaultValue: 0.45,
2164
+ group: "Distortion",
2165
+ key: "vignetteIntensity",
2166
+ label: "Vignette",
2167
+ max: 1,
2168
+ min: 0,
2169
+ step: 0.01,
2170
+ type: "number",
2171
+ },
2172
+ {
2173
+ defaultValue: 0.2,
2174
+ group: "Noise",
2175
+ key: "flickerIntensity",
2176
+ label: "Flicker",
2177
+ max: 0.2,
2178
+ min: 0,
2179
+ step: 0.01,
2180
+ type: "number",
2181
+ },
2182
+ {
2183
+ defaultValue: 0.13,
2184
+ group: "Noise",
2185
+ key: "glitchIntensity",
2186
+ label: "Glitch",
2187
+ max: 1,
2188
+ min: 0,
2189
+ step: 0.01,
2190
+ type: "number",
2191
+ },
2192
+ {
2193
+ defaultValue: 5,
2194
+ group: "Noise",
2195
+ key: "glitchSpeed",
2196
+ label: "Glitch Speed",
2197
+ max: 5,
2198
+ min: 0.1,
2199
+ step: 0.1,
2200
+ type: "number",
2201
+ visibleWhen: {
2202
+ gte: 0.01,
2203
+ key: "glitchIntensity",
2204
+ },
2205
+ },
2206
+ {
2207
+ defaultValue: 0.45,
2208
+ group: "Signal",
2209
+ key: "signalArtifacts",
2210
+ label: "Signal Artifacts",
2211
+ max: 1,
2212
+ min: 0,
2213
+ step: 0.01,
2214
+ type: "number",
2215
+ visibleWhen: {
2216
+ equals: "composite-tv",
2217
+ key: "crtMode",
2218
+ },
2219
+ },
2220
+ {
2221
+ defaultValue: true,
2222
+ group: "Bloom",
2223
+ key: "bloomEnabled",
2224
+ label: "Bloom",
2225
+ type: "boolean",
2226
+ },
2227
+ {
2228
+ defaultValue: 1.93,
2229
+ group: "Bloom",
2230
+ key: "bloomIntensity",
2231
+ label: "Intensity",
2232
+ max: 8,
2233
+ min: 0,
2234
+ step: 0.01,
2235
+ type: "number",
2236
+ visibleWhen: {
2237
+ equals: true,
2238
+ key: "bloomEnabled",
2239
+ },
2240
+ },
2241
+ {
2242
+ defaultValue: 0,
2243
+ group: "Bloom",
2244
+ key: "bloomThreshold",
2245
+ label: "Threshold",
2246
+ max: 1,
2247
+ min: 0,
2248
+ step: 0.01,
2249
+ type: "number",
2250
+ visibleWhen: {
2251
+ equals: true,
2252
+ key: "bloomEnabled",
2253
+ },
2254
+ },
2255
+ {
2256
+ defaultValue: 8,
2257
+ group: "Bloom",
2258
+ key: "bloomRadius",
2259
+ label: "Radius",
2260
+ max: 24,
2261
+ min: 0,
2262
+ step: 0.25,
2263
+ type: "number",
2264
+ visibleWhen: {
2265
+ equals: true,
2266
+ key: "bloomEnabled",
2267
+ },
2268
+ },
2269
+ {
2270
+ defaultValue: 0.31,
2271
+ group: "Bloom",
2272
+ key: "bloomSoftness",
2273
+ label: "Softness",
2274
+ max: 1,
2275
+ min: 0,
2276
+ step: 0.01,
2277
+ type: "number",
2278
+ visibleWhen: {
2279
+ equals: true,
2280
+ key: "bloomEnabled",
2281
+ },
2282
+ },
2283
+ ] as const satisfies ParameterDefinitions
2284
+
2285
+ const blurParams = [
2286
+ {
2287
+ defaultValue: 8,
2288
+ key: "radius",
2289
+ label: "Radius",
2290
+ max: 64,
2291
+ min: 0,
2292
+ step: 1,
2293
+ type: "number",
2294
+ },
2295
+ {
2296
+ defaultValue: 2,
2297
+ key: "passes",
2298
+ label: "Passes",
2299
+ max: 8,
2300
+ min: 1,
2301
+ step: 1,
2302
+ type: "number",
2303
+ },
2304
+ ] as const satisfies ParameterDefinitions
2305
+
2306
+ const layerDefinitions: Record<LayerType, LayerDefinition> = {
2307
+ ascii: {
2308
+ defaultName: "ASCII",
2309
+ kind: "effect",
2310
+ params: asciiParams,
2311
+ type: "ascii",
2312
+ },
2313
+ blur: {
2314
+ defaultName: "Blur",
2315
+ kind: "effect",
2316
+ params: blurParams,
2317
+ type: "blur",
2318
+ },
2319
+ crt: {
2320
+ defaultName: "CRT",
2321
+ kind: "effect",
2322
+ params: crtParams,
2323
+ type: "crt",
2324
+ },
2325
+ dithering: {
2326
+ defaultName: "Dithering",
2327
+ kind: "effect",
2328
+ params: ditheringParams,
2329
+ type: "dithering",
2330
+ },
2331
+ fluid: {
2332
+ defaultName: "Fluid",
2333
+ kind: "source",
2334
+ params: fluidParams,
2335
+ type: "fluid",
2336
+ },
2337
+ gradient: {
2338
+ defaultName: "Gradient",
2339
+ kind: "source",
2340
+ params: gradientParams,
2341
+ type: "gradient",
2342
+ },
2343
+ ink: {
2344
+ defaultName: "Ink",
2345
+ kind: "effect",
2346
+ params: inkParams,
2347
+ type: "ink",
2348
+ },
2349
+ text: {
2350
+ defaultName: "Text",
2351
+ kind: "source",
2352
+ params: textParams,
2353
+ type: "text",
2354
+ },
2355
+ "custom-shader": {
2356
+ defaultName: "Custom Shader",
2357
+ kind: "source",
2358
+ params: customShaderParams,
2359
+ type: "custom-shader",
2360
+ },
2361
+ halftone: {
2362
+ defaultName: "Halftone",
2363
+ kind: "effect",
2364
+ params: halftoneParams,
2365
+ type: "halftone",
2366
+ },
2367
+ pattern: {
2368
+ defaultName: "Pattern",
2369
+ kind: "effect",
2370
+ params: patternParams,
2371
+ type: "pattern",
2372
+ },
2373
+ "particle-grid": {
2374
+ defaultName: "Particle Grid",
2375
+ kind: "effect",
2376
+ params: particleGridParams,
2377
+ type: "particle-grid",
2378
+ },
2379
+ image: {
2380
+ assetKind: "image",
2381
+ defaultName: "Image",
2382
+ kind: "source",
2383
+ params: imageParams,
2384
+ type: "image",
2385
+ },
2386
+ live: {
2387
+ defaultName: "Live Camera",
2388
+ kind: "source",
2389
+ params: liveParams,
2390
+ type: "live",
2391
+ },
2392
+ model: {
2393
+ assetKind: "model",
2394
+ defaultName: "3D Model",
2395
+ kind: "model",
2396
+ params: modelParams,
2397
+ type: "model",
2398
+ },
2399
+ "pixel-sorting": {
2400
+ defaultName: "Pixel Sorting",
2401
+ kind: "effect",
2402
+ params: pixelSortingParams,
2403
+ type: "pixel-sorting",
2404
+ },
2405
+ pixelation: {
2406
+ defaultName: "Pixelation",
2407
+ kind: "effect",
2408
+ params: pixelationParams,
2409
+ type: "pixelation",
2410
+ },
2411
+ video: {
2412
+ assetKind: "video",
2413
+ defaultName: "Video",
2414
+ kind: "source",
2415
+ params: videoParams,
2416
+ type: "video",
2417
+ },
2418
+ }
2419
+
2420
+ export const DEFAULT_SOURCE_LAYER_TYPE: SourceLayerType = "gradient"
2421
+ export const DEFAULT_EFFECT_LAYER_TYPE: EffectLayerType = "ascii"
2422
+ export const DEFAULT_MODEL_LAYER_TYPE: ModelLayerType = "model"
2423
+
2424
+ export function getLayerDefinition(type: LayerType): LayerDefinition {
2425
+ return layerDefinitions[type]
2426
+ }
2427
+
2428
+ export function getLayerDefinitions(): LayerDefinition[] {
2429
+ return Object.values(layerDefinitions)
2430
+ }
2431
+
2432
+ export function getLayerDefinitionsByKind(kind: LayerKind): LayerDefinition[] {
2433
+ return getLayerDefinitions().filter((definition) => definition.kind === kind)
2434
+ }