From 4f66c2f2fcd077c6155f45b354043eec24148744 Mon Sep 17 00:00:00 2001 From: Felix Palmer Date: Thu, 2 Nov 2023 09:27:46 +0100 Subject: [PATCH] Always provide all the shadowMap bindings --- modules/core/src/shaderlib/shadow/shadow.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/core/src/shaderlib/shadow/shadow.ts b/modules/core/src/shaderlib/shadow/shadow.ts index 6bbcb62c2a0..ca16bed8881 100644 --- a/modules/core/src/shaderlib/shadow/shadow.ts +++ b/modules/core/src/shaderlib/shadow/shadow.ts @@ -234,12 +234,11 @@ function createShadowUniforms( for (let i = 0; i < viewProjectionMatrices.length; i++) { uniforms[`shadow_uViewProjectionMatrices[${i}]`] = viewProjectionMatrices[i]; uniforms[`shadow_uProjectCenters[${i}]`] = projectCenters[i]; + } - if (opts.shadowMaps && opts.shadowMaps.length > 0) { - uniforms[`shadow_uShadowMap${i}`] = opts.shadowMaps[i]; - } else { - uniforms[`shadow_uShadowMap${i}`] = opts.dummyShadowMap; - } + for (let i = 0; i < 2; i++) { + uniforms[`shadow_uShadowMap${i}`] = + (opts.shadowMaps && opts.shadowMaps[i]) || opts.dummyShadowMap; } return uniforms; }