@remotion/effects 4.0.538 → 4.0.540

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 (209) hide show
  1. package/THIRD_PARTY_LICENSES.md +19 -0
  2. package/dist/barrel-distortion/webgpu-shader.d.ts +1 -0
  3. package/dist/bevel-alpha/webgpu-shaders.d.ts +2 -0
  4. package/dist/burlap-webgpu-shader.d.ts +1 -0
  5. package/dist/checkerboard-webgpu-shader.d.ts +1 -0
  6. package/dist/chromatic-aberration/webgpu-shader.d.ts +1 -0
  7. package/dist/color-correction-webgpu-shader-utils.d.ts +4 -0
  8. package/dist/color-key-webgpu-shader.d.ts +1 -0
  9. package/dist/color-matrix-runtime.d.ts +4 -0
  10. package/dist/contour-lines-webgpu-shader.d.ts +1 -0
  11. package/dist/corner-pin/webgpu-shader.d.ts +1 -0
  12. package/dist/curves.d.ts +65 -0
  13. package/dist/cylinder/webgl-shader.d.ts +1 -0
  14. package/dist/dot-grid-webgpu-shader.d.ts +1 -0
  15. package/dist/drop-shadow/webgpu-shaders.d.ts +2 -0
  16. package/dist/emboss-webgpu-shader.d.ts +1 -0
  17. package/dist/esm/barrel-distortion.mjs +67 -118
  18. package/dist/esm/bevel-alpha.mjs +247 -196
  19. package/dist/esm/blur.mjs +101 -115
  20. package/dist/esm/brightness.mjs +65 -132
  21. package/dist/esm/burlap.mjs +178 -151
  22. package/dist/esm/checkerboard.mjs +6 -514
  23. package/dist/esm/chromatic-aberration.mjs +72 -119
  24. package/dist/esm/color-correction.mjs +186 -224
  25. package/dist/esm/color-key.mjs +149 -136
  26. package/dist/esm/contour-lines.mjs +201 -160
  27. package/dist/esm/contrast.mjs +65 -132
  28. package/dist/esm/corner-pin.mjs +4 -390
  29. package/dist/esm/curves.mjs +357 -0
  30. package/dist/esm/cylinder.mjs +108 -225
  31. package/dist/esm/dot-grid.mjs +184 -213
  32. package/dist/esm/drop-shadow.mjs +162 -180
  33. package/dist/esm/duotone.mjs +110 -143
  34. package/dist/esm/emboss.mjs +153 -151
  35. package/dist/esm/evolve.mjs +228 -154
  36. package/dist/esm/exposure.mjs +93 -201
  37. package/dist/esm/film-burn.mjs +298 -0
  38. package/dist/esm/fisheye.mjs +97 -126
  39. package/dist/esm/flannel.mjs +158 -156
  40. package/dist/esm/fractal-noise.mjs +186 -232
  41. package/dist/esm/glow.mjs +164 -179
  42. package/dist/esm/grayscale.mjs +56 -122
  43. package/dist/esm/gridlines.mjs +6 -575
  44. package/dist/esm/halftone-linear-gradient.mjs +246 -245
  45. package/dist/esm/halftone.mjs +267 -243
  46. package/dist/esm/hue.mjs +55 -122
  47. package/dist/esm/index-00v3hr66.mjs +299 -0
  48. package/dist/esm/index-0w4eqht8.mjs +351 -0
  49. package/dist/esm/index-18y0zcy2.mjs +440 -0
  50. package/dist/esm/index-1m1b1ad7.mjs +520 -0
  51. package/dist/esm/index-34fxm3ax.mjs +518 -0
  52. package/dist/esm/index-4fvp93ps.mjs +32 -0
  53. package/dist/esm/index-4scpn12x.mjs +224 -0
  54. package/dist/esm/index-4z6pt3ka.mjs +104 -0
  55. package/dist/esm/index-618ky75w.mjs +51 -0
  56. package/dist/esm/index-6agxdrvr.mjs +411 -0
  57. package/dist/esm/index-6jkps947.mjs +120 -0
  58. package/dist/esm/index-8agtsbw4.mjs +617 -0
  59. package/dist/esm/index-8jx11jyn.mjs +29 -0
  60. package/dist/esm/index-8p04sssx.mjs +123 -0
  61. package/dist/esm/index-afdtmrh2.mjs +596 -0
  62. package/dist/esm/index-b86qstcs.mjs +18 -0
  63. package/dist/esm/index-cb77qg3g.mjs +587 -0
  64. package/dist/esm/index-cdp7tr8x.mjs +122 -0
  65. package/dist/esm/index-evy8hyah.mjs +55 -0
  66. package/dist/esm/index-gnsce796.mjs +6 -0
  67. package/dist/esm/index-kkvzt8b7.mjs +199 -0
  68. package/dist/esm/index-r0v18b2n.mjs +425 -0
  69. package/dist/esm/index-rswpzmm5.mjs +926 -0
  70. package/dist/esm/index-s9mrx750.mjs +97 -0
  71. package/dist/esm/index-tvfexb7s.mjs +164 -0
  72. package/dist/esm/index-vp56k1gj.mjs +215 -0
  73. package/dist/esm/index-wxhvgv2s.mjs +79 -0
  74. package/dist/esm/index-wy95a41r.mjs +407 -0
  75. package/dist/esm/index-ysnwfc4t.mjs +306 -0
  76. package/dist/esm/index.mjs +49 -4053
  77. package/dist/esm/invert.mjs +54 -122
  78. package/dist/esm/iris-wipe.mjs +315 -0
  79. package/dist/esm/lens-blur.mjs +169 -156
  80. package/dist/esm/levels.mjs +204 -151
  81. package/dist/esm/light-leak.mjs +6 -416
  82. package/dist/esm/light-trail.mjs +124 -128
  83. package/dist/esm/linear-gradient-tint.mjs +4 -424
  84. package/dist/esm/linear-gradient.mjs +4 -370
  85. package/dist/esm/linear-progressive-blur.mjs +92 -118
  86. package/dist/esm/linear-progressive-pixelate.mjs +83 -378
  87. package/dist/esm/lines.mjs +167 -162
  88. package/dist/esm/liquid-contours.mjs +192 -153
  89. package/dist/esm/long-shadows.mjs +278 -251
  90. package/dist/esm/lut.mjs +123 -23
  91. package/dist/esm/mirror.mjs +78 -120
  92. package/dist/esm/noise-displacement.mjs +156 -151
  93. package/dist/esm/noise.mjs +107 -143
  94. package/dist/esm/outline.mjs +192 -170
  95. package/dist/esm/page-turn.mjs +141 -244
  96. package/dist/esm/paper.mjs +522 -194
  97. package/dist/esm/pattern.mjs +4 -568
  98. package/dist/esm/pixel-dissolve.mjs +158 -186
  99. package/dist/esm/pixelate.mjs +92 -149
  100. package/dist/esm/radial-progressive-blur.mjs +96 -118
  101. package/dist/esm/radial-progressive-pixelate.mjs +91 -384
  102. package/dist/esm/radial-wipe.mjs +224 -0
  103. package/dist/esm/rain-fall.mjs +114 -0
  104. package/dist/esm/region-blur.mjs +138 -192
  105. package/dist/esm/rings.mjs +6 -512
  106. package/dist/esm/roughen-edges.mjs +180 -156
  107. package/dist/esm/saturation.mjs +56 -122
  108. package/dist/esm/scale.mjs +50 -60
  109. package/dist/esm/scanlines.mjs +115 -149
  110. package/dist/esm/shadows-highlights.mjs +103 -205
  111. package/dist/esm/shatter.mjs +868 -0
  112. package/dist/esm/shine.mjs +192 -227
  113. package/dist/esm/shrinkwrap.mjs +388 -225
  114. package/dist/esm/skew.mjs +100 -145
  115. package/dist/esm/snow-fall.mjs +170 -0
  116. package/dist/esm/speckle.mjs +192 -210
  117. package/dist/esm/sphere.mjs +101 -225
  118. package/dist/esm/starburst.mjs +6 -345
  119. package/dist/esm/tear.mjs +138 -155
  120. package/dist/esm/thermal-vision.mjs +135 -152
  121. package/dist/esm/tile.mjs +5 -184
  122. package/dist/esm/tint.mjs +80 -132
  123. package/dist/esm/translate.mjs +55 -137
  124. package/dist/esm/turbulent-displace.mjs +182 -221
  125. package/dist/esm/tv-signal-off.mjs +140 -149
  126. package/dist/esm/venetian-blinds.mjs +91 -140
  127. package/dist/esm/vibrance.mjs +95 -204
  128. package/dist/esm/vignette.mjs +136 -155
  129. package/dist/esm/wave.mjs +88 -47
  130. package/dist/esm/waves.mjs +181 -169
  131. package/dist/esm/white-balance.mjs +100 -204
  132. package/dist/esm/white-noise.mjs +98 -146
  133. package/dist/esm/zigzag.mjs +6 -575
  134. package/dist/esm/zoom-blur.mjs +90 -121
  135. package/dist/evolve.d.ts +46 -10
  136. package/dist/film-burn-webgpu-shader.d.ts +1 -0
  137. package/dist/film-burn.d.ts +40 -0
  138. package/dist/fisheye/webgpu-shader.d.ts +1 -0
  139. package/dist/flannel-webgpu-shader.d.ts +1 -0
  140. package/dist/fractal-noise/shader.d.ts +1 -1
  141. package/dist/fractal-noise/webgpu-shader.d.ts +1 -0
  142. package/dist/gaussian-blur-webgpu-shader.d.ts +1 -0
  143. package/dist/glow/webgpu-shaders.d.ts +2 -0
  144. package/dist/gridlines-webgpu-shader.d.ts +1 -0
  145. package/dist/halftone-linear-gradient-webgpu-shader.d.ts +1 -0
  146. package/dist/halftone-webgpu-shader.d.ts +1 -0
  147. package/dist/iris-wipe.d.ts +78 -0
  148. package/dist/lens-blur/webgpu-shader.d.ts +1 -0
  149. package/dist/levels.d.ts +69 -2
  150. package/dist/light-leak-webgpu-shader.d.ts +1 -0
  151. package/dist/light-trail/webgpu-shader.d.ts +1 -0
  152. package/dist/linear-gradient-tint-webgpu-shader.d.ts +1 -0
  153. package/dist/linear-gradient-webgpu-shader.d.ts +1 -0
  154. package/dist/lines-webgpu-shader.d.ts +1 -0
  155. package/dist/liquid-contours-webgpu-shader.d.ts +1 -0
  156. package/dist/long-shadows-webgpu-shaders.d.ts +2 -0
  157. package/dist/lut/webgpu-shader.d.ts +1 -0
  158. package/dist/mirror/webgpu-shader.d.ts +1 -0
  159. package/dist/noise-displacement-webgpu-shader.d.ts +1 -0
  160. package/dist/noise-webgpu-shader.d.ts +1 -0
  161. package/dist/outline/webgpu-shader.d.ts +1 -0
  162. package/dist/page-turn/webgl-shader.d.ts +1 -0
  163. package/dist/paper-webgpu-shader.d.ts +2 -0
  164. package/dist/pattern-webgpu-shader.d.ts +1 -0
  165. package/dist/pixel-dissolve-webgpu-shader.d.ts +1 -0
  166. package/dist/progressive-pixelate-runtime.d.ts +1 -0
  167. package/dist/radial-wipe.d.ts +19 -0
  168. package/dist/rain-fall.d.ts +143 -0
  169. package/dist/rect-transform-runtime.d.ts +11 -0
  170. package/dist/region-blur/webgpu-shader.d.ts +1 -0
  171. package/dist/rings-webgpu-shader.d.ts +1 -0
  172. package/dist/roughen-edges-webgpu-shader.d.ts +1 -0
  173. package/dist/shatter/geometry.d.ts +19 -0
  174. package/dist/shatter/index.d.ts +39 -0
  175. package/dist/shatter/runtime.d.ts +19 -0
  176. package/dist/shatter/webgpu-shader.d.ts +1 -0
  177. package/dist/shatter.d.ts +1 -0
  178. package/dist/shine-webgpu-shader.d.ts +1 -0
  179. package/dist/shrinkwrap-webgpu-shader.d.ts +1 -0
  180. package/dist/single-pass-runtime.d.ts +18 -0
  181. package/dist/skew-webgpu-shader.d.ts +1 -0
  182. package/dist/snow-fall.d.ts +208 -0
  183. package/dist/speckle-webgpu-shader.d.ts +1 -0
  184. package/dist/sphere/webgl-shader.d.ts +1 -0
  185. package/dist/starburst-webgpu-shader.d.ts +1 -0
  186. package/dist/tear-webgpu-shader.d.ts +1 -0
  187. package/dist/thermal-vision-webgpu-shader.d.ts +1 -0
  188. package/dist/tile-gpu-runtime.d.ts +24 -0
  189. package/dist/turbulent-displace/webgpu-shader.d.ts +1 -0
  190. package/dist/value-noise-webgpu-shader.d.ts +1 -0
  191. package/dist/vignette-webgpu-shader.d.ts +1 -0
  192. package/dist/wave/wave-runtime.d.ts +2 -1
  193. package/dist/wave/webgpu-shader.d.ts +1 -0
  194. package/dist/waves-webgpu-shader.d.ts +1 -0
  195. package/dist/weather/params.d.ts +149 -0
  196. package/dist/weather/runtime.d.ts +52 -0
  197. package/dist/weather/shaders.d.ts +4 -0
  198. package/dist/weather/webgpu-runtime.d.ts +36 -0
  199. package/dist/weather/webgpu-shader.d.ts +1 -0
  200. package/dist/webgl-projection-runtime.d.ts +18 -0
  201. package/dist/webgpu-color-state.d.ts +10 -0
  202. package/dist/webgpu-mesh-runtime.d.ts +46 -0
  203. package/dist/webgpu-multipass-runtime.d.ts +50 -0
  204. package/dist/webgpu-projection-runtime.d.ts +9 -5
  205. package/dist/webgpu-single-pass-runtime.d.ts +47 -0
  206. package/dist/white-noise-webgpu-shader.d.ts +1 -0
  207. package/dist/zigzag-webgpu-shader.d.ts +1 -0
  208. package/dist/zoom-blur/webgpu-shader.d.ts +1 -0
  209. package/package.json +59 -3
@@ -1,110 +1,47 @@
1
+ import {
2
+ assertOptionalFiniteNumber,
3
+ validateUnitInterval,
4
+ validateNonNegative
5
+ } from "./index-wxhvgv2s.mjs";
6
+ import {
7
+ WEBGPU_SINGLE_PASS_VERTEX,
8
+ setupWebGpuSinglePass,
9
+ cleanupWebGpuSinglePass,
10
+ applyWebGpuSinglePass
11
+ } from "./index-tvfexb7s.mjs";
12
+ import {
13
+ assertEffectParamsObject
14
+ } from "./index-4fvp93ps.mjs";
15
+
1
16
  // src/zoom-blur/index.ts
2
17
  import { Internals as Internals2 } from "remotion";
3
18
 
4
- // src/validate-effect-param.ts
5
- var assertEffectParamsObject = (params, effectLabel) => {
6
- if (params === null || typeof params !== "object") {
7
- throw new TypeError(`${effectLabel} effect requires a parameters object, but got ${JSON.stringify(params)}`);
8
- }
9
- };
10
- var assertRequiredFiniteNumber = (value, name) => {
11
- if (typeof value !== "number" || !Number.isFinite(value)) {
12
- throw new TypeError(`"${name}" must be a finite number, but got ${JSON.stringify(value)}`);
13
- }
14
- };
15
- var assertRequiredColor = (value, name) => {
16
- if (typeof value !== "string" || value.length === 0) {
17
- throw new TypeError(`"${name}" must be a non-empty string, but got ${JSON.stringify(value)}`);
19
+ // src/zoom-blur/webgpu-shader.ts
20
+ var ZOOM_BLUR_WEBGPU_SHADER = `
21
+ ${WEBGPU_SINGLE_PASS_VERTEX}
22
+ @group(0) @binding(0) var source: texture_2d<f32>;
23
+ @group(0) @binding(1) var sourceSampler: sampler;
24
+ @group(0) @binding(2) var<uniform> params: Params;
25
+ struct Params { resolutionAndCenter: vec4f, amountAndSamples: vec4f, }
26
+ @fragment fn fragment(input: VertexOutput) -> @location(0) vec4f {
27
+ let resolution = params.resolutionAndCenter.xy;
28
+ let center = vec2f(params.resolutionAndCenter.z, 1.0 - params.resolutionAndCenter.w);
29
+ let direction = input.uv - center;
30
+ let amount = params.amountAndSamples.x / min(resolution.x, resolution.y);
31
+ let samples = i32(params.amountAndSamples.y);
32
+ var color = vec4f(0);
33
+ var total = 0.0;
34
+ for (var i = 0; i < 64; i++) {
35
+ if (i >= samples) { break; }
36
+ let denominator = max(f32(samples - 1), 1.0);
37
+ let progress = f32(i) / denominator;
38
+ let uv = clamp(input.uv - direction * amount * progress, vec2f(0), vec2f(1));
39
+ color += textureSampleLevel(source, sourceSampler, uv, 0);
40
+ total += 1.0;
18
41
  }
19
- };
20
- var assertOptionalColor = (value, name) => {
21
- if (value === undefined) {
22
- return;
23
- }
24
- assertRequiredColor(value, name);
25
- };
26
- var assertOptionalBoolean = (value, name) => {
27
- if (value === undefined) {
28
- return;
29
- }
30
- if (typeof value !== "boolean") {
31
- throw new TypeError(`"${name}" must be a boolean, but got ${JSON.stringify(value)}`);
32
- }
33
- };
34
-
35
- // src/color-utils.ts
36
- var DEFAULT_AMOUNT = 1;
37
- var DEFAULT_BRIGHTNESS_AMOUNT = 0;
38
- var DEFAULT_HUE_DEGREES = 0;
39
- var colorAmountSchema = {
40
- type: "number",
41
- min: 0,
42
- max: 1,
43
- step: 0.01,
44
- default: DEFAULT_AMOUNT,
45
- description: "Amount",
46
- hiddenFromList: false
47
- };
48
- var colorMultiplierSchema = {
49
- type: "number",
50
- min: 0,
51
- step: 0.01,
52
- default: DEFAULT_AMOUNT,
53
- description: "Amount",
54
- hiddenFromList: false
55
- };
56
- var brightnessAmountSchema = {
57
- type: "number",
58
- min: -1,
59
- max: 1,
60
- step: 0.01,
61
- default: DEFAULT_BRIGHTNESS_AMOUNT,
62
- description: "Amount",
63
- hiddenFromList: false
64
- };
65
- var hueDegreesSchema = {
66
- type: "rotation-degrees",
67
- step: 1,
68
- default: DEFAULT_HUE_DEGREES,
69
- description: "Degrees"
70
- };
71
- var assertOptionalFiniteNumber = (value, name) => {
72
- if (value === undefined) {
73
- return;
74
- }
75
- assertRequiredFiniteNumber(value, name);
76
- };
77
- var validateUnitInterval = (value, name) => {
78
- if (value < 0) {
79
- throw new TypeError(`"${name}" must be >= 0, but got ${JSON.stringify(value)}`);
80
- }
81
- if (value > 1) {
82
- throw new TypeError(`"${name}" must be <= 1, but got ${JSON.stringify(value)}`);
83
- }
84
- };
85
- var validateNonNegative = (value, name) => {
86
- if (value < 0) {
87
- throw new TypeError(`"${name}" must be >= 0, but got ${JSON.stringify(value)}`);
88
- }
89
- };
90
- var validateSignedUnitInterval = (value, name) => {
91
- if (value < -1) {
92
- throw new TypeError(`"${name}" must be >= -1, but got ${JSON.stringify(value)}`);
93
- }
94
- if (value > 1) {
95
- throw new TypeError(`"${name}" must be <= 1, but got ${JSON.stringify(value)}`);
96
- }
97
- };
98
- var clampColorChannel = (value) => {
99
- return Math.max(0, Math.min(255, value));
100
- };
101
- var parseColorRgba = (ctx, color) => {
102
- ctx.clearRect(0, 0, 1, 1);
103
- ctx.fillStyle = color;
104
- ctx.fillRect(0, 0, 1, 1);
105
- const { data } = ctx.getImageData(0, 0, 1, 1);
106
- return [data[0], data[1], data[2], data[3]];
107
- };
42
+ return color / total;
43
+ }
44
+ `;
108
45
 
109
46
  // src/zoom-blur/zoom-blur-runtime.ts
110
47
  import { Internals } from "remotion";
@@ -319,7 +256,7 @@ var applyZoomBlur = ({
319
256
 
320
257
  // src/zoom-blur/index.ts
321
258
  var { createEffect } = Internals2;
322
- var DEFAULT_AMOUNT2 = 40;
259
+ var DEFAULT_AMOUNT = 40;
323
260
  var DEFAULT_CENTER = [0.5, 0.5];
324
261
  var DEFAULT_SAMPLES = 24;
325
262
  var MAX_SAMPLES = 64;
@@ -329,7 +266,7 @@ var zoomBlurSchema = {
329
266
  min: 0,
330
267
  max: 200,
331
268
  step: 1,
332
- default: DEFAULT_AMOUNT2,
269
+ default: DEFAULT_AMOUNT,
333
270
  description: "Amount",
334
271
  hiddenFromList: false
335
272
  },
@@ -351,7 +288,7 @@ var zoomBlurSchema = {
351
288
  }
352
289
  };
353
290
  var resolve = (params) => ({
354
- amount: params.amount ?? DEFAULT_AMOUNT2,
291
+ amount: params.amount ?? DEFAULT_AMOUNT,
355
292
  center: [...params.center ?? DEFAULT_CENTER],
356
293
  samples: params.samples ?? DEFAULT_SAMPLES
357
294
  });
@@ -392,26 +329,58 @@ var zoomBlur = createEffect({
392
329
  type: "remotion/zoom-blur",
393
330
  label: "zoomBlur()",
394
331
  documentationLink: "https://www.remotion.dev/docs/effects/zoom-blur",
395
- backend: "webgl2",
396
332
  calculateKey: (params) => {
397
333
  const r = resolve(params);
398
334
  return `zoom-blur-${r.amount}-${r.center[0]}-${r.center[1]}-${r.samples}`;
399
335
  },
400
- setup: (target) => setupZoomBlur(target),
401
- apply: ({ source, width, height, params, state, flipSourceY }) => {
402
- const r = resolve(params);
403
- applyZoomBlur({
404
- state,
405
- source,
406
- width,
407
- height,
408
- amount: r.amount,
409
- center: r.center,
410
- samples: r.samples,
411
- flipSourceY
412
- });
336
+ implementations: {
337
+ webgpu: Internals2.createEffectImplementation({
338
+ setup: (target) => setupWebGpuSinglePass(target, "zoom-blur"),
339
+ apply: ({ source, width, height, params, state, gpuDevice }) => {
340
+ if (!gpuDevice) {
341
+ throw new Error("A WebGPU device is required for the zoom-blur effect");
342
+ }
343
+ const r = resolve(params);
344
+ const uniformData = new Float32Array([
345
+ width,
346
+ height,
347
+ r.center[0],
348
+ r.center[1],
349
+ r.amount,
350
+ r.samples,
351
+ 0,
352
+ 0
353
+ ]);
354
+ applyWebGpuSinglePass({
355
+ state,
356
+ source,
357
+ width,
358
+ height,
359
+ device: gpuDevice,
360
+ shader: ZOOM_BLUR_WEBGPU_SHADER,
361
+ uniformData
362
+ });
363
+ },
364
+ cleanup: cleanupWebGpuSinglePass
365
+ }),
366
+ webgl2: Internals2.createEffectImplementation({
367
+ setup: (target) => setupZoomBlur(target),
368
+ apply: ({ source, width, height, params, state, flipSourceY }) => {
369
+ const r = resolve(params);
370
+ applyZoomBlur({
371
+ state,
372
+ source,
373
+ width,
374
+ height,
375
+ amount: r.amount,
376
+ center: r.center,
377
+ samples: r.samples,
378
+ flipSourceY
379
+ });
380
+ },
381
+ cleanup: (state) => cleanupZoomBlur(state)
382
+ })
413
383
  },
414
- cleanup: (state) => cleanupZoomBlur(state),
415
384
  schema: zoomBlurSchema,
416
385
  validateParams: validateZoomBlurParams
417
386
  });
package/dist/evolve.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- declare const EVOLVE_DIRECTIONS: readonly ['left', 'right', 'top', 'bottom'];
1
+ declare const EVOLVE_DIRECTIONS: readonly ['left', 'right', 'top', 'bottom', 'angle'];
2
+ declare const EVOLVE_FEATHER_UNITS: readonly ['relative', 'pixels'];
2
3
  export type EvolveDirection = (typeof EVOLVE_DIRECTIONS)[number];
4
+ export type EvolveFeatherUnit = (typeof EVOLVE_FEATHER_UNITS)[number];
3
5
  export declare const evolveSchema: {
4
6
  readonly progress: {
5
7
  readonly type: 'number';
@@ -17,18 +19,46 @@ export declare const evolveSchema: {
17
19
  readonly right: {};
18
20
  readonly top: {};
19
21
  readonly bottom: {};
22
+ readonly angle: {
23
+ readonly angle: {
24
+ readonly type: 'rotation-degrees';
25
+ readonly step: 1;
26
+ readonly default: 90;
27
+ readonly description: 'Angle';
28
+ };
29
+ };
20
30
  };
21
31
  readonly default: "left";
22
32
  readonly description: 'Direction';
23
33
  };
24
- readonly feather: {
25
- readonly type: 'number';
26
- readonly min: 0;
27
- readonly max: 1;
28
- readonly step: 0.01;
29
- readonly default: 0.1;
30
- readonly description: 'Feather';
31
- readonly hiddenFromList: false;
34
+ readonly featherUnit: {
35
+ readonly type: 'enum';
36
+ readonly variants: {
37
+ readonly relative: {
38
+ readonly feather: {
39
+ readonly type: 'number';
40
+ readonly min: 0;
41
+ readonly max: 1;
42
+ readonly step: 0.01;
43
+ readonly default: 0.1;
44
+ readonly description: 'Feather';
45
+ readonly hiddenFromList: false;
46
+ };
47
+ };
48
+ readonly pixels: {
49
+ readonly featherPixels: {
50
+ readonly type: 'number';
51
+ readonly min: 0;
52
+ readonly max: 500;
53
+ readonly step: 1;
54
+ readonly default: 0;
55
+ readonly description: 'Feather in pixels';
56
+ readonly hiddenFromList: false;
57
+ };
58
+ };
59
+ };
60
+ readonly default: "relative";
61
+ readonly description: 'Feather unit';
32
62
  };
33
63
  };
34
64
  export type EvolveParams = {
@@ -36,8 +66,14 @@ export type EvolveParams = {
36
66
  readonly progress?: number;
37
67
  /** Reveal direction. Defaults to `left`. */
38
68
  readonly direction?: EvolveDirection;
39
- /** Softness of the evolving edge from `0` (sharp) to `1` (fully feathered). Defaults to `0.1`. */
69
+ /** Relative softness from `0` (sharp) to `1` (fully feathered), used with `featherUnit: 'relative'`. Defaults to `0.1`. */
40
70
  readonly feather?: number;
71
+ /** Reveal travel direction in degrees clockwise from up, used with `direction: 'angle'`. Defaults to `90` (left to right). */
72
+ readonly angle?: number;
73
+ /** Use relative feathering or a pixel-wide linear edge. Defaults to `relative`. */
74
+ readonly featherUnit?: EvolveFeatherUnit;
75
+ /** Width of the soft edge in pixels when `featherUnit` is `pixels`. Defaults to `0`. */
76
+ readonly featherPixels?: number;
41
77
  };
42
78
  export declare const evolve: (params?: (EvolveParams & {
43
79
  readonly disabled?: boolean;
@@ -0,0 +1 @@
1
+ export declare const FILM_BURN_WEBGPU_SHADER = "\n\nstruct VertexOutput {\n\t@builtin(position) position: vec4f,\n\t@location(0) uv: vec2f,\n}\n\n@vertex fn vertex(@builtin(vertex_index) index: u32) -> VertexOutput {\n\tlet positions = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n\tlet position = positions[index];\n\tvar output: VertexOutput;\n\toutput.position = vec4f(position, 0, 1);\n\toutput.uv = vec2f(position.x * 0.5 + 0.5, 0.5 - position.y * 0.5);\n\treturn output;\n}\n\n@group(0) @binding(0) var source: texture_2d<f32>;\n@group(0) @binding(1) var sourceSampler: sampler;\n@group(0) @binding(2) var<uniform> params: Params;\n\nstruct Params { size: vec2f, progress: f32, seed: u32, center: vec2f, }\nfn lattice(point: vec3i, seed: u32) -> f32 {\n let p = bitcast<vec3u>(point);\n var h = (p.x * 0x27d4eb2du) ^ (p.y * 0x165667b1u) ^ (p.z * 0x9e3779b9u) ^ (seed * 0x85ebca6bu);\n h ^= h >> 15u; h *= 0x2c1b3c6du; h ^= h >> 12u; h *= 0x297a2d39u; h ^= h >> 15u;\n return f32(h & 65535u) / 65535.0;\n}\nfn valueNoise(point: vec3f, seed: u32) -> f32 {\n let cell = vec3i(floor(point));\n let t = fract(point);\n let fade = t * t * t * (t * (t * 6.0 - vec3f(15.0)) + vec3f(10.0));\n let lower = mix(mix(lattice(cell,seed),lattice(cell+vec3i(1,0,0),seed),fade.x),mix(lattice(cell+vec3i(0,1,0),seed),lattice(cell+vec3i(1,1,0),seed),fade.x),fade.y);\n let upper = mix(mix(lattice(cell+vec3i(0,0,1),seed),lattice(cell+vec3i(1,0,1),seed),fade.x),mix(lattice(cell+vec3i(0,1,1),seed),lattice(cell+vec3i(1,1,1),seed),fade.x),fade.y);\n return mix(lower,upper,fade.z);\n}\n@fragment fn fragment(input: VertexOutput) -> @location(0) vec4f {\n let color = textureSampleLevel(source,sourceSampler,input.uv,0);\n if (params.progress <= 0.0 || color.a == 0.0) { return color; }\n if (params.progress >= 1.0) { return vec4f(0); }\n let pixel = input.uv * params.size;\n let distanceFromCenter = length(pixel-params.center*params.size)/max(length(params.size),1.0);\n var noise = 0.0; var amplitude = 1.0; var frequency = 1.0;\n for(var octave=0;octave<4;octave++) {\n noise += valueNoise(vec3f(pixel/60.0*frequency,f32(octave)*7.31),params.seed+17u+u32(octave))*amplitude;\n amplitude *= 0.5; frequency *= 2.0;\n }\n noise /= 1.875;\n let field = noise*0.65+(1.0-min(distanceFromCenter,1.0))*0.35;\n let threshold = 1.0-params.progress*1.25;\n let band = 0.12*min(params.progress*10.0,1.0);\n if(field>threshold+band) { return vec4f(0); }\n if(field<=threshold-band*2.0) { return color; }\n let scorch = smoothstep(threshold-band*2.0,threshold,field);\n let hot = smoothstep(threshold,threshold+band,field);\n var rgb = color.rgb/color.a*(1.0-scorch*0.85);\n rgb = vec3f(rgb.r+(1.0-rgb.r)*hot*0.9,rgb.g+(0.45-rgb.g)*hot*0.9,rgb.b*(1.0-hot));\n let alpha = color.a*(1.0-hot*0.6);\n return vec4f(rgb*alpha,alpha);\n}\n\n";
@@ -0,0 +1,40 @@
1
+ export type FilmBurnParams = {
2
+ /** Burn progress from `0` (unchanged) to `1` (transparent). Defaults to `0`. */
3
+ readonly progress?: number;
4
+ /** Normalized burn center measured from the top-left corner. Defaults to `[0.5, 0.5]`. */
5
+ readonly center?: readonly [number, number];
6
+ /** Unsigned 32-bit integer seed for a repeatable burn pattern. Defaults to `0`. */
7
+ readonly seed?: number;
8
+ };
9
+ export declare const filmBurnSchema: {
10
+ readonly progress: {
11
+ readonly type: 'number';
12
+ readonly min: 0;
13
+ readonly max: 1;
14
+ readonly step: 0.01;
15
+ readonly default: 0;
16
+ readonly description: 'Progress';
17
+ readonly hiddenFromList: false;
18
+ };
19
+ readonly center: {
20
+ readonly type: 'uv-coordinate';
21
+ readonly min: 0;
22
+ readonly max: 1;
23
+ readonly step: 0.01;
24
+ readonly default: readonly [0.5, 0.5];
25
+ readonly description: 'Center';
26
+ };
27
+ readonly seed: {
28
+ readonly type: 'number';
29
+ readonly min: 0;
30
+ readonly max: 4294967295;
31
+ readonly step: 1;
32
+ readonly integer: true;
33
+ readonly default: 0;
34
+ readonly description: 'Seed';
35
+ readonly hiddenFromList: false;
36
+ };
37
+ };
38
+ export declare const filmBurn: (params?: (FilmBurnParams & {
39
+ readonly disabled?: boolean;
40
+ }) | undefined) => import("remotion").EffectDescriptor<unknown>;
@@ -0,0 +1 @@
1
+ export declare const FISHEYE_WEBGPU_SHADER = "\n\nstruct VertexOutput {\n\t@builtin(position) position: vec4f,\n\t@location(0) uv: vec2f,\n}\n\n@vertex fn vertex(@builtin(vertex_index) index: u32) -> VertexOutput {\n\tlet positions = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n\tlet position = positions[index];\n\tvar output: VertexOutput;\n\toutput.position = vec4f(position, 0, 1);\n\toutput.uv = vec2f(position.x * 0.5 + 0.5, 0.5 - position.y * 0.5);\n\treturn output;\n}\n\n@group(0) @binding(0) var source: texture_2d<f32>;\n@group(0) @binding(1) var sourceSampler: sampler;\n@group(0) @binding(2) var<uniform> params: Params;\nstruct Params { centerAndLens: vec4f, zoomAndAspect: vec4f, }\n@fragment fn fragment(input: VertexOutput) -> @location(0) vec4f {\n let center = params.centerAndLens.xy;\n let fieldOfView = params.centerAndLens.z;\n let radius = params.centerAndLens.w;\n let zoom = params.zoomAndAspect.x;\n let aspect = params.zoomAndAspect.y;\n let toCenter = input.uv - center;\n let corrected = vec2f(toCenter.x * aspect, toCenter.y);\n let dist = length(corrected);\n let r = dist / max(radius, 0.0001);\n if (r > 1.0 || fieldOfView <= 0.0001) {\n return textureSampleLevel(source, sourceSampler, input.uv, 0);\n }\n let halfFov = fieldOfView * 0.5;\n let warped = tan(r * halfFov) / tan(halfFov);\n var scale = 0.0;\n if (dist > 0.00001) { scale = warped * radius / dist; }\n let warpedAspect = corrected * scale;\n let offset = vec2f(warpedAspect.x / aspect, warpedAspect.y) / max(zoom, 0.0001);\n let uv = center + offset;\n if (any(uv < vec2f(0)) || any(uv > vec2f(1))) { return vec4f(0); }\n return textureSampleLevel(source, sourceSampler, uv, 0);\n}\n";
@@ -0,0 +1 @@
1
+ export declare const FLANNEL_WEBGPU_SHADER = "\n\nstruct VertexOutput {\n\t@builtin(position) position: vec4f,\n\t@location(0) uv: vec2f,\n}\n\n@vertex fn vertex(@builtin(vertex_index) index: u32) -> VertexOutput {\n\tlet positions = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n\tlet position = positions[index];\n\tvar output: VertexOutput;\n\toutput.position = vec4f(position, 0, 1);\n\toutput.uv = vec2f(position.x * 0.5 + 0.5, 0.5 - position.y * 0.5);\n\treturn output;\n}\n\n@group(0) @binding(0) var sourceTexture: texture_2d<f32>;\n@group(0) @binding(1) var sourceSampler: sampler;\n@group(0) @binding(2) var<uniform> params: Params;\nstruct Params {\n geometry: vec4f,\n values: vec4f,\n base: vec4f,\n stripe: vec4f,\n}\nfn sampleSource(uv: vec2f) -> vec4f {\n return textureSampleLevel(sourceTexture, sourceSampler, vec2f(uv.x, 1.0 - uv.y), 0);\n}\nfn stripe(coordinate: f32, center: f32, width: f32, softness: f32) -> f32 {\n let distanceFromCenter = abs(fract(coordinate) - center);\n let halfWidth = width * 0.5;\n return 1.0 - smoothstep(halfWidth, halfWidth + softness, distanceFromCenter);\n}\n@fragment fn fragment(input: VertexOutput) -> @location(0) vec4f {\n let vUv = vec2f(input.uv.x, 1.0 - input.uv.y);\n\n let source = sampleSource(vUv);\n if (source.a <= 0.001 || params.geometry.z <= 0.0) { return source; }\n let pixel = vec2f(input.position.x, params.geometry.y - input.position.y);\n let plaid = pixel / max(params.geometry.w, 0.001);\n let edge = mix(0.002, 0.08, params.values.x);\n let verticalWide = stripe(plaid.x, 0.5, 0.34, edge);\n let horizontalWide = stripe(plaid.y, 0.5, 0.34, edge);\n let verticalFine = stripe(plaid.x * 2.0, 0.5, 0.07, edge * 0.5);\n let horizontalFine = stripe(plaid.y * 2.0, 0.5, 0.07, edge * 0.5);\n let bands = max(max(verticalWide, horizontalWide), max(verticalFine, horizontalFine) * 0.72);\n let crossing = max(verticalWide * horizontalWide, verticalFine * horizontalFine);\n let threadX = 0.5 + 0.5 * sin(pixel.x * 3.14159265);\n let threadY = 0.5 + 0.5 * sin(pixel.y * 3.14159265);\n let weave = (threadX - 0.5) * (threadY - 0.5) * 0.12;\n let sourceRgb = source.rgb / source.a;\n let luminance = dot(sourceRgb, vec3f(0.2126, 0.7152, 0.0722));\n var plaidColor = mix(params.base.rgb, params.stripe.rgb, bands * params.stripe.a);\n plaidColor = mix(plaidColor, params.stripe.rgb * 0.72, crossing * params.stripe.a);\n plaidColor *= mix(0.58, 1.18, luminance) + weave;\n let result = mix(sourceRgb, clamp(plaidColor, vec3f(0), vec3f(1)), params.geometry.z);\n return vec4f(result * source.a, source.a);\n\n}\n";
@@ -1 +1 @@
1
- export declare const FRACTAL_NOISE_FRAGMENT_SHADER = "#version 300 es\nprecision highp float;\nprecision highp int;\n\nin vec2 vUv;\nout vec4 fragColor;\nuniform sampler2D uSource;\nuniform vec2 uResolution;\nuniform vec2 uOffset;\nuniform float uScale;\nuniform float uComplexity;\nuniform float uEvolution;\nuniform float uSubInfluence;\nuniform float uSubScaling;\nuniform float uContrast;\nuniform float uBrightness;\nuniform float uAmount;\nuniform float uCycle;\nuniform uint uSeed;\nuniform int uFractalType;\nuniform int uNoiseType;\nuniform bool uInvert;\nuniform bool uCycleEvolution;\n\n\nfloat lattice(ivec3 point, uint seed) {\n // Wrap lattice indices as well as coordinates so interpolation stays continuous\n // across the period boundary, including negative coordinates.\n uvec3 p = uvec3(point) & uvec3(65535u);\n uint h = p.x * 0x27d4eb2du ^ p.y * 0x165667b1u ^ p.z * 0x9e3779b9u ^ seed * 0x85ebca6bu;\n h ^= h >> 15;\n h *= 0x2c1b3c6du;\n h ^= h >> 12;\n h *= 0x297a2d39u;\n h ^= h >> 15;\n return float(h & 65535u) / 65535.0;\n}\n\nfloat catmull(vec4 p, float t) {\n return 0.5 * (2.0 * p.y + (p.z - p.x) * t\n + (2.0 * p.x - 5.0 * p.y + 4.0 * p.z - p.w) * t * t\n + (3.0 * p.y - p.x - 3.0 * p.z + p.w) * t * t * t);\n}\n\nvec3 bspline(float t) {\n return vec3(0.5 * (1.0-t) * (1.0-t), 0.5 + t * (1.0-t), 0.5 * t * t);\n}\n\nfloat sliceNoise(ivec3 p, vec2 t, uint seed) {\n if (uNoiseType == 0) return lattice(p, seed);\n if (uNoiseType == 1) {\n return mix(mix(lattice(p, seed), lattice(p + ivec3(1,0,0), seed), t.x),\n mix(lattice(p + ivec3(0,1,0), seed), lattice(p + ivec3(1,1,0), seed), t.x), t.y);\n }\n if (uNoiseType == 2) {\n vec3 wx = bspline(t.x);\n vec3 wy = bspline(t.y);\n float result = 0.0;\n for (int y = 0; y < 3; y++) {\n for (int x = 0; x < 3; x++) {\n result += wx[x] * wy[y] * lattice(p + ivec3(x-1, y-1, 0), seed);\n }\n }\n return result;\n }\n vec4 rows;\n for (int y = 0; y < 4; y++) {\n vec4 row;\n for (int x = 0; x < 4; x++) {\n row[x] = lattice(p + ivec3(x-1, y-1, 0), seed);\n }\n rows[y] = catmull(row, t.x);\n }\n return catmull(rows, t.y);\n}\n\nfloat valueNoise(vec3 point, uint seed) {\n // A large period keeps conversion to integer coordinates defined at extreme scales.\n vec3 p = mod(point + vec3(uNoiseType == 2 ? 0.5 : 0.0, uNoiseType == 2 ? 0.5 : 0.0, 0.0), 65536.0);\n ivec3 cell = ivec3(floor(p));\n vec3 t = fract(p);\n float fz = t.z * t.z * t.z * (t.z * (t.z * 6.0 - 15.0) + 10.0);\n float n = mix(sliceNoise(cell, t.xy, seed), sliceNoise(cell + ivec3(0,0,1), t.xy, seed), fz);\n return uNoiseType == 2 ? 0.5 + (n - 0.5) * (181.0 / 231.0) / 0.55 : n;\n}\n\n\nfloat layer(vec2 p, float z, uint seed) {\n if (!uCycleEvolution) return valueNoise(vec3(p, uEvolution + z), seed);\n float t = mod(uEvolution, uCycle);\n return mix(valueNoise(vec3(p, t + z), seed), valueNoise(vec3(p, t - uCycle + z), seed), t / uCycle);\n}\n\nfloat shape(float n) {\n float s = 2.0 * n - 1.0;\n if (uFractalType == 1) return 1.0 - s * s;\n if (uFractalType == 2) return 1.0 - abs(s);\n if (uFractalType == 3) return (1.0 - abs(s)) * (1.0 - abs(s));\n if (uFractalType == 8) {\n float distance = clamp(abs(s) / 0.12, 0.0, 1.0);\n return 1.0 - distance * distance;\n }\n return n;\n}\n\nvoid main() {\n vec4 source = texture(uSource, vUv);\n if (source.a == 0.0 || uAmount == 0.0) {\n fragColor = source;\n return;\n }\n vec2 pixel = vec2(vUv.x, 1.0 - vUv.y) * uResolution;\n vec2 base = (pixel - uResolution * 0.5 - uOffset) / uScale;\n float sum = 0.0;\n float norm = 0.0;\n float amplitude = 1.0;\n float frequency = 1.0;\n float best = 0.0;\n for (int octave = 0; octave < 20; octave++) {\n float weight = clamp(uComplexity - float(octave), 0.0, 1.0);\n if (weight == 0.0 || amplitude == 0.0) break;\n vec2 p = base * frequency;\n float z = float(octave) * 7.31;\n uint seed = (uSeed ^ 0x51edu) + uint(octave);\n if (uFractalType >= 4 && uFractalType <= 6) {\n float a = layer(p * 0.5, z + 3.1, seed ^ 0x55u) - 0.5;\n if (uFractalType == 5) {\n float angle = a * 3.0;\n p = mat2(cos(angle), sin(angle), -sin(angle), cos(angle)) * p;\n } else {\n float b = layer(p * 0.5, z + 5.7, seed ^ 0xaau) - 0.5;\n float strength = uFractalType == 6 ? 0.5 + float(octave) * 0.35 : 1.0;\n p += vec2(a, b) * 1.5 * strength;\n }\n }\n float n = shape(layer(p, z, seed));\n // Fade fractional octaves in for Max too, so animating complexity is continuous.\n best = max(best, n * amplitude * weight);\n sum += n * amplitude * weight;\n norm += amplitude * weight;\n amplitude *= uSubInfluence;\n frequency /= uSubScaling;\n }\n float noise = uFractalType == 7 ? best : sum / norm;\n noise = clamp((noise - 0.5) * uContrast + 0.5 + uBrightness, 0.0, 1.0);\n if (uInvert) noise = 1.0 - noise;\n fragColor = vec4(mix(source.rgb, vec3(noise) * source.a, uAmount), source.a);\n}\n";
1
+ export declare const FRACTAL_NOISE_FRAGMENT_SHADER = "#version 300 es\nprecision highp float;\nprecision highp int;\n\nin vec2 vUv;\nout vec4 fragColor;\nuniform sampler2D uSource;\nuniform vec2 uResolution;\nuniform vec2 uOffset;\nuniform float uScale;\nuniform float uComplexity;\nuniform float uEvolution;\nuniform float uSubInfluence;\nuniform float uSubScaling;\nuniform float uContrast;\nuniform float uBrightness;\nuniform float uAmount;\nuniform float uCycle;\nuniform uint uSeed;\nuniform int uFractalType;\nuniform int uNoiseType;\nuniform bool uInvert;\nuniform bool uCycleEvolution;\n\n\nfloat lattice(ivec3 point, uint seed) {\n // Wrap lattice indices as well as coordinates so interpolation stays continuous\n // across the period boundary, including negative coordinates.\n uvec3 p = uvec3(point) & uvec3(65535u);\n uint h = p.x * 0x27d4eb2du ^ p.y * 0x165667b1u ^ p.z * 0x9e3779b9u ^ seed * 0x85ebca6bu;\n h ^= h >> 15;\n h *= 0x2c1b3c6du;\n h ^= h >> 12;\n h *= 0x297a2d39u;\n h ^= h >> 15;\n return float(h & 65535u) / 65535.0;\n}\n\nfloat catmull(vec4 p, float t) {\n return 0.5 * (2.0 * p.y + (p.z - p.x) * t\n + (2.0 * p.x - 5.0 * p.y + 4.0 * p.z - p.w) * t * t\n + (3.0 * p.y - p.x - 3.0 * p.z + p.w) * t * t * t);\n}\n\nvec3 bspline(float t) {\n return vec3(0.5 * (1.0-t) * (1.0-t), 0.5 + t * (1.0-t), 0.5 * t * t);\n}\n\nfloat sliceNoise(ivec3 p, vec2 t, uint seed) {\n if (uNoiseType == 0) return lattice(p, seed);\n if (uNoiseType == 1) {\n return mix(mix(lattice(p, seed), lattice(p + ivec3(1,0,0), seed), t.x),\n mix(lattice(p + ivec3(0,1,0), seed), lattice(p + ivec3(1,1,0), seed), t.x), t.y);\n }\n if (uNoiseType == 2) {\n vec3 wx = bspline(t.x);\n vec3 wy = bspline(t.y);\n float result = 0.0;\n for (int y = 0; y < 3; y++) {\n for (int x = 0; x < 3; x++) {\n result += wx[x] * wy[y] * lattice(p + ivec3(x-1, y-1, 0), seed);\n }\n }\n return result;\n }\n vec4 rows;\n for (int y = 0; y < 4; y++) {\n vec4 row;\n for (int x = 0; x < 4; x++) {\n row[x] = lattice(p + ivec3(x-1, y-1, 0), seed);\n }\n rows[y] = catmull(row, t.x);\n }\n return catmull(rows, t.y);\n}\n\nfloat valueNoise(vec3 point, uint seed) {\n // A large period keeps conversion to integer coordinates defined at extreme scales.\n vec3 p = mod(point + vec3(uNoiseType == 2 ? 0.5 : 0.0, uNoiseType == 2 ? 0.5 : 0.0, 0.0), 65536.0);\n ivec3 cell = ivec3(floor(p));\n vec3 t = fract(p);\n float fz = t.z * t.z * t.z * (t.z * (t.z * 6.0 - 15.0) + 10.0);\n float n = mix(sliceNoise(cell, t.xy, seed), sliceNoise(cell + ivec3(0,0,1), t.xy, seed), fz);\n return uNoiseType == 2 ? 0.5 + (n - 0.5) * (181.0 / 231.0) / 0.55 : n;\n}\n\n\nfloat layer(vec2 p, float z, uint seed) {\n if (!uCycleEvolution) return valueNoise(vec3(p, uEvolution + z), seed);\n float t = mod(uEvolution, uCycle);\n return mix(valueNoise(vec3(p, t + z), seed), valueNoise(vec3(p, t - uCycle + z), seed), t / uCycle);\n}\n\nfloat shape(float n) {\n float s = 2.0 * n - 1.0;\n if (uFractalType == 1) return 1.0 - s * s;\n if (uFractalType == 2) return 1.0 - abs(s);\n if (uFractalType == 3) return (1.0 - abs(s)) * (1.0 - abs(s));\n if (uFractalType == 8) {\n float distance = clamp(abs(s) / 0.12, 0.0, 1.0);\n return 1.0 - distance * distance;\n }\n return n;\n}\n\nvoid main() {\n vec4 source = texture(uSource, vUv);\n if (source.a == 0.0 || uAmount == 0.0) {\n fragColor = source;\n return;\n }\n // Use exact pixel centers so block noise stays stable at cell boundaries.\n vec2 pixel = vec2(gl_FragCoord.x, uResolution.y - gl_FragCoord.y);\n vec2 base = (pixel - uResolution * 0.5 - uOffset) / uScale;\n float sum = 0.0;\n float norm = 0.0;\n float amplitude = 1.0;\n float frequency = 1.0;\n float best = 0.0;\n for (int octave = 0; octave < 20; octave++) {\n float weight = clamp(uComplexity - float(octave), 0.0, 1.0);\n if (weight == 0.0 || amplitude == 0.0) break;\n vec2 p = base * frequency;\n float z = float(octave) * 7.31;\n uint seed = (uSeed ^ 0x51edu) + uint(octave);\n if (uFractalType >= 4 && uFractalType <= 6) {\n float a = layer(p * 0.5, z + 3.1, seed ^ 0x55u) - 0.5;\n if (uFractalType == 5) {\n float angle = a * 3.0;\n p = mat2(cos(angle), sin(angle), -sin(angle), cos(angle)) * p;\n } else {\n float b = layer(p * 0.5, z + 5.7, seed ^ 0xaau) - 0.5;\n float strength = uFractalType == 6 ? 0.5 + float(octave) * 0.35 : 1.0;\n p += vec2(a, b) * 1.5 * strength;\n }\n }\n float n = shape(layer(p, z, seed));\n // Fade fractional octaves in for Max too, so animating complexity is continuous.\n best = max(best, n * amplitude * weight);\n sum += n * amplitude * weight;\n norm += amplitude * weight;\n amplitude *= uSubInfluence;\n frequency /= uSubScaling;\n }\n float noise = uFractalType == 7 ? best : sum / norm;\n noise = clamp((noise - 0.5) * uContrast + 0.5 + uBrightness, 0.0, 1.0);\n if (uInvert) noise = 1.0 - noise;\n fragColor = vec4(mix(source.rgb, vec3(noise) * source.a, uAmount), source.a);\n}\n";
@@ -0,0 +1 @@
1
+ export declare const FRACTAL_NOISE_WEBGPU_SHADER = "\n\nstruct VertexOutput {\n\t@builtin(position) position: vec4f,\n\t@location(0) uv: vec2f,\n}\n\n@vertex fn vertex(@builtin(vertex_index) index: u32) -> VertexOutput {\n\tlet positions = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n\tlet position = positions[index];\n\tvar output: VertexOutput;\n\toutput.position = vec4f(position, 0, 1);\n\toutput.uv = vec2f(position.x * 0.5 + 0.5, 0.5 - position.y * 0.5);\n\treturn output;\n}\n\n@group(0) @binding(0) var source: texture_2d<f32>;\n@group(0) @binding(1) var sourceSampler: sampler;\n@group(0) @binding(2) var<uniform> params: Params;\n\nstruct Params { size: vec2f, offset: vec2f, scale: f32, complexity: f32, evolution: f32, subInfluence: f32, subScaling: f32, contrast: f32, brightness: f32, amount: f32, cycle: f32, seed: u32, fractalType: f32, noiseType: f32, invert: f32, cycleEvolution: f32, }\nfn noiseType() -> i32 { return i32(params.noiseType); }\n\nfn lattice(point: vec3i, seed: u32) -> f32 {\n let p = bitcast<vec3u>(point) & vec3u(65535u);\n var h = (p.x*0x27d4eb2du) ^ (p.y*0x165667b1u) ^ (p.z*0x9e3779b9u) ^ (seed*0x85ebca6bu);\n h ^= h >> 15u; h *= 0x2c1b3c6du; h ^= h >> 12u; h *= 0x297a2d39u; h ^= h >> 15u;\n return f32(h & 65535u)/65535.0;\n}\nfn catmull(p: vec4f, t: f32) -> f32 {\n return 0.5*(2.0*p.y+(p.z-p.x)*t+(2.0*p.x-5.0*p.y+4.0*p.z-p.w)*t*t+(3.0*p.y-p.x-3.0*p.z+p.w)*t*t*t);\n}\nfn bspline(t: f32) -> vec3f { return vec3f(0.5*(1.0-t)*(1.0-t),0.5+t*(1.0-t),0.5*t*t); }\nfn sliceNoise(p: vec3i,t: vec2f,seed: u32) -> f32 {\n if(noiseType()==0) { return lattice(p,seed); }\n if(noiseType()==1) { return mix(mix(lattice(p,seed),lattice(p+vec3i(1,0,0),seed),t.x),mix(lattice(p+vec3i(0,1,0),seed),lattice(p+vec3i(1,1,0),seed),t.x),t.y); }\n if(noiseType()==2) {\n let wx=bspline(t.x); let wy=bspline(t.y); var result=0.0;\n for(var y=0;y<3;y++) { for(var x=0;x<3;x++) { result += wx[x]*wy[y]*lattice(p+vec3i(x-1,y-1,0),seed); } }\n return result;\n }\n var rows: vec4f;\n for(var y=0;y<4;y++) {\n var row: vec4f;\n for(var x=0;x<4;x++) { row[x]=lattice(p+vec3i(x-1,y-1,0),seed); }\n rows[y]=catmull(row,t.x);\n }\n return catmull(rows,t.y);\n}\nfn valueNoise(point: vec3f,seed: u32) -> f32 {\n let offset=select(0.0,0.5,noiseType()==2);\n let shifted=point+vec3f(offset,offset,0.0);\n let p=shifted-floor(shifted/65536.0)*65536.0;\n let cell=vec3i(floor(p)); let t=fract(p);\n let fz=t.z*t.z*t.z*(t.z*(t.z*6.0-15.0)+10.0);\n let n=mix(sliceNoise(cell,t.xy,seed),sliceNoise(cell+vec3i(0,0,1),t.xy,seed),fz);\n return select(n,0.5+(n-0.5)*(181.0/231.0)/0.55,noiseType()==2);\n}\n\nfn layer(p: vec2f,z: f32,seed: u32) -> f32 {\n if(params.cycleEvolution==0.0) { return valueNoise(vec3f(p,params.evolution+z),seed); }\n let t=params.evolution-floor(params.evolution/params.cycle)*params.cycle;\n return mix(valueNoise(vec3f(p,t+z),seed),valueNoise(vec3f(p,t-params.cycle+z),seed),t/params.cycle);\n}\nfn shape(n: f32) -> f32 {\n let s=2.0*n-1.0;\n if(params.fractalType==1.0) { return 1.0-s*s; }\n if(params.fractalType==2.0) { return 1.0-abs(s); }\n if(params.fractalType==3.0) { return (1.0-abs(s))*(1.0-abs(s)); }\n if(params.fractalType==8.0) { let distance=clamp(abs(s)/0.12,0.0,1.0); return 1.0-distance*distance; }\n return n;\n}\n@fragment fn fragment(input: VertexOutput) -> @location(0) vec4f {\n let color=textureSampleLevel(source,sourceSampler,input.uv,0);\n if(color.a==0.0 || params.amount==0.0) { return color; }\n let pixel=input.position.xy;\n let base=(pixel-params.size*0.5-params.offset)/params.scale;\n var sum=0.0; var norm=0.0; var amplitude=1.0; var frequency=1.0; var best=0.0;\n for(var octave=0;octave<20;octave++) {\n let weight=clamp(params.complexity-f32(octave),0.0,1.0);\n if(weight==0.0 || amplitude==0.0) { break; }\n var p=base*frequency;\n let z=f32(octave)*7.31;\n let seed=(params.seed ^ 0x51edu)+u32(octave);\n if(params.fractalType>=4.0 && params.fractalType<=6.0) {\n let a=layer(p*0.5,z+3.1,seed ^ 0x55u)-0.5;\n if(params.fractalType==5.0) {\n let angle=a*3.0;\n p=mat2x2f(vec2f(cos(angle),sin(angle)),vec2f(-sin(angle),cos(angle)))*p;\n } else {\n let b=layer(p*0.5,z+5.7,seed ^ 0xaau)-0.5;\n let strength=select(1.0,0.5+f32(octave)*0.35,params.fractalType==6.0);\n p += vec2f(a,b)*1.5*strength;\n }\n }\n let n=shape(layer(p,z,seed));\n best=max(best,n*amplitude*weight); sum += n*amplitude*weight; norm += amplitude*weight;\n amplitude *= params.subInfluence; frequency /= params.subScaling;\n }\n var noise=select(sum/norm,best,params.fractalType==7.0);\n noise=clamp((noise-0.5)*params.contrast+0.5+params.brightness,0.0,1.0);\n if(params.invert!=0.0) { noise=1.0-noise; }\n return vec4f(mix(color.rgb,vec3f(noise)*color.a,params.amount),color.a);\n}\n\n";
@@ -0,0 +1 @@
1
+ export declare const GAUSSIAN_BLUR_WEBGPU_SHADER = "\n\n\nstruct VertexOutput {\n\t@builtin(position) position: vec4f,\n\t@location(0) uv: vec2f,\n}\n\n@vertex fn vertex(@builtin(vertex_index) index: u32) -> VertexOutput {\n\tlet positions = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n\tlet position = positions[index];\n\tvar output: VertexOutput;\n\toutput.position = vec4f(position, 0, 1);\n\toutput.uv = vec2f(position.x * 0.5 + 0.5, 0.5 - position.y * 0.5);\n\treturn output;\n}\n\n@group(0) @binding(0) var source: texture_2d<f32>;\n@group(0) @binding(1) var sourceSampler: sampler;\n@group(0) @binding(2) var<uniform> params: Params;\n@group(0) @binding(3) var secondary: texture_2d<f32>;\n\nstruct Params { resolution: vec2f, direction: vec2f, values: vec4f, startEnd: vec4f, radial: vec4f, }\nfn radiusAt(uv: vec2f) -> f32 {\n let mode = params.values.y;\n if (mode == 0.0) {return params.values.x;}\n if (mode == 1.0) {\n let gradient = params.startEnd.zw - params.startEnd.xy;\n let lengthSq = dot(gradient, gradient);\n if (lengthSq <= 0.0000001) {return max(0.0, params.values.z);}\n let progress = clamp(dot(uv - params.startEnd.xy, gradient) / lengthSq, 0.0, 1.0);\n return max(0.0, mix(params.values.z, params.values.w, progress));\n }\n let radii = params.startEnd.zw * params.resolution * 0.5;\n if (radii.x <= 0.0000001 || radii.y <= 0.0000001) {return max(0.0, params.values.z);}\n let delta = (uv - params.startEnd.xy) * params.resolution;\n let angle = radians(params.radial.x);\n let c = cos(angle); let s = sin(angle);\n let local = vec2f(c * delta.x + s * delta.y, -s * delta.x + c * delta.y);\n let ellipseProgress = clamp(length(local / radii), 0.0, 1.0);\n let distance = 1.0 - params.radial.y;\n var progress = step(params.radial.y, ellipseProgress);\n if (abs(distance) > 0.0000001) {progress = clamp((ellipseProgress - params.radial.y) / distance, 0.0, 1.0);}\n return max(0.0, mix(params.values.z, params.values.w, progress));\n}\n@fragment fn fragment(input: VertexOutput) -> @location(0) vec4f {\n let radius = radiusAt(input.uv);\n if (radius <= 0.0) {return textureSampleLevel(source, sourceSampler, input.uv, 0);}\n let halfKernel = i32(clamp(ceil(radius / 2.0), 4.0, 32.0));\n let stride = radius / f32(halfKernel);\n let sigma = select(max(radius / 3.0, 0.0001), radius / 3.0, params.values.y == 0.0);\n let twoSigmaSq = 2.0 * sigma * sigma;\n var sum = vec4f(0); var weightSum = 0.0;\n for (var i = -32; i <= 32; i++) {\n if (abs(i) > halfKernel) {continue;}\n let offset = f32(i) * stride;\n let weight = exp(-(offset * offset) / twoSigmaSq);\n let uv = input.uv + params.direction / params.resolution * offset;\n sum += textureSampleLevel(source, sourceSampler, uv, 0) * weight;\n weightSum += weight;\n }\n return sum / weightSum;\n}\n";
@@ -0,0 +1,2 @@
1
+ export declare const GLOW_EXTRACT_WEBGPU_SHADER = "\n\n\nstruct VertexOutput {\n\t@builtin(position) position: vec4f,\n\t@location(0) uv: vec2f,\n}\n\n@vertex fn vertex(@builtin(vertex_index) index: u32) -> VertexOutput {\n\tlet positions = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n\tlet position = positions[index];\n\tvar output: VertexOutput;\n\toutput.position = vec4f(position, 0, 1);\n\toutput.uv = vec2f(position.x * 0.5 + 0.5, 0.5 - position.y * 0.5);\n\treturn output;\n}\n\n@group(0) @binding(0) var source: texture_2d<f32>;\n@group(0) @binding(1) var sourceSampler: sampler;\n@group(0) @binding(2) var<uniform> params: Params;\n@group(0) @binding(3) var secondary: texture_2d<f32>;\n\nstruct Params {color: vec4f, values: vec4f,}\n@fragment fn fragment(input: VertexOutput) -> @location(0) vec4f {\n let color = textureSampleLevel(source, sourceSampler, input.uv, 0);\n if (color.a <= 0.001) {return vec4f(0);}\n let luminance = dot(color.rgb/color.a, vec3f(0.299,0.587,0.114));\n let threshold = clamp(params.values.x,0.0,1.0);\n var contribution = step(1.0,luminance);\n if (threshold < 1.0) {contribution=clamp((luminance-threshold)/max(1.0-threshold,0.0001),0.0,1.0);}\n let alpha=color.a*contribution*params.color.a;\n return vec4f(params.color.rgb*alpha,alpha);\n}\n";
2
+ export declare const GLOW_COMPOSITE_WEBGPU_SHADER = "\n\n\nstruct VertexOutput {\n\t@builtin(position) position: vec4f,\n\t@location(0) uv: vec2f,\n}\n\n@vertex fn vertex(@builtin(vertex_index) index: u32) -> VertexOutput {\n\tlet positions = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n\tlet position = positions[index];\n\tvar output: VertexOutput;\n\toutput.position = vec4f(position, 0, 1);\n\toutput.uv = vec2f(position.x * 0.5 + 0.5, 0.5 - position.y * 0.5);\n\treturn output;\n}\n\n@group(0) @binding(0) var source: texture_2d<f32>;\n@group(0) @binding(1) var sourceSampler: sampler;\n@group(0) @binding(2) var<uniform> params: Params;\n@group(0) @binding(3) var secondary: texture_2d<f32>;\n\nstruct Params {values: vec4f,}\n@fragment fn fragment(input: VertexOutput) -> @location(0) vec4f {\n let color=textureSampleLevel(source,sourceSampler,input.uv,0)+textureSampleLevel(secondary,sourceSampler,input.uv,0)*max(params.values.x,0.0);\n return min(color,vec4f(1));\n}";
@@ -0,0 +1 @@
1
+ export declare const GRIDLINES_WEBGPU_SHADER = "\ndiagnostic(off, derivative_uniformity);\n\nstruct VertexOutput {\n\t@builtin(position) position: vec4f,\n\t@location(0) uv: vec2f,\n}\n\n@vertex fn vertex(@builtin(vertex_index) index: u32) -> VertexOutput {\n\tlet positions = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n\tlet position = positions[index];\n\tvar output: VertexOutput;\n\toutput.position = vec4f(position, 0, 1);\n\toutput.uv = vec2f(position.x * 0.5 + 0.5, 0.5 - position.y * 0.5);\n\treturn output;\n}\n\n@group(0) @binding(0) var sourceTexture: texture_2d<f32>;\n@group(0) @binding(1) var sourceSampler: sampler;\n@group(0) @binding(2) var<uniform> params: Params;\nstruct Params {\n geometry: vec4f,\n rotation: vec4f,\n offset: vec4f,\n lineColor: vec4f,\n backgroundColor: vec4f,\n}\nfn sampleSource(uv: vec2f) -> vec4f {\n return textureSampleLevel(sourceTexture, sourceSampler, vec2f(uv.x, 1.0 - uv.y), 0);\n}\n\nfn sourceOver(backdrop: vec4f, overlay: vec4f) -> vec4f { return overlay + backdrop * (1.0 - overlay.a); }\nfn sourceAtop(backdrop: vec4f, overlay: vec4f) -> vec4f { return vec4f(overlay.rgb * backdrop.a + backdrop.rgb * (1.0 - overlay.a), backdrop.a); }\nfn rotationMatrix(rotationX: f32, rotationY: f32, rotationZ: f32) -> mat3x3f {\n let sx = sin(rotationX); let cx = cos(rotationX);\n let sy = sin(rotationY); let cy = cos(rotationY);\n let sz = sin(rotationZ); let cz = cos(rotationZ);\n let rx = mat3x3f(1, 0, 0, 0, cx, sx, 0, -sx, cx);\n let ry = mat3x3f(cy, 0, -sy, 0, 1, 0, sy, 0, cy);\n let rz = mat3x3f(cz, sz, 0, -sz, cz, 0, 0, 0, 1);\n return rz * ry * rx;\n}\nstruct GridPoint {coordinate: vec2f, valid: bool,}\nfn gridAt(centered: vec2f, rotation: mat3x3f) -> GridPoint {\n var gridCoord = vec2f(0);\n if (params.rotation.w <= 0.0) {\n let rotated = rotation * vec3f(centered, 0);\n gridCoord = rotated.xy + params.offset.xy;\n } else {\n let camera = vec3f(0, 0, params.rotation.w);\n let ray = normalize(vec3f(centered, -params.rotation.w));\n let normal = rotation * vec3f(0, 0, 1);\n let denominator = dot(ray, normal);\n let t = -dot(camera, normal) / denominator;\n if (abs(denominator) < 0.0001 || t <= 0.0) { return GridPoint(vec2f(0), false); }\n let worldPosition = camera + ray * t;\n let localPosition = transpose(rotation) * worldPosition;\n gridCoord = localPosition.xy + params.offset.xy;\n }\n return GridPoint(gridCoord, true);\n}\n@fragment fn fragment(input: VertexOutput) -> @location(0) vec4f {\n let vUv = vec2f(input.uv.x, 1.0 - input.uv.y);\n\n let texColor = sampleSource(vUv);\n let centered = vec2f(input.position.x, params.geometry.y - input.position.y) - params.geometry.xy * 0.5;\n let rotation = rotationMatrix(params.rotation.y, params.rotation.z, params.rotation.x);\n let gridPoint = gridAt(centered, rotation);\n if (!gridPoint.valid) { return sourceOver(texColor, params.backgroundColor); }\n let gridCoord = gridPoint.coordinate;\n let gridSize = max(params.geometry.z, 0.001);\n let cell = abs(fract(gridCoord / gridSize + vec2f(0.5)) - vec2f(0.5)) * gridSize;\n let halfLineWidth = params.geometry.w * 0.5;\n var derivatives = fwidth(gridCoord);\n if (i32(params.geometry.y) % 2 != 0) {\n // Match WebGL's bottom-origin derivative quads on odd-height targets.\n let neighborY = select(-1.0, 1.0, i32(params.geometry.y - input.position.y) % 2 == 0);\n let neighbor = gridAt(centered + vec2f(0, neighborY), rotation);\n derivatives = abs(dpdx(gridCoord)) + abs(neighbor.coordinate - gridCoord);\n }\n let gridUnitsPerPixel = max(derivatives, vec2f(0.001));\n let halfWidthInGridUnits = halfLineWidth * gridUnitsPerPixel;\n let projectedCellSize = gridSize / gridUnitsPerPixel;\n let densityFade = smoothstep(vec2f(max(params.geometry.w * 1.5, 1.0)), vec2f(max(params.geometry.w * 4.0, 2.0)), projectedCellSize);\n var lineCoverage = vec2f(0);\n if (halfLineWidth > 0.001) { lineCoverage = vec2f(1) - smoothstep(halfWidthInGridUnits - gridUnitsPerPixel, halfWidthInGridUnits + gridUnitsPerPixel, cell); }\n lineCoverage *= densityFade;\n let coverage = max(lineCoverage.x, lineCoverage.y);\n let line = params.lineColor * coverage;\n if (params.offset.z != 0.0) { return sourceAtop(sourceAtop(texColor, params.backgroundColor), line); }\n return sourceOver(sourceOver(texColor, params.backgroundColor), line);\n\n}\n";
@@ -0,0 +1 @@
1
+ export declare const HALFTONE_LINEAR_GRADIENT_WEBGPU_SHADER = "\n\nstruct VertexOutput {\n\t@builtin(position) position: vec4f,\n\t@location(0) uv: vec2f,\n}\n\n@vertex fn vertex(@builtin(vertex_index) index: u32) -> VertexOutput {\n\tlet positions = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n\tlet position = positions[index];\n\tvar output: VertexOutput;\n\toutput.position = vec4f(position, 0, 1);\n\toutput.uv = vec2f(position.x * 0.5 + 0.5, 0.5 - position.y * 0.5);\n\treturn output;\n}\n\n@group(0) @binding(0) var sourceTexture: texture_2d<f32>;\n@group(0) @binding(1) var sourceSampler: sampler;\n@group(0) @binding(2) var<uniform> params: Params;\nstruct Params {\n geometry: vec4f,\n stops: vec4f,\n flags: vec4f,\n color: vec4f,\n}\nfn sampleSource(uv: vec2f) -> vec4f {\n return textureSampleLevel(sourceTexture, sourceSampler, vec2f(uv.x, 1.0 - uv.y), 0);\n}\n\n@fragment fn fragment(input: VertexOutput) -> @location(0) vec4f {\n let vUv = vec2f(input.uv.x, 1.0 - input.uv.y);\n\n let center = params.geometry.xy * 0.5;\n let gridPos = vec2f(input.position.x, params.geometry.y - input.position.y) - center;\n let gridSize = max(params.flags.x, 0.001);\n let cellIndex = floor(gridPos / gridSize + vec2f(0.5));\n let gridCenter = cellIndex * gridSize;\n let canvasCenter = center + gridCenter;\n let centerUv = canvasCenter / params.geometry.xy;\n let gradientUv = vec2f(centerUv.x, 1.0 - centerUv.y);\n let stopVector = params.stops.zw - params.stops.xy;\n let stopDistance = dot(stopVector, stopVector);\n var progress = 0.0;\n if (stopDistance > 0.0) { progress = clamp(dot(gradientUv - params.stops.xy, stopVector) / stopDistance, 0.0, 1.0); }\n let dotSize = mix(params.geometry.z, params.geometry.w, progress);\n if (dotSize <= 0.01) { return vec4f(0); }\n let radius = dotSize * 0.5;\n let coverage = 1.0 - smoothstep(radius - 0.75, radius + 0.75, length(gridPos - gridCenter));\n let texColor = sampleSource(clamp(centerUv, vec2f(0), vec2f(1)));\n let dotColor = select(params.color, texColor, params.flags.y != 0.0) * coverage;\n if (params.flags.y != 0.0) { return dotColor; }\n if (params.flags.z != 0.0) { return vec4f(dotColor.rgb * texColor.a + texColor.rgb * (1.0 - dotColor.a), texColor.a); }\n return dotColor + texColor * (1.0 - dotColor.a);\n\n}\n";
@@ -0,0 +1 @@
1
+ export declare const HALFTONE_WEBGPU_SHADER = "\n\nstruct VertexOutput {\n\t@builtin(position) position: vec4f,\n\t@location(0) uv: vec2f,\n}\n\n@vertex fn vertex(@builtin(vertex_index) index: u32) -> VertexOutput {\n\tlet positions = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n\tlet position = positions[index];\n\tvar output: VertexOutput;\n\toutput.position = vec4f(position, 0, 1);\n\toutput.uv = vec2f(position.x * 0.5 + 0.5, 0.5 - position.y * 0.5);\n\treturn output;\n}\n\n@group(0) @binding(0) var sourceTexture: texture_2d<f32>;\n@group(0) @binding(1) var sourceSampler: sampler;\n@group(0) @binding(2) var<uniform> params: Params;\nstruct Params {\n geometry: vec4f,\n grid: vec4f,\n flags: vec4f,\n color: vec4f,\n}\nfn sampleSource(uv: vec2f) -> vec4f {\n return textureSampleLevel(sourceTexture, sourceSampler, vec2f(uv.x, 1.0 - uv.y), 0);\n}\n\n@fragment fn fragment(input: VertexOutput) -> @location(0) vec4f {\n let vUv = vec2f(input.uv.x, 1.0 - input.uv.y);\n\n let center = params.geometry.xy * 0.5;\n let d = vec2f(input.position.x, params.geometry.y - input.position.y) - center;\n let cosR = cos(params.grid.x);\n let sinR = sin(params.grid.x);\n let gridPos = vec2f(d.x * cosR + d.y * sinR, -d.x * sinR + d.y * cosR);\n let spacing = max(params.geometry.w, 0.001);\n let cellIndex = floor((gridPos + params.grid.yz) / spacing + vec2f(0.5));\n let gridCenter = cellIndex * spacing - params.grid.yz;\n let canvasPos = center + vec2f(gridCenter.x * cosR - gridCenter.y * sinR, gridCenter.x * sinR + gridCenter.y * cosR);\n let sampleUv = clamp(canvasPos / params.geometry.xy, vec2f(0), vec2f(1));\n let texColor = sampleSource(sampleUv);\n let alpha = texColor.a;\n var rgb = vec3f(0);\n if (alpha > 0.001) { rgb = texColor.rgb / alpha; }\n let lum = dot(rgb, vec3f(0.299, 0.587, 0.114));\n let lumDefault = lum * alpha + (1.0 - alpha);\n let dotScale = select(1.0 - lumDefault, lumDefault, params.flags.x != 0.0);\n if (dotScale <= 0.01) { return vec4f(0); }\n let diff = gridPos - gridCenter;\n let halfSize = params.geometry.z * 0.5;\n var coverage = 0.0;\n if (params.grid.w == 0.0) {\n let radius = halfSize * dotScale;\n coverage = 1.0 - smoothstep(radius - 0.75, radius + 0.75, length(diff));\n } else if (params.grid.w == 1.0) {\n let s = params.geometry.z * dotScale * 0.5;\n coverage = (1.0 - smoothstep(s - 0.5, s + 0.5, abs(diff.x))) * (1.0 - smoothstep(s - 0.5, s + 0.5, abs(diff.y)));\n } else {\n let localTexColor = sampleSource(vUv);\n let localAlpha = localTexColor.a;\n var localRgb = vec3f(0);\n if (localAlpha > 0.001) { localRgb = localTexColor.rgb / localAlpha; }\n let localLum = dot(localRgb, vec3f(0.299, 0.587, 0.114));\n let localLumDefault = localLum * localAlpha + (1.0 - localAlpha);\n let localDotScale = select(1.0 - localLumDefault, localLumDefault, params.flags.x != 0.0);\n if (localDotScale <= 0.12) { return vec4f(0); }\n let lineHalf = params.geometry.z * dotScale * 0.5;\n if (lineHalf <= 1.0) { return vec4f(0); }\n coverage = (1.0 - smoothstep(halfSize - 0.5, halfSize + 0.5, abs(diff.x))) * (1.0 - smoothstep(lineHalf - 0.5, lineHalf + 0.5, abs(diff.y)));\n }\n return select(params.color, texColor, params.flags.y != 0.0) * coverage;\n\n}\n";
@@ -0,0 +1,78 @@
1
+ export type IrisWipeCenter = readonly [number, number];
2
+ export type IrisWipeParams = {
3
+ /** Normalized center measured from the top-left corner. Defaults to `[0.5, 0.5]`. */
4
+ readonly center?: IrisWipeCenter;
5
+ /** Number of polygon vertices or star points, from 3 to 64. Defaults to `6`. */
6
+ readonly points?: number;
7
+ /** Distance to the outer vertices in pixels. Defaults to `0`, leaving the source unchanged. */
8
+ readonly outerRadius?: number;
9
+ /** Alternate outer and inner vertices to create a star. Defaults to `false`. */
10
+ readonly useInnerRadius?: boolean;
11
+ /** Distance to the inner star vertices in pixels. Defaults to `0`. */
12
+ readonly innerRadius?: number;
13
+ /** Clockwise rotation in degrees from the top. Defaults to `0`. */
14
+ readonly rotation?: number;
15
+ /** Width of the feathered boundary in pixels. Defaults to `0`. */
16
+ readonly feather?: number;
17
+ };
18
+ export declare const irisWipeSchema: {
19
+ readonly center: {
20
+ readonly type: 'uv-coordinate';
21
+ readonly min: 0;
22
+ readonly max: 1;
23
+ readonly step: 0.01;
24
+ readonly default: readonly [0.5, 0.5];
25
+ readonly description: 'Center';
26
+ };
27
+ readonly points: {
28
+ readonly type: 'number';
29
+ readonly min: 3;
30
+ readonly max: 64;
31
+ readonly step: 1;
32
+ readonly integer: true;
33
+ readonly default: 6;
34
+ readonly description: 'Points';
35
+ readonly hiddenFromList: false;
36
+ };
37
+ readonly outerRadius: {
38
+ readonly type: 'number';
39
+ readonly min: 0;
40
+ readonly max: 2000;
41
+ readonly step: 1;
42
+ readonly default: 0;
43
+ readonly description: 'Outer radius';
44
+ readonly hiddenFromList: false;
45
+ };
46
+ readonly useInnerRadius: {
47
+ readonly type: 'boolean';
48
+ readonly default: false;
49
+ readonly description: 'Use inner radius';
50
+ };
51
+ readonly innerRadius: {
52
+ readonly type: 'number';
53
+ readonly min: 0;
54
+ readonly max: 2000;
55
+ readonly step: 1;
56
+ readonly default: 0;
57
+ readonly description: 'Inner radius';
58
+ readonly hiddenFromList: false;
59
+ };
60
+ readonly rotation: {
61
+ readonly type: 'rotation-degrees';
62
+ readonly step: 1;
63
+ readonly default: 0;
64
+ readonly description: 'Rotation';
65
+ };
66
+ readonly feather: {
67
+ readonly type: 'number';
68
+ readonly min: 0;
69
+ readonly max: 500;
70
+ readonly step: 1;
71
+ readonly default: 0;
72
+ readonly description: 'Feather';
73
+ readonly hiddenFromList: false;
74
+ };
75
+ };
76
+ export declare const irisWipe: (params?: (IrisWipeParams & {
77
+ readonly disabled?: boolean;
78
+ }) | undefined) => import("remotion").EffectDescriptor<unknown>;
@@ -0,0 +1 @@
1
+ export declare const LENS_BLUR_WEBGPU_SHADER = "\n\nstruct VertexOutput {\n\t@builtin(position) position: vec4f,\n\t@location(0) uv: vec2f,\n}\n\n@vertex fn vertex(@builtin(vertex_index) index: u32) -> VertexOutput {\n\tlet positions = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n\tlet position = positions[index];\n\tvar output: VertexOutput;\n\toutput.position = vec4f(position, 0, 1);\n\toutput.uv = vec2f(position.x * 0.5 + 0.5, 0.5 - position.y * 0.5);\n\treturn output;\n}\n\n@group(0) @binding(0) var source: texture_2d<f32>;\n@group(0) @binding(1) var sourceSampler: sampler;\n@group(0) @binding(2) var<uniform> params: Params;\n// Aperture geometry and highlight controls adapted from EffectCraft's blur2.rs (MIT).\n// See ../../THIRD_PARTY_LICENSES.md.\nstruct Params {resolution: vec2f, radius: f32, shape: f32, iris: vec4f, highlights: vec4f, options: vec4f,}\nconst PI=3.141592653589793;\nconst GOLDEN_ANGLE=2.399963229728653;\nfn toLinear(color: vec3f) -> vec3f {\n return mix(color/12.92,pow((color+0.055)/1.055,vec3f(2.4)),step(vec3f(0.04045),color));\n}\nfn toSrgb(color: vec3f) -> vec3f {\n return mix(color*12.92,1.055*pow(max(color,vec3f(0)),vec3f(1.0/2.4))-0.055,step(vec3f(0.0031308),color));\n}\nfn readSource(uv: vec2f) -> vec4f {\n let sampled=textureSampleLevel(source,sourceSampler,uv,0);\n if (sampled.a<=0.0) {return vec4f(0);}\n var color=sampled.rgb/sampled.a;\n let luminance=dot(color,vec3f(0.2126,0.7152,0.0722));\n if (params.options.y!=0.0) {color=toLinear(color);}\n if (luminance>=params.highlights.y) {\n let brightest=max(color.r,max(color.g,color.b));\n let highlight=mix(vec3f(brightest),color,params.highlights.z);\n color+=highlight*(4.0*params.highlights.x);\n }\n var coverage=1.0;\n if (params.highlights.w==0.0) {\n let pixel=uv*params.resolution;\n let nearEdge=clamp(pixel+0.5,vec2f(0),vec2f(1));\n let farEdge=clamp(params.resolution+0.5-pixel,vec2f(0),vec2f(1));\n coverage=nearEdge.x*nearEdge.y*farEdge.x*farEdge.y;\n }\n return vec4f(color*sampled.a,sampled.a)*coverage;\n}\n@fragment fn fragment(input: VertexOutput) -> @location(0) vec4f {\n if (params.radius==0.0) {return textureSampleLevel(source,sourceSampler,input.uv,0);}\n var sum=vec4f(0);var total=0.0;\n for (var i=0;i<2048;i++) {\n if (f32(i)>=params.options.x) {break;}\n let angle=f32(i)*GOLDEN_ANGLE;\n var boundary=1.0;\n if (params.shape<11.0) {\n let halfSector=PI/params.shape;\n let value=angle+PI/2.0;\n let localAngle=value-floor(value/(2.0*halfSector))*(2.0*halfSector)-halfSector;\n let polygon=cos(halfSector)/cos(localAngle);\n boundary=mix(polygon,1.0,params.iris.x);\n }\n let distance=sqrt((f32(i)+0.5)/params.options.x)*boundary;\n let rotatedAngle=angle+params.iris.y;\n let offset=vec2f(cos(rotatedAngle)*params.iris.z,sin(rotatedAngle))*distance*params.radius;\n let weight=boundary*boundary;\n sum+=readSource(input.uv-offset/params.resolution)*weight;\n total+=weight;\n }\n var color=sum/total;\n if (params.options.y!=0.0 && color.a>0.0) {color=vec4f(toSrgb(color.rgb/color.a)*color.a,color.a);}\n return vec4f(clamp(color.rgb,vec3f(0),vec3f(color.a)),color.a);\n}\n";
package/dist/levels.d.ts CHANGED
@@ -1,11 +1,78 @@
1
+ declare const LEVELS_CHANNELS: readonly ['rgb', 'red', 'green', 'blue'];
2
+ export declare const levelsSchema: {
3
+ readonly channel: {
4
+ readonly type: 'enum';
5
+ readonly variants: {
6
+ readonly rgb: {};
7
+ readonly red: {};
8
+ readonly green: {};
9
+ readonly blue: {};
10
+ };
11
+ readonly default: "rgb";
12
+ readonly description: 'Channel';
13
+ };
14
+ readonly blackPoint: {
15
+ readonly type: 'number';
16
+ readonly min: 0;
17
+ readonly max: 1;
18
+ readonly step: 0.01;
19
+ readonly default: 0;
20
+ readonly description: 'Input black';
21
+ readonly hiddenFromList: false;
22
+ };
23
+ readonly whitePoint: {
24
+ readonly type: 'number';
25
+ readonly min: 0;
26
+ readonly max: 1;
27
+ readonly step: 0.01;
28
+ readonly default: 1;
29
+ readonly description: 'Input white';
30
+ readonly hiddenFromList: false;
31
+ };
32
+ readonly gamma: {
33
+ readonly type: 'number';
34
+ readonly min: 0.01;
35
+ readonly max: 10;
36
+ readonly step: 0.01;
37
+ readonly default: 1;
38
+ readonly description: 'Gamma';
39
+ readonly hiddenFromList: false;
40
+ };
41
+ readonly outputBlack: {
42
+ readonly type: 'number';
43
+ readonly min: 0;
44
+ readonly max: 1;
45
+ readonly step: 0.01;
46
+ readonly default: 0;
47
+ readonly description: 'Output black';
48
+ readonly hiddenFromList: false;
49
+ };
50
+ readonly outputWhite: {
51
+ readonly type: 'number';
52
+ readonly min: 0;
53
+ readonly max: 1;
54
+ readonly step: 0.01;
55
+ readonly default: 1;
56
+ readonly description: 'Output white';
57
+ readonly hiddenFromList: false;
58
+ };
59
+ };
60
+ export type LevelsChannel = (typeof LEVELS_CHANNELS)[number];
1
61
  export type LevelsParams = {
2
- /** Input value mapped to black, from `0` to `1`. Defaults to `0`. */
62
+ /** Color channels to adjust. Defaults to `"rgb"`. */
63
+ readonly channel?: LevelsChannel;
64
+ /** Input value mapped to outputBlack, from `0` to `1`. Defaults to `0`. */
3
65
  readonly blackPoint?: number;
4
- /** Input value mapped to white, from `0` to `1`. Defaults to `1`. */
66
+ /** Input value mapped to outputWhite, from `0` to `1`. Defaults to `1`. */
5
67
  readonly whitePoint?: number;
6
68
  /** Midtone gamma from `0.01` to `10`. Defaults to `1`. */
7
69
  readonly gamma?: number;
70
+ /** Output value for the input black point, from `0` to `1`. Defaults to `0`. */
71
+ readonly outputBlack?: number;
72
+ /** Output value for the input white point, from `0` to `1`. Defaults to `1`. */
73
+ readonly outputWhite?: number;
8
74
  };
9
75
  export declare const levels: (params?: (LevelsParams & {
10
76
  readonly disabled?: boolean;
11
77
  }) | undefined) => import("remotion").EffectDescriptor<unknown>;
78
+ export {};