Skip to content

Conversation

@Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jan 27, 2026

Related issue: -

Description

This PR refactors an open issue in the WebGPURenderer build. It exports CubeRenderTarget and removes any dependencies to WebGLCubeRenderTarget. WebGLCubeRenderTarget is not exported in Three.Core.js anymore but only Three.js which means it's only available in the WebGLRenderer builds.

WebGLCubeRenderTarget has dependencies to ShaderMaterial and UniformsUtils which are unrelated to WebGPURenderer. The dependencies are caused by fromEquirectangularTexture() which holds material system specific code.

CubeRenderTarget.fromEquirectangularTexture() also holds material system specific code so it can't be placed in Three.Core.js. That's why WebGLCubeRenderTarget can't be derived from CubeRenderTarget as well.

CubeRenderTarget is now derived from RenderTarget and all WebGPU examples now use CubeRenderTarget. This change must be noted in the migration guide since applications must use CubeRenderTarget when they switch to WebGPURenderer.

@github-actions
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 357.49
84.84
359.21
85.29
+1.72 kB
+448 B
WebGPU 622.71
172.91
622.94
173.01
+236 B
+100 B
WebGPU Nodes 621.31
172.67
621.52
172.77
+213 B
+96 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 490.47
119.9
490.47
119.49
+0 B
-411 B
WebGPU 693.82
188.21
689.6
186.26
-4.21 kB
-1.95 kB
WebGPU Nodes 643.2
175.31
638.99
173.68
-4.21 kB
-1.63 kB
@Mugen87 Mugen87 marked this pull request as draft January 27, 2026 21:15
@Mugen87 Mugen87 marked this pull request as ready for review January 27, 2026 21:33
@Mugen87 Mugen87 added this to the r184 milestone Jan 28, 2026
@Mugen87
Copy link
Collaborator Author

Mugen87 commented Jan 28, 2026

@sunag In the next step, I'm going to update MaterialLoader so it does not import ShaderMaterial and RawShaderMaterial. These material types will be added to the loader's material lib with a new static method in the WebGLRenderer builds. In this way, the WebGPURenderer builds will be free from ShaderMaterial, RawShaderMaterial, any shader chunks and UniformUtils.

@sunag sunag merged commit 819cb9b into mrdoob:dev Jan 28, 2026
10 checks passed
@Mugen87 Mugen87 modified the milestones: r184, r183 Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants