Skip to content

TSL: Add premult and unpremult #31114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 15, 2025
Merged

TSL: Add premult and unpremult #31114

merged 4 commits into from
May 15, 2025

Conversation

sunag
Copy link
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
Copy link

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