Skip to content

TSL: Add premult and unpremult#31114

Merged
sunag merged 4 commits into
mrdoob:devfrom
sunag:dev-premult
May 15, 2025
Merged

TSL: Add premult and unpremult#31114
sunag merged 4 commits into
mrdoob:devfrom
sunag:dev-premult

Conversation

@sunag
Copy link
Copy Markdown
Collaborator

@sunag sunag commented May 15, 2025

Description

Add premult and unpremult TSL functions.

@sunag sunag added this to the r177 milestone May 15, 2025
@sunag sunag marked this pull request as ready for review May 15, 2025 06:14
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 337.26
78.64
337.26
78.64
+0 B
+0 B
WebGPU 549.71
152.38
549.9
152.44
+191 B
+57 B
WebGPU Nodes 549.06
152.23
549.25
152.29
+191 B
+57 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 467.34
112.95
467.34
112.95
+0 B
+0 B
WebGPU 624.5
169.06
624.5
169.06
+0 B
+0 B
WebGPU Nodes 579.35
158.35
579.35
158.35
+0 B
+0 B

@sunag sunag merged commit 54e3665 into mrdoob:dev May 15, 2025
12 checks passed
@sunag sunag deleted the dev-premult branch May 15, 2025 06:24
@mrdoob
Copy link
Copy Markdown
Owner

mrdoob commented May 15, 2025

Out of curiosity, why not premultiply and unpremultiply?

May also be confusing that this is premult and the math function is mul...

@WestLangley
Copy link
Copy Markdown
Collaborator

@mrdoob For clarity, I'd suggest premultiplyRGB and unpremultiplyRGB.

RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* fix clear texture and facing away if `bounce` is `false`

* add `premult`, `unpremult`

* cleanup
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* fix clear texture and facing away if `bounce` is `false`

* add `premult`, `unpremult`

* cleanup
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