Skip to content

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Feb 9, 2025

Related issue: #30329

Description

The PR makes sure WebGLBackend.clear() honors the user-defined clear depth and stencil values.

It also makes sure clear colors set via setClearColor() are in the working color space and honor premultiplied alpha.

@Mugen87 Mugen87 marked this pull request as draft February 9, 2025 11:13
Copy link

github-actions bot commented Feb 9, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.28
78.27
336.28
78.27
+0 B
+0 B
WebGPU 517.73
143.83
517.98
143.9
+247 B
+63 B
WebGPU Nodes 517.2
143.72
517.44
143.78
+247 B
+64 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 465.32
112.14
465.32
112.14
+0 B
+0 B
WebGPU 589.63
159.95
589.87
160
+247 B
+52 B
WebGPU Nodes 544.99
149.48
545.24
149.54
+247 B
+63 B

@Mugen87 Mugen87 force-pushed the dev3 branch 3 times, most recently from 7c34f66 to 05fc928 Compare February 9, 2025 11:41
@Mugen87 Mugen87 changed the title WebGLBackend: Fix and simpify clear(). WebGPURenderer: Refactor clear(). Feb 9, 2025
@Mugen87 Mugen87 marked this pull request as ready for review February 9, 2025 11:48
@Mugen87 Mugen87 marked this pull request as draft February 9, 2025 11:51
@Mugen87 Mugen87 changed the title WebGPURenderer: Refactor clear(). WebGLBackend: Fix clear(). Feb 9, 2025
@@ -1917,7 +1917,17 @@ class Renderer {
renderContext.depth = renderTarget.depthBuffer;
renderContext.stencil = renderTarget.stencilBuffer;
// #30329
renderContext.clearColorValue = this._clearColor;
renderContext.clearColorValue = this.backend.getClearColor();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color values assigned to RenderContext.clearColorValue must be in working color space and must honor premultiply alpha. Both were missing so far leading to incorrect clear colors when using renderer.setClearColor().

@Mugen87 Mugen87 marked this pull request as ready for review February 9, 2025 12:00
@Mugen87 Mugen87 added this to the r174 milestone Feb 9, 2025
@Mugen87 Mugen87 merged commit 14d99e0 into mrdoob:dev Feb 9, 2025
12 checks passed
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.

1 participant