Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postprocessing",
"version": "6.37.4",
"version": "6.37.5",
"description": "A post processing library for three.js.",
"homepage": "https://github.com/pmndrs/postprocessing",
"license": "Zlib",
Expand Down Expand Up @@ -90,11 +90,11 @@
"watch:js": "node esbuild -w"
},
"peerDependencies": {
"three": ">= 0.157.0 < 0.178.0"
"three": ">= 0.157.0 < 0.179.0"
},
"devDependencies": {
"@tweakpane/core": "2.x.x",
"@types/node": "22.x.x",
"@types/node": "24.x.x",
"@types/three": "0.x.x",
"@typescript-eslint/eslint-plugin": "8.x.x",
"@typescript-eslint/parser": "8.x.x",
Expand Down
1,341 changes: 677 additions & 664 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/effects/blending/glsl/add.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, x + y, opacity);
return mix(x, vec4(x.rgb + y.rgb, y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/alpha.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, y, min(y.a, opacity));
return mix(x, y, y.a * opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/average.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, (x + y) * 0.5, opacity);
return mix(x, vec4((x.rgb + y.rgb) * 0.5, y.a), opacity);

}
5 changes: 3 additions & 2 deletions src/effects/blending/glsl/color-burn.frag
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

vec4 z = mix(step(0.0, y) * (1.0 - min(vec4(1.0), (1.0 - x) / y)), vec4(1.0), step(1.0, x));
return mix(x, z, opacity);
vec3 a = x.rgb, b = y.rgb;
vec3 z = mix(step(0.0, b) * (1.0 - min(vec3(1.0), (1.0 - a) / b)), vec3(1.0), step(1.0, a));
return mix(x, vec4(z, y.a), opacity);

}
5 changes: 3 additions & 2 deletions src/effects/blending/glsl/color-dodge.frag
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

vec4 z = step(0.0, x) * mix(min(vec4(1.0), x / max(1.0 - y, 1e-9)), vec4(1.0), step(1.0, y));
return mix(x, z, opacity);
vec3 a = x.rgb, b = y.rgb;
vec3 z = step(0.0, a) * mix(min(vec3(1.0), a / max(1.0 - b, 1e-9)), vec3(1.0), step(1.0, b));
return mix(x, vec4(z, y.a), opacity);

}
4 changes: 2 additions & 2 deletions src/effects/blending/glsl/color.frag
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

vec3 xHSL = RGBToHSL(x.rgb);
vec3 yHSL = RGBToHSL(y.rgb);
vec3 z = HSLToRGB(vec3(yHSL.rg, xHSL.b));
return vec4(mix(x.rgb, z, opacity), y.a);
vec3 z = HSLToRGB(vec3(yHSL.xy, xHSL.z));
return mix(x, vec4(z, y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/darken.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, min(x, y), opacity);
return mix(x, vec4(min(x.rgb, y.rgb), y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/difference.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, abs(x - y), opacity);
return mix(x, vec4(abs(x.rgb - y.rgb), y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/divide.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, x / max(y, 1e-12), opacity);
return mix(x, vec4(x.rgb / max(y.rgb, 1e-12), y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/exclusion.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, (x + y - 2.0 * x * y), opacity);
return mix(x, vec4((x.rgb + y.rgb - 2.0 * x.rgb * y.rgb), y.a), opacity);

}
7 changes: 4 additions & 3 deletions src/effects/blending/glsl/hard-light.frag
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

vec4 a = min(x, 1.0), b = min(y, 1.0);
vec4 z = mix(2.0 * a * b, 1.0 - 2.0 * (1.0 - a) * (1.0 - b), step(0.5, y));
return mix(x, z, opacity);
vec3 a = min(x.rgb, 1.0);
vec3 b = min(y.rgb, 1.0);
vec3 z = mix(2.0 * a * b, 1.0 - 2.0 * (1.0 - a) * (1.0 - b), step(0.5, b));
return mix(x, vec4(z, y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/hard-mix.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, step(1.0, x + y), opacity);
return mix(x, vec4(step(1.0, x.rgb + y.rgb), y.a), opacity);

}
4 changes: 2 additions & 2 deletions src/effects/blending/glsl/hue.frag
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

vec3 xHSL = RGBToHSL(x.rgb);
vec3 yHSL = RGBToHSL(y.rgb);
vec3 z = HSLToRGB(vec3(yHSL.r, xHSL.gb));
return vec4(mix(x.rgb, z, opacity), y.a);
vec3 z = HSLToRGB(vec3(yHSL.x, xHSL.yz));
return mix(x, vec4(z, y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/invert-rgb.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, y * (1.0 - x), opacity);
return mix(x, vec4(y.rgb * (1.0 - x.rgb), y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/invert.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, 1.0 - y, opacity);
return mix(x, vec4(1.0 - y.rgb, y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/lighten.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, max(x, y), opacity);
return mix(x, vec4(max(x.rgb, y.rgb), y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/linear-burn.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, clamp(y + x - 1.0, 0.0, 1.0), opacity);
return mix(x, vec4(clamp(y.rgb + x.rgb - 1.0, 0.0, 1.0), y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/linear-dodge.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, min(x + y, 1.0), opacity);
return mix(x, vec4(min(x.rgb + y.rgb, 1.0), y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/linear-light.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, clamp(2.0 * y + x - 1.0, 0.0, 1.0), opacity);
return mix(x, vec4(clamp(2.0 * y.rgb + x.rgb - 1.0, 0.0, 1.0), y.a), opacity);

}
4 changes: 2 additions & 2 deletions src/effects/blending/glsl/luminosity.frag
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

vec3 xHSL = RGBToHSL(x.rgb);
vec3 yHSL = RGBToHSL(y.rgb);
vec3 z = HSLToRGB(vec3(xHSL.rg, yHSL.b));
return vec4(mix(x.rgb, z, opacity), y.a);
vec3 z = HSLToRGB(vec3(xHSL.xy, yHSL.z));
return mix(x, vec4(z, y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/multiply.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, x * y, opacity);
return mix(x, vec4(x.rgb * y.rgb, y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/negation.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, 1.0 - abs(1.0 - x - y), opacity);
return mix(x, vec4(1.0 - abs(1.0 - x.rgb - y.rgb), y.a), opacity);

}
4 changes: 2 additions & 2 deletions src/effects/blending/glsl/overlay.frag
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

vec4 z = mix(2.0 * y * x, 1.0 - 2.0 * (1.0 - y) * (1.0 - x), step(0.5, x));
return mix(x, z, opacity);
vec3 z = mix(2.0 * y.rgb * x.rgb, 1.0 - 2.0 * (1.0 - y.rgb) * (1.0 - x.rgb), step(0.5, x.rgb));
return mix(x, vec4(z, y.a), opacity);

}
12 changes: 6 additions & 6 deletions src/effects/blending/glsl/pin-light.frag
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

vec4 y2 = 2.0 * y;
vec3 y2 = 2.0 * y.rgb;

vec4 z = mix(
mix(y2, x, step(0.5 * x, y)),
max(vec4(0.0), y2 - 1.0),
step(x, (y2 - 1.0))
vec3 z = mix(
mix(y2, x.rgb, step(0.5 * x.rgb, y.rgb)),
max(y2 - 1.0, vec3(0.0)),
step(x.rgb, y2 - 1.0)
);

return mix(x, z, opacity);
return mix(x, vec4(z, y.a), opacity);

}
4 changes: 2 additions & 2 deletions src/effects/blending/glsl/reflect.frag
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

vec4 z = mix(min(x * x / max(1.0 - y, 1e-12), 1.0), y, step(1.0, y));
return mix(x, z, opacity);
vec3 z = mix(min(x.rgb * x.rgb / max(1.0 - y.rgb, 1e-12), 1.0), y.rgb, step(1.0, y.rgb));
return mix(x, vec4(z, y.a), opacity);

}
4 changes: 2 additions & 2 deletions src/effects/blending/glsl/saturation.frag
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

vec3 xHSL = RGBToHSL(x.rgb);
vec3 yHSL = RGBToHSL(y.rgb);
vec3 z = HSLToRGB(vec3(xHSL.r, yHSL.g, xHSL.b));
return vec4(mix(x.rgb, z, opacity), y.a);
vec3 z = HSLToRGB(vec3(xHSL.x, yHSL.y, xHSL.z));
return mix(x, vec4(z, y.a), opacity);

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/screen.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, x + y - min(x * y, 1.0), opacity);
return mix(x, vec4(x.rgb + y.rgb - min(x.rgb * y.rgb, 1.0), y.a), opacity);

}
24 changes: 13 additions & 11 deletions src/effects/blending/glsl/soft-light.frag
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

vec4 y2 = 2.0 * y;
vec4 w = step(0.5, y);
vec3 a = x.rgb;
vec3 b = y.rgb;

vec4 z = mix(
x - (1.0 - y2) * x * (1.0 - x),
mix(
x + (y2 - 1.0) * (sqrt(x) - x),
x + (y2 - 1.0) * x * ((16.0 * x - 12.0) * x + 3.0),
w * (1.0 - step(0.25, x))
),
w
vec3 y2 = 2.0 * b;
vec3 w = step(0.5, b);

vec3 c = a - (1.0 - y2) * a * (1.0 - a);
vec3 d = mix(
a + (y2 - 1.0) * (sqrt(a) - a),
a + (y2 - 1.0) * a * ((16.0 * a - 12.0) * a + 3.0),
w * (1.0 - step(0.25, a))
);

return mix(x, z, opacity);
vec3 z = mix(c, d, w);

return mix(x, vec4(z, y.a), opacity);

}
1 change: 1 addition & 0 deletions src/effects/blending/glsl/src.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

// x is the color that is already there (DST), y is the new color (SRC)
return y;

}
2 changes: 1 addition & 1 deletion src/effects/blending/glsl/subtract.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

return mix(x, max(x + y - 1.0, 0.0), opacity);
return mix(x, vec4(max(x.rgb + y.rgb - 1.0, 0.0), y.a), opacity);

}
10 changes: 5 additions & 5 deletions src/effects/blending/glsl/vivid-light.frag
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
vec4 blend(const in vec4 x, const in vec4 y, const in float opacity) {

vec4 z = mix(
max(1.0 - min((1.0 - x) / (2.0 * y), 1.0), 0.0),
min(x / (2.0 * (1.0 - y)), 1.0),
step(0.5, y)
vec3 z = mix(
max(1.0 - min((1.0 - x.rgb) / (2.0 * y.rgb), 1.0), 0.0),
min(x.rgb / (2.0 * (1.0 - y.rgb)), 1.0),
step(0.5, y.rgb)
);

return mix(x, z, opacity);
return mix(x, vec4(z, y.a), opacity);

}