Skip to content

NodeMaterial: Make sure fog is applied only once.#31463

Merged
Mugen87 merged 4 commits into
mrdoob:devfrom
Mugen87:dev3
Jul 21, 2025
Merged

NodeMaterial: Make sure fog is applied only once.#31463
Mugen87 merged 4 commits into
mrdoob:devfrom
Mugen87:dev3

Conversation

@Mugen87

@Mugen87 Mugen87 commented Jul 21, 2025

Copy link
Copy Markdown
Collaborator

Fixes #31462

Description

Since fog() relies on output and there are assignments to output in NodeMaterial.setup(), there is a side-effect that leads to #31462. Using toStack() avoids the duplication.

@sunag There might be a better point for calling toSack() or even another solution but the PR in its current form at least fixes #31462.

@github-actions

github-actions Bot commented Jul 21, 2025

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.04
78.86
338.04
78.86
+0 B
+0 B
WebGPU 559.09
154.77
559.1
154.77
+10 B
+2 B
WebGPU Nodes 558.01
154.55
558.02
154.56
+10 B
+3 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 469.29
113.56
469.29
113.56
+0 B
+0 B
WebGPU 634.38
171.81
634.39
171.81
+10 B
+6 B
WebGPU Nodes 589.51
161.12
589.52
161.12
+10 B
+2 B

@sunag

sunag commented Jul 21, 2025

Copy link
Copy Markdown
Collaborator

It's all good to me 👍

@Mugen87 Mugen87 merged commit 74efc68 into mrdoob:dev Jul 21, 2025
9 checks passed
@Mugen87 Mugen87 added this to the r179 milestone Jul 21, 2025
@Mugen87 Mugen87 changed the title NodeMaterial: Fix fog. NodeMaterial: Make sure fog is applied only once. Jul 21, 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.

WebGPURenderer: Fog applied twice in all materials

2 participants