Skip to content

Renderers: Correct the blending formulas#31246

Merged
sunag merged 2 commits into
mrdoob:devfrom
WestLangley:dev-blend_modes
Jun 10, 2025
Merged

Renderers: Correct the blending formulas#31246
sunag merged 2 commits into
mrdoob:devfrom
WestLangley:dev-blend_modes

Conversation

@WestLangley

Copy link
Copy Markdown
Collaborator

Correct the blending formulas for WebGLRenderer, and for both backends of WebGPURenderer.

The NormalBlending formulas are correct, so no changes are needed.

AdditiveBlending had a minor error, which is fixed.

SubtractiveBlending and MultiplyBlending have never been correct. The changes here align with the behavior familiar to Photoshop users.

... more comments later ...

@WestLangley WestLangley added this to the r178 milestone Jun 8, 2025
@github-actions

github-actions Bot commented Jun 8, 2025

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 337.4
78.67
337.53
78.73
+129 B
+52 B
WebGPU 554.99
153.61
555.29
153.68
+302 B
+75 B
WebGPU Nodes 554.34
153.46
554.64
153.53
+302 B
+74 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 468.59
113.33
468.72
113.38
+129 B
+50 B
WebGPU 630.02
170.38
630.32
170.46
+302 B
+76 B
WebGPU Nodes 584.87
159.73
585.17
159.81
+302 B
+75 B

@WestLangley

WestLangley commented Jun 9, 2025

Copy link
Copy Markdown
Collaborator Author

For MultiplyBlending and SubtractiveBlending the opacity of the blend layer controls the intensity of the effect -- not the opacity of the result.

@WestLangley WestLangley marked this pull request as ready for review June 9, 2025 05:03
@sunag sunag merged commit 4ee7352 into mrdoob:dev Jun 10, 2025
12 checks passed
@WestLangley WestLangley deleted the dev-blend_modes branch June 10, 2025 17:15
@Mugen87

Mugen87 commented Jun 10, 2025

Copy link
Copy Markdown
Collaborator

I've added a note about this change in the migration guide: https://github.com/mrdoob/three.js/wiki/Migration-Guide#177--178

@WestLangley WestLangley changed the title Src: Correct the blending formulas Renderers: Correct the blending formulas Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants