Skip to content

Conversation

@Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Dec 19, 2025

Fixed #32588.

Description

Shadow map uniforms are already updated in below code block.

// Pre-allocate texture units for shadow samplers before setting data textures
if ( materialProperties.needsLights ) {
// Set shadow map uniforms first to ensure they get the first texture units
if ( lights.state.directionalShadowMap.length > 0 ) {
p_uniforms.setValue( _gl, 'directionalShadowMap', lights.state.directionalShadowMap, textures );
}
if ( lights.state.spotShadowMap.length > 0 ) {
p_uniforms.setValue( _gl, 'spotShadowMap', lights.state.spotShadowMap, textures );
}
if ( lights.state.pointShadowMap.length > 0 ) {
p_uniforms.setValue( _gl, 'pointShadowMap', lights.state.pointShadowMap, textures );
}
}

They must be removed from the material uniform list otherwise they are updated (and allocated) twice.

@github-actions
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 355.56
84.51
355.33
84.47
-231 B
-34 B
WebGPU 617.29
171.26
617.29
171.26
+0 B
+0 B
WebGPU Nodes 615.89
171.01
615.89
171.01
+0 B
+0 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 487.73
119.38
487.5
119.34
-231 B
-37 B
WebGPU 688.74
187.04
688.74
187.04
+0 B
+0 B
WebGPU Nodes 638.58
174.23
638.58
174.23
+0 B
+0 B

@Mugen87 Mugen87 merged commit 48c607f into mrdoob:dev Dec 20, 2025
10 checks passed
@Mugen87 Mugen87 added this to the r183 milestone Dec 20, 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: Make colored shadows optional to enable more shadow casting lights.

1 participant