@triforge/compositor-core 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 (97) hide show
  1. package/dist/core/BasePass.d.ts +49 -0
  2. package/dist/core/BasePass.d.ts.map +1 -0
  3. package/dist/core/BasePass.js +36 -0
  4. package/dist/core/CompositorBackend.d.ts +12 -0
  5. package/dist/core/CompositorBackend.d.ts.map +1 -0
  6. package/dist/core/CompositorBackend.js +1 -0
  7. package/dist/core/CompositorOutput.d.ts +73 -0
  8. package/dist/core/CompositorOutput.d.ts.map +1 -0
  9. package/dist/core/CompositorOutput.js +201 -0
  10. package/dist/index.d.ts +62 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +32 -0
  13. package/dist/passes/AlphaOver.d.ts +32 -0
  14. package/dist/passes/AlphaOver.d.ts.map +1 -0
  15. package/dist/passes/AlphaOver.js +59 -0
  16. package/dist/passes/Bloom.d.ts +25 -0
  17. package/dist/passes/Bloom.d.ts.map +1 -0
  18. package/dist/passes/Bloom.js +32 -0
  19. package/dist/passes/Blur.d.ts +23 -0
  20. package/dist/passes/Blur.d.ts.map +1 -0
  21. package/dist/passes/Blur.js +54 -0
  22. package/dist/passes/BrightnessContrast.d.ts +20 -0
  23. package/dist/passes/BrightnessContrast.d.ts.map +1 -0
  24. package/dist/passes/BrightnessContrast.js +42 -0
  25. package/dist/passes/ChromaticAberration.d.ts +22 -0
  26. package/dist/passes/ChromaticAberration.d.ts.map +1 -0
  27. package/dist/passes/ChromaticAberration.js +53 -0
  28. package/dist/passes/ColorBalance.d.ts +38 -0
  29. package/dist/passes/ColorBalance.d.ts.map +1 -0
  30. package/dist/passes/ColorBalance.js +50 -0
  31. package/dist/passes/CombineRGBA.d.ts +35 -0
  32. package/dist/passes/CombineRGBA.d.ts.map +1 -0
  33. package/dist/passes/CombineRGBA.js +49 -0
  34. package/dist/passes/DepthOfField.d.ts +27 -0
  35. package/dist/passes/DepthOfField.d.ts.map +1 -0
  36. package/dist/passes/DepthOfField.js +47 -0
  37. package/dist/passes/EdgeDetect.d.ts +31 -0
  38. package/dist/passes/EdgeDetect.d.ts.map +1 -0
  39. package/dist/passes/EdgeDetect.js +69 -0
  40. package/dist/passes/Exposure.d.ts +19 -0
  41. package/dist/passes/Exposure.d.ts.map +1 -0
  42. package/dist/passes/Exposure.js +42 -0
  43. package/dist/passes/FilmGrain.d.ts +26 -0
  44. package/dist/passes/FilmGrain.d.ts.map +1 -0
  45. package/dist/passes/FilmGrain.js +31 -0
  46. package/dist/passes/Gamma.d.ts +17 -0
  47. package/dist/passes/Gamma.d.ts.map +1 -0
  48. package/dist/passes/Gamma.js +36 -0
  49. package/dist/passes/GaussianBlur.d.ts +26 -0
  50. package/dist/passes/GaussianBlur.d.ts.map +1 -0
  51. package/dist/passes/GaussianBlur.js +81 -0
  52. package/dist/passes/GlareStreaks.d.ts +38 -0
  53. package/dist/passes/GlareStreaks.d.ts.map +1 -0
  54. package/dist/passes/GlareStreaks.js +82 -0
  55. package/dist/passes/HueSaturation.d.ts +26 -0
  56. package/dist/passes/HueSaturation.d.ts.map +1 -0
  57. package/dist/passes/HueSaturation.js +65 -0
  58. package/dist/passes/LUT.d.ts +64 -0
  59. package/dist/passes/LUT.d.ts.map +1 -0
  60. package/dist/passes/LUT.js +140 -0
  61. package/dist/passes/LensFlare.d.ts +34 -0
  62. package/dist/passes/LensFlare.d.ts.map +1 -0
  63. package/dist/passes/LensFlare.js +92 -0
  64. package/dist/passes/Mix.d.ts +23 -0
  65. package/dist/passes/Mix.d.ts.map +1 -0
  66. package/dist/passes/Mix.js +41 -0
  67. package/dist/passes/MotionBlur.d.ts +37 -0
  68. package/dist/passes/MotionBlur.d.ts.map +1 -0
  69. package/dist/passes/MotionBlur.js +65 -0
  70. package/dist/passes/Pixelate.d.ts +19 -0
  71. package/dist/passes/Pixelate.d.ts.map +1 -0
  72. package/dist/passes/Pixelate.js +45 -0
  73. package/dist/passes/RenderLayers.d.ts +31 -0
  74. package/dist/passes/RenderLayers.d.ts.map +1 -0
  75. package/dist/passes/RenderLayers.js +45 -0
  76. package/dist/passes/SSAO.d.ts +34 -0
  77. package/dist/passes/SSAO.d.ts.map +1 -0
  78. package/dist/passes/SSAO.js +42 -0
  79. package/dist/passes/SSR.d.ts +32 -0
  80. package/dist/passes/SSR.d.ts.map +1 -0
  81. package/dist/passes/SSR.js +44 -0
  82. package/dist/passes/SeparateRGBA.d.ts +29 -0
  83. package/dist/passes/SeparateRGBA.d.ts.map +1 -0
  84. package/dist/passes/SeparateRGBA.js +45 -0
  85. package/dist/passes/SetAlpha.d.ts +21 -0
  86. package/dist/passes/SetAlpha.d.ts.map +1 -0
  87. package/dist/passes/SetAlpha.js +36 -0
  88. package/dist/passes/Sharpen.d.ts +17 -0
  89. package/dist/passes/Sharpen.d.ts.map +1 -0
  90. package/dist/passes/Sharpen.js +42 -0
  91. package/dist/passes/Vignette.d.ts +22 -0
  92. package/dist/passes/Vignette.d.ts.map +1 -0
  93. package/dist/passes/Vignette.js +49 -0
  94. package/dist/passes/ZCombine.d.ts +34 -0
  95. package/dist/passes/ZCombine.d.ts.map +1 -0
  96. package/dist/passes/ZCombine.js +50 -0
  97. package/package.json +48 -0
@@ -0,0 +1,23 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ import type { PassRegistry } from '../core/BasePass.js';
3
+ export interface BlurOptions {
4
+ /** Blur radius in pixels. Default 4. Blender: Blur node → Size */
5
+ radius?: number;
6
+ /** Horizontal blur amount multiplier [0–1]. Default 1. */
7
+ x?: number;
8
+ /** Vertical blur amount multiplier [0–1]. Default 1. */
9
+ y?: number;
10
+ }
11
+ /** Blur — Blender Compositor: Blur node */
12
+ export declare class Blur extends BasePass {
13
+ readonly passType = "Blur";
14
+ parameters: {
15
+ radius: number;
16
+ x: number;
17
+ y: number;
18
+ };
19
+ constructor(opts?: BlurOptions);
20
+ _threePassDeps(): string[];
21
+ _buildThree(_width: number, _height: number, reg: PassRegistry): unknown;
22
+ }
23
+ //# sourceMappingURL=Blur.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Blur.d.ts","sourceRoot":"","sources":["../../src/passes/Blur.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,MAAM,WAAW,WAAW;IAC1B,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,0DAA0D;IAC1D,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,wDAAwD;IACxD,CAAC,CAAC,EAAE,MAAM,CAAA;CACX;AAED,2CAA2C;AAC3C,qBAAa,IAAK,SAAQ,QAAQ;IAChC,QAAQ,CAAC,QAAQ,UAAS;IAC1B,UAAU,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;gBAExC,IAAI,GAAE,WAAgB;IASlC,cAAc;IAEd,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO;CAyCzE"}
@@ -0,0 +1,54 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ /** Blur — Blender Compositor: Blur node */
3
+ export class Blur extends BasePass {
4
+ constructor(opts = {}) {
5
+ super();
6
+ this.passType = 'Blur';
7
+ this.parameters = {
8
+ radius: opts.radius ?? 4,
9
+ x: opts.x ?? 1,
10
+ y: opts.y ?? 1,
11
+ };
12
+ }
13
+ _threePassDeps() { return ['ShaderPass']; }
14
+ _buildThree(_width, _height, reg) {
15
+ const ShaderPass = reg['ShaderPass'];
16
+ if (!ShaderPass)
17
+ throw new Error('Blur: ShaderPass not found in three/addons.');
18
+ const r = this.parameters.radius;
19
+ const px = (1 / 1920) * r * this.parameters.x;
20
+ const py = (1 / 1080) * r * this.parameters.y;
21
+ const BlurShader = {
22
+ uniforms: {
23
+ tDiffuse: { value: null },
24
+ resolution: { value: [1920, 1080] },
25
+ blurX: { value: px },
26
+ blurY: { value: py },
27
+ },
28
+ vertexShader: `
29
+ varying vec2 vUv;
30
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0); }
31
+ `,
32
+ fragmentShader: `
33
+ uniform sampler2D tDiffuse;
34
+ uniform float blurX;
35
+ uniform float blurY;
36
+ varying vec2 vUv;
37
+ void main() {
38
+ vec4 sum = vec4(0.0);
39
+ sum += texture2D(tDiffuse, vec2(vUv.x - 4.0*blurX, vUv.y - 4.0*blurY)) * 0.051;
40
+ sum += texture2D(tDiffuse, vec2(vUv.x - 3.0*blurX, vUv.y - 3.0*blurY)) * 0.0918;
41
+ sum += texture2D(tDiffuse, vec2(vUv.x - 2.0*blurX, vUv.y - 2.0*blurY)) * 0.12245;
42
+ sum += texture2D(tDiffuse, vec2(vUv.x - 1.0*blurX, vUv.y - 1.0*blurY)) * 0.1531;
43
+ sum += texture2D(tDiffuse, vUv) * 0.1633;
44
+ sum += texture2D(tDiffuse, vec2(vUv.x + 1.0*blurX, vUv.y + 1.0*blurY)) * 0.1531;
45
+ sum += texture2D(tDiffuse, vec2(vUv.x + 2.0*blurX, vUv.y + 2.0*blurY)) * 0.12245;
46
+ sum += texture2D(tDiffuse, vec2(vUv.x + 3.0*blurX, vUv.y + 3.0*blurY)) * 0.0918;
47
+ sum += texture2D(tDiffuse, vec2(vUv.x + 4.0*blurX, vUv.y + 4.0*blurY)) * 0.051;
48
+ gl_FragColor = sum;
49
+ }
50
+ `,
51
+ };
52
+ return new ShaderPass(BlurShader);
53
+ }
54
+ }
@@ -0,0 +1,20 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ import type { PassRegistry } from '../core/BasePass.js';
3
+ export interface BrightnessContrastOptions {
4
+ /** Brightness offset [-1, 1]. Default 0. Blender: Bright/Contrast → Bright */
5
+ brightness?: number;
6
+ /** Contrast multiplier [-1, 1]. Default 0. Blender: Bright/Contrast → Contrast */
7
+ contrast?: number;
8
+ }
9
+ /** BrightnessContrast — Blender Compositor: Bright/Contrast node */
10
+ export declare class BrightnessContrast extends BasePass {
11
+ readonly passType = "BrightnessContrast";
12
+ parameters: {
13
+ brightness: number;
14
+ contrast: number;
15
+ };
16
+ constructor(opts?: BrightnessContrastOptions);
17
+ _threePassDeps(): string[];
18
+ _buildThree(_width: number, _height: number, reg: PassRegistry): unknown;
19
+ }
20
+ //# sourceMappingURL=BrightnessContrast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrightnessContrast.d.ts","sourceRoot":"","sources":["../../src/passes/BrightnessContrast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,MAAM,WAAW,yBAAyB;IACxC,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,oEAAoE;AACpE,qBAAa,kBAAmB,SAAQ,QAAQ;IAC9C,QAAQ,CAAC,QAAQ,wBAAuB;IACxC,UAAU,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;gBAExC,IAAI,GAAE,yBAA8B;IAQhD,cAAc;IAEd,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO;CA6BzE"}
@@ -0,0 +1,42 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ /** BrightnessContrast — Blender Compositor: Bright/Contrast node */
3
+ export class BrightnessContrast extends BasePass {
4
+ constructor(opts = {}) {
5
+ super();
6
+ this.passType = 'BrightnessContrast';
7
+ this.parameters = {
8
+ brightness: opts.brightness ?? 0,
9
+ contrast: opts.contrast ?? 0,
10
+ };
11
+ }
12
+ _threePassDeps() { return ['ShaderPass']; }
13
+ _buildThree(_width, _height, reg) {
14
+ const ShaderPass = reg['ShaderPass'];
15
+ if (!ShaderPass)
16
+ throw new Error('BrightnessContrast: ShaderPass not found in three/addons.');
17
+ const shader = {
18
+ uniforms: {
19
+ tDiffuse: { value: null },
20
+ brightness: { value: this.parameters.brightness },
21
+ contrast: { value: this.parameters.contrast },
22
+ },
23
+ vertexShader: `
24
+ varying vec2 vUv;
25
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0); }
26
+ `,
27
+ fragmentShader: `
28
+ uniform sampler2D tDiffuse;
29
+ uniform float brightness;
30
+ uniform float contrast;
31
+ varying vec2 vUv;
32
+ void main() {
33
+ vec4 tex = texture2D(tDiffuse, vUv);
34
+ vec3 col = tex.rgb + brightness;
35
+ col = (col - 0.5) * (1.0 + contrast) + 0.5;
36
+ gl_FragColor = vec4(clamp(col, 0.0, 1.0), tex.a);
37
+ }
38
+ `,
39
+ };
40
+ return new ShaderPass(shader);
41
+ }
42
+ }
@@ -0,0 +1,22 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ import type { PassRegistry } from '../core/BasePass.js';
3
+ export interface ChromaticAberrationOptions {
4
+ /** RGB channel offset amount. Default 0.005. Blender: Lens Distortion → Dispersion */
5
+ offset?: number;
6
+ /** Radial falloff — 0 = uniform, 1 = edge only. Default 0.5. */
7
+ radialModulation?: number;
8
+ }
9
+ /** ChromaticAberration — Blender Compositor: Lens Distortion node (Dispersion) */
10
+ export declare class ChromaticAberration extends BasePass {
11
+ readonly passType = "ChromaticAberration";
12
+ parameters: {
13
+ offset: number;
14
+ radialModulation: number;
15
+ };
16
+ constructor(opts?: ChromaticAberrationOptions);
17
+ _threePassDeps(): string[];
18
+ _buildThree(_width: number, _height: number, reg: PassRegistry): unknown;
19
+ _buildPmndrs(reg: PassRegistry): unknown;
20
+ get _isPmndrsEffect(): boolean;
21
+ }
22
+ //# sourceMappingURL=ChromaticAberration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChromaticAberration.d.ts","sourceRoot":"","sources":["../../src/passes/ChromaticAberration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,MAAM,WAAW,0BAA0B;IACzC,sFAAsF;IACtF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,kFAAkF;AAClF,qBAAa,mBAAoB,SAAQ,QAAQ;IAC/C,QAAQ,CAAC,QAAQ,yBAAwB;IACzC,UAAU,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAA;KAAE,CAAA;gBAE5C,IAAI,GAAE,0BAA+B;IAQjD,cAAc;IAEd,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO;IAkC/D,YAAY,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO;IAMjD,IAAa,eAAe,IAAI,OAAO,CAAgB;CACxD"}
@@ -0,0 +1,53 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ /** ChromaticAberration — Blender Compositor: Lens Distortion node (Dispersion) */
3
+ export class ChromaticAberration extends BasePass {
4
+ constructor(opts = {}) {
5
+ super();
6
+ this.passType = 'ChromaticAberration';
7
+ this.parameters = {
8
+ offset: opts.offset ?? 0.005,
9
+ radialModulation: opts.radialModulation ?? 0.5,
10
+ };
11
+ }
12
+ _threePassDeps() { return ['ShaderPass']; }
13
+ _buildThree(_width, _height, reg) {
14
+ const ShaderPass = reg['ShaderPass'];
15
+ if (!ShaderPass)
16
+ throw new Error('ChromaticAberration: ShaderPass not found in three/addons.');
17
+ const shader = {
18
+ uniforms: {
19
+ tDiffuse: { value: null },
20
+ offset: { value: this.parameters.offset },
21
+ radMod: { value: this.parameters.radialModulation },
22
+ },
23
+ vertexShader: `
24
+ varying vec2 vUv;
25
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0); }
26
+ `,
27
+ fragmentShader: `
28
+ uniform sampler2D tDiffuse;
29
+ uniform float offset;
30
+ uniform float radMod;
31
+ varying vec2 vUv;
32
+ void main() {
33
+ vec2 dir = vUv - 0.5;
34
+ float dist = length(dir) * radMod + (1.0 - radMod);
35
+ vec2 o = normalize(dir) * offset * dist;
36
+ float r = texture2D(tDiffuse, vUv - o).r;
37
+ float g = texture2D(tDiffuse, vUv ).g;
38
+ float b = texture2D(tDiffuse, vUv + o).b;
39
+ float a = texture2D(tDiffuse, vUv ).a;
40
+ gl_FragColor = vec4(r, g, b, a);
41
+ }
42
+ `,
43
+ };
44
+ return new ShaderPass(shader);
45
+ }
46
+ _buildPmndrs(reg) {
47
+ const Effect = reg['ChromaticAberrationEffect'];
48
+ if (!Effect)
49
+ throw new Error('ChromaticAberration: ChromaticAberrationEffect not found in postprocessing.');
50
+ return new Effect({ offset: this.parameters.offset });
51
+ }
52
+ get _isPmndrsEffect() { return true; }
53
+ }
@@ -0,0 +1,38 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ import type { PassRegistry } from '../core/BasePass.js';
3
+ export interface ColorBalanceOptions {
4
+ /** Lift (shadows) offset [-1, 1] per channel. Default 0. Blender: Color Balance → Lift */
5
+ liftR?: number;
6
+ liftG?: number;
7
+ liftB?: number;
8
+ /** Gamma (midtones) [0.01, 10]. Default 1. Blender: Color Balance → Gamma */
9
+ gammaR?: number;
10
+ gammaG?: number;
11
+ gammaB?: number;
12
+ /** Gain (highlights) [0, 4]. Default 1. Blender: Color Balance → Gain */
13
+ gainR?: number;
14
+ gainG?: number;
15
+ gainB?: number;
16
+ /** Blend factor [0–1]. Default 1. */
17
+ fac?: number;
18
+ }
19
+ /** ColorBalance — Blender Compositor: Color Balance node */
20
+ export declare class ColorBalance extends BasePass {
21
+ readonly passType = "ColorBalance";
22
+ parameters: {
23
+ liftR: number;
24
+ liftG: number;
25
+ liftB: number;
26
+ gammaR: number;
27
+ gammaG: number;
28
+ gammaB: number;
29
+ gainR: number;
30
+ gainG: number;
31
+ gainB: number;
32
+ fac: number;
33
+ };
34
+ constructor(opts?: ColorBalanceOptions);
35
+ _threePassDeps(): string[];
36
+ _buildThree(_width: number, _height: number, reg: PassRegistry): unknown;
37
+ }
38
+ //# sourceMappingURL=ColorBalance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorBalance.d.ts","sourceRoot":"","sources":["../../src/passes/ColorBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,MAAM,WAAW,mBAAmB;IAClC,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IAC9C,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACjD,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IAC9C,qCAAqC;IACrC,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,4DAA4D;AAC5D,qBAAa,YAAa,SAAQ,QAAQ;IACxC,QAAQ,CAAC,QAAQ,kBAAiB;IAClC,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;QAC3C,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;QAC9C,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;QAC3C,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;gBAEW,IAAI,GAAE,mBAAwB;IAU1C,cAAc;IAEd,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO;CAmCzE"}
@@ -0,0 +1,50 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ /** ColorBalance — Blender Compositor: Color Balance node */
3
+ export class ColorBalance extends BasePass {
4
+ constructor(opts = {}) {
5
+ super();
6
+ this.passType = 'ColorBalance';
7
+ this.parameters = {
8
+ liftR: opts.liftR ?? 0, liftG: opts.liftG ?? 0, liftB: opts.liftB ?? 0,
9
+ gammaR: opts.gammaR ?? 1, gammaG: opts.gammaG ?? 1, gammaB: opts.gammaB ?? 1,
10
+ gainR: opts.gainR ?? 1, gainG: opts.gainG ?? 1, gainB: opts.gainB ?? 1,
11
+ fac: opts.fac ?? 1,
12
+ };
13
+ }
14
+ _threePassDeps() { return ['ShaderPass']; }
15
+ _buildThree(_width, _height, reg) {
16
+ const ShaderPass = reg['ShaderPass'];
17
+ if (!ShaderPass)
18
+ throw new Error('ColorBalance: ShaderPass not found in three/addons.');
19
+ const p = this.parameters;
20
+ const shader = {
21
+ uniforms: {
22
+ tDiffuse: { value: null },
23
+ lift: { value: [p.liftR, p.liftG, p.liftB] },
24
+ gamma: { value: [p.gammaR, p.gammaG, p.gammaB] },
25
+ gain: { value: [p.gainR, p.gainG, p.gainB] },
26
+ fac: { value: p.fac },
27
+ },
28
+ vertexShader: `
29
+ varying vec2 vUv;
30
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0); }
31
+ `,
32
+ fragmentShader: `
33
+ uniform sampler2D tDiffuse;
34
+ uniform vec3 lift;
35
+ uniform vec3 gamma;
36
+ uniform vec3 gain;
37
+ uniform float fac;
38
+ varying vec2 vUv;
39
+ void main() {
40
+ vec4 tex = texture2D(tDiffuse, vUv);
41
+ // ASC CDL: out = pow(clamp(in * gain + lift, 0, 1), 1/gamma)
42
+ vec3 g = max(gamma, vec3(0.0001));
43
+ vec3 col = pow(clamp(tex.rgb * gain + lift, vec3(0.0), vec3(1.0)), vec3(1.0) / g);
44
+ gl_FragColor = vec4(mix(tex.rgb, col, fac), tex.a);
45
+ }
46
+ `,
47
+ };
48
+ return new ShaderPass(shader);
49
+ }
50
+ }
@@ -0,0 +1,35 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ import type { PassRegistry } from '../core/BasePass.js';
3
+ export interface CombineRGBAOptions {
4
+ /** Red channel gain [0–2]. Default 1.0. Blender: Combine RGBA → R */
5
+ r?: number;
6
+ /** Green channel gain [0–2]. Default 1.0. */
7
+ g?: number;
8
+ /** Blue channel gain [0–2]. Default 1.0. */
9
+ b?: number;
10
+ /** Output alpha value [0–1]. Default 1.0. Blender: Combine RGBA → A */
11
+ alpha?: number;
12
+ }
13
+ /**
14
+ * CombineRGBA — Blender Compositor: Combine RGBA node.
15
+ *
16
+ * Re-weights each colour channel individually and sets output alpha.
17
+ * Use after SeparateRGBA to remix channels or to tone a single channel.
18
+ *
19
+ * In a single-chain pipeline (where all passes share one framebuffer),
20
+ * this applies per-channel gains to the current render rather than
21
+ * accepting four separate greyscale inputs.
22
+ */
23
+ export declare class CombineRGBA extends BasePass {
24
+ readonly passType = "CombineRGBA";
25
+ parameters: {
26
+ r: number;
27
+ g: number;
28
+ b: number;
29
+ alpha: number;
30
+ };
31
+ constructor(opts?: CombineRGBAOptions);
32
+ _threePassDeps(): string[];
33
+ _buildThree(_w: number, _h: number, reg: PassRegistry): unknown;
34
+ }
35
+ //# sourceMappingURL=CombineRGBA.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CombineRGBA.d.ts","sourceRoot":"","sources":["../../src/passes/CombineRGBA.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,MAAM,WAAW,kBAAkB;IACjC,qEAAqE;IACrE,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,6CAA6C;IAC7C,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,4CAA4C;IAC5C,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;GASG;AACH,qBAAa,WAAY,SAAQ,QAAQ;IACvC,QAAQ,CAAC,QAAQ,iBAAgB;IACjC,UAAU,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;gBAElD,IAAI,GAAE,kBAAuB;IAUzC,cAAc;IAEd,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO;CAwBhE"}
@@ -0,0 +1,49 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ /**
3
+ * CombineRGBA — Blender Compositor: Combine RGBA node.
4
+ *
5
+ * Re-weights each colour channel individually and sets output alpha.
6
+ * Use after SeparateRGBA to remix channels or to tone a single channel.
7
+ *
8
+ * In a single-chain pipeline (where all passes share one framebuffer),
9
+ * this applies per-channel gains to the current render rather than
10
+ * accepting four separate greyscale inputs.
11
+ */
12
+ export class CombineRGBA extends BasePass {
13
+ constructor(opts = {}) {
14
+ super();
15
+ this.passType = 'CombineRGBA';
16
+ this.parameters = {
17
+ r: opts.r ?? 1.0,
18
+ g: opts.g ?? 1.0,
19
+ b: opts.b ?? 1.0,
20
+ alpha: opts.alpha ?? 1.0,
21
+ };
22
+ }
23
+ _threePassDeps() { return ['ShaderPass']; }
24
+ _buildThree(_w, _h, reg) {
25
+ const ShaderPass = reg['ShaderPass'];
26
+ if (!ShaderPass)
27
+ throw new Error('CombineRGBA: ShaderPass not found.');
28
+ const shader = {
29
+ uniforms: {
30
+ tDiffuse: { value: null },
31
+ rGain: { value: this.parameters.r },
32
+ gGain: { value: this.parameters.g },
33
+ bGain: { value: this.parameters.b },
34
+ alpha: { value: this.parameters.alpha },
35
+ },
36
+ vertexShader: `varying vec2 vUv; void main(){ vUv=uv; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }`,
37
+ fragmentShader: `
38
+ uniform sampler2D tDiffuse;
39
+ uniform float rGain, gGain, bGain, alpha;
40
+ varying vec2 vUv;
41
+ void main(){
42
+ vec4 col = texture2D(tDiffuse, vUv);
43
+ gl_FragColor = vec4(col.r * rGain, col.g * gGain, col.b * bGain, alpha);
44
+ }
45
+ `,
46
+ };
47
+ return new ShaderPass(shader);
48
+ }
49
+ }
@@ -0,0 +1,27 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ import type { PassRegistry } from '../core/BasePass.js';
3
+ export interface DepthOfFieldOptions {
4
+ /** World-space focus distance. Default 10. Blender: Defocus → Z */
5
+ focusDistance?: number;
6
+ /** Bokeh scale (aperture size). Default 3. Blender: Defocus → fStop */
7
+ bokehScale?: number;
8
+ /** Maximum blur radius in pixels. Default 5. */
9
+ maxBlur?: number;
10
+ }
11
+ /** DepthOfField — Blender Compositor: Defocus node */
12
+ export declare class DepthOfField extends BasePass {
13
+ readonly passType = "DepthOfField";
14
+ parameters: {
15
+ focusDistance: number;
16
+ bokehScale: number;
17
+ maxBlur: number;
18
+ };
19
+ private _scene;
20
+ private _camera;
21
+ constructor(opts?: DepthOfFieldOptions);
22
+ _threePassDeps(): string[];
23
+ _buildThree(_width: number, _height: number, reg: PassRegistry): unknown;
24
+ _buildPmndrs(reg: PassRegistry): unknown;
25
+ get _isPmndrsEffect(): boolean;
26
+ }
27
+ //# sourceMappingURL=DepthOfField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DepthOfField.d.ts","sourceRoot":"","sources":["../../src/passes/DepthOfField.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,MAAM,WAAW,mBAAmB;IAClC,mEAAmE;IACnE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,sDAAsD;AACtD,qBAAa,YAAa,SAAQ,QAAQ;IACxC,QAAQ,CAAC,QAAQ,kBAAiB;IAClC,UAAU,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;IAI1E,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,OAAO,CAAsB;gBAEzB,IAAI,GAAE,mBAAwB;IAS1C,cAAc;IAEd,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO;IAoB/D,YAAY,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO;IAajD,IAAa,eAAe,IAAI,OAAO,CAAgB;CACxD"}
@@ -0,0 +1,47 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ /** DepthOfField — Blender Compositor: Defocus node */
3
+ export class DepthOfField extends BasePass {
4
+ constructor(opts = {}) {
5
+ super();
6
+ this.passType = 'DepthOfField';
7
+ // Scene and camera are injected by CompositorOutput via the registry
8
+ // (BokehPass requires both at construction time)
9
+ this._scene = null;
10
+ this._camera = null;
11
+ this.parameters = {
12
+ focusDistance: opts.focusDistance ?? 10,
13
+ bokehScale: opts.bokehScale ?? 3,
14
+ maxBlur: opts.maxBlur ?? 5,
15
+ };
16
+ }
17
+ _threePassDeps() { return ['BokehPass']; }
18
+ _buildThree(_width, _height, reg) {
19
+ const Pass = reg['BokehPass'];
20
+ const scene = reg['_scene'];
21
+ const camera = reg['_camera'];
22
+ if (!Pass)
23
+ throw new Error('DepthOfField: BokehPass not found in three/addons.');
24
+ if (!scene)
25
+ throw new Error('DepthOfField: scene not injected — use CompositorOutput to compile.');
26
+ if (!camera)
27
+ throw new Error('DepthOfField: camera not injected — use CompositorOutput to compile.');
28
+ return new Pass(scene, camera, {
29
+ focus: this.parameters.focusDistance,
30
+ aperture: this.parameters.bokehScale * 0.00001,
31
+ maxblur: this.parameters.maxBlur * 0.001,
32
+ });
33
+ }
34
+ _buildPmndrs(reg) {
35
+ const Effect = reg['DepthOfFieldEffect'];
36
+ const camera = reg['_camera'];
37
+ if (!Effect)
38
+ throw new Error('DepthOfField: DepthOfFieldEffect not found in postprocessing.');
39
+ if (!camera)
40
+ throw new Error('DepthOfField: camera not injected — use CompositorOutput to compile.');
41
+ return new Effect(camera, {
42
+ focusDistance: this.parameters.focusDistance,
43
+ bokehScale: this.parameters.bokehScale,
44
+ });
45
+ }
46
+ get _isPmndrsEffect() { return true; }
47
+ }
@@ -0,0 +1,31 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ import type { PassRegistry } from '../core/BasePass.js';
3
+ export interface EdgeDetectOptions {
4
+ /** Edge line thickness in pixels. Default 1. */
5
+ thickness?: number;
6
+ /** Edge intensity multiplier. Default 1. */
7
+ strength?: number;
8
+ /** Edge colour as hex string. Default '#000000'. */
9
+ color?: string;
10
+ /** Mix original image with detected edges [0=edges only, 1=original+edges]. Default 1. */
11
+ mix?: number;
12
+ }
13
+ /**
14
+ * EdgeDetect — Blender Compositor: Filter node (Sobel operator type).
15
+ * Extracts edges from luminance using a Sobel kernel.
16
+ */
17
+ export declare class EdgeDetect extends BasePass {
18
+ readonly passType = "EdgeDetect";
19
+ parameters: {
20
+ thickness: number;
21
+ strength: number;
22
+ mix: number;
23
+ r: number;
24
+ g: number;
25
+ b: number;
26
+ };
27
+ constructor(opts?: EdgeDetectOptions);
28
+ _threePassDeps(): string[];
29
+ _buildThree(w: number, h: number, reg: PassRegistry): unknown;
30
+ }
31
+ //# sourceMappingURL=EdgeDetect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EdgeDetect.d.ts","sourceRoot":"","sources":["../../src/passes/EdgeDetect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,MAAM,WAAW,iBAAiB;IAChC,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0FAA0F;IAC1F,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;;GAGG;AACH,qBAAa,UAAW,SAAQ,QAAQ;IACtC,QAAQ,CAAC,QAAQ,gBAAe;IAChC,UAAU,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;gBAErF,IAAI,GAAE,iBAAsB;IAaxC,cAAc;IAEd,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO;CAkD9D"}
@@ -0,0 +1,69 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ /**
3
+ * EdgeDetect — Blender Compositor: Filter node (Sobel operator type).
4
+ * Extracts edges from luminance using a Sobel kernel.
5
+ */
6
+ export class EdgeDetect extends BasePass {
7
+ constructor(opts = {}) {
8
+ super();
9
+ this.passType = 'EdgeDetect';
10
+ const hex = (opts.color ?? '#000000').replace('#', '');
11
+ this.parameters = {
12
+ thickness: opts.thickness ?? 1,
13
+ strength: opts.strength ?? 1,
14
+ mix: opts.mix ?? 1,
15
+ r: parseInt(hex.substring(0, 2), 16) / 255,
16
+ g: parseInt(hex.substring(2, 4), 16) / 255,
17
+ b: parseInt(hex.substring(4, 6), 16) / 255,
18
+ };
19
+ }
20
+ _threePassDeps() { return ['ShaderPass']; }
21
+ _buildThree(w, h, reg) {
22
+ const ShaderPass = reg['ShaderPass'];
23
+ if (!ShaderPass)
24
+ throw new Error('EdgeDetect: ShaderPass not found.');
25
+ const { thickness, strength, mix, r, g, b } = this.parameters;
26
+ const shader = {
27
+ uniforms: {
28
+ tDiffuse: { value: null },
29
+ texelSize: { value: [thickness / w, thickness / h] },
30
+ strength: { value: strength },
31
+ edgeColor: { value: [r, g, b] },
32
+ mix: { value: mix },
33
+ },
34
+ vertexShader: `
35
+ varying vec2 vUv;
36
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0); }
37
+ `,
38
+ fragmentShader: `
39
+ uniform sampler2D tDiffuse;
40
+ uniform vec2 texelSize;
41
+ uniform float strength;
42
+ uniform vec3 edgeColor;
43
+ uniform float mix;
44
+ varying vec2 vUv;
45
+
46
+ float lum(vec2 uv) {
47
+ vec3 c = texture2D(tDiffuse, clamp(uv, 0.0, 1.0)).rgb;
48
+ return dot(c, vec3(0.299, 0.587, 0.114));
49
+ }
50
+
51
+ void main() {
52
+ vec2 t = texelSize;
53
+ // Sobel X and Y kernels
54
+ float gx = -lum(vUv + vec2(-t.x, t.y)) + lum(vUv + vec2( t.x, t.y))
55
+ - 2.0 * lum(vUv + vec2(-t.x, 0.0)) + 2.0 * lum(vUv + vec2( t.x, 0.0))
56
+ - lum(vUv + vec2(-t.x, -t.y)) + lum(vUv + vec2( t.x, -t.y));
57
+ float gy = -lum(vUv + vec2(-t.x, t.y)) - 2.0 * lum(vUv + vec2(0.0, t.y)) - lum(vUv + vec2( t.x, t.y))
58
+ + lum(vUv + vec2(-t.x, -t.y)) + 2.0 * lum(vUv + vec2(0.0, -t.y)) + lum(vUv + vec2( t.x, -t.y));
59
+ float edge = clamp(sqrt(gx*gx + gy*gy) * strength, 0.0, 1.0);
60
+
61
+ vec4 base = texture2D(tDiffuse, vUv);
62
+ vec3 out_ = base.rgb * mix + edgeColor * edge * (1.0 - mix * (1.0 - edge));
63
+ gl_FragColor = vec4(out_, base.a);
64
+ }
65
+ `,
66
+ };
67
+ return new ShaderPass(shader);
68
+ }
69
+ }
@@ -0,0 +1,19 @@
1
+ import { BasePass } from '../core/BasePass.js';
2
+ import type { PassRegistry } from '../core/BasePass.js';
3
+ export interface ExposureOptions {
4
+ /** Exposure value in EV stops. Default 0 (no change). Blender: Exposure → Exposure */
5
+ exposure?: number;
6
+ }
7
+ /** Exposure — Blender Compositor: Exposure node */
8
+ export declare class Exposure extends BasePass {
9
+ readonly passType = "Exposure";
10
+ parameters: {
11
+ exposure: number;
12
+ };
13
+ constructor(opts?: ExposureOptions);
14
+ _threePassDeps(): string[];
15
+ _buildThree(_width: number, _height: number, reg: PassRegistry): unknown;
16
+ _buildPmndrs(reg: PassRegistry): unknown;
17
+ get _isPmndrsEffect(): boolean;
18
+ }
19
+ //# sourceMappingURL=Exposure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Exposure.d.ts","sourceRoot":"","sources":["../../src/passes/Exposure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,MAAM,WAAW,eAAe;IAC9B,sFAAsF;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,mDAAmD;AACnD,qBAAa,QAAS,SAAQ,QAAQ;IACpC,QAAQ,CAAC,QAAQ,cAAa;IAC9B,UAAU,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;gBAEpB,IAAI,GAAE,eAAoB;IAKtC,cAAc;IAEd,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO;IA0B/D,YAAY,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO;IAMjD,IAAa,eAAe,IAAI,OAAO,CAAgB;CACxD"}