Skip to content

NodeManager: Correctly dispose of background mesh.#34108

Merged
Mugen87 merged 1 commit into
mrdoob:devfrom
Mugen87:dev2
Jul 24, 2026
Merged

NodeManager: Correctly dispose of background mesh.#34108
Mugen87 merged 1 commit into
mrdoob:devfrom
Mugen87:dev2

Conversation

@Mugen87

@Mugen87 Mugen87 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Fixed #34103.

Description

When a texture is assigned to Scene.background, the renderer creates an internal node. This node has a dispose() routine but it only ever executes if the node is maintained on app level via Scene.backgroundNode and node.dispose() is called manually.

When the app just assigns a texture and calls dispose(), the above node is never removed. Since there is no Scene.dispose(), the only way to get rid of internal resources is to couple the texture disposal with the background node disposal. The PR implements that in NodeManager.

@Mugen87 Mugen87 added this to the r186 milestone Jul 24, 2026
@github-actions

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 365.88
86.71
365.88
86.71
+0 B
+0 B
WebGPU 683.3
189.04
683.47
189.09
+169 B
+46 B
WebGPU Nodes 681.29
188.72
681.46
188.76
+169 B
+46 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 510.55
124.02
510.55
124.02
+0 B
+0 B
WebGPU 761.67
205.09
761.84
205.14
+169 B
+46 B
WebGPU Nodes 711.17
192.51
711.34
192.56
+169 B
+45 B

@Mugen87
Mugen87 merged commit e21b3d9 into mrdoob:dev Jul 24, 2026
10 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.

WebGPURenderer: scene.background leaks renderer resources when recreating Scene instances

1 participant