Skip to content

Commit d5cb6d3

Browse files
committed
Fix: when shadows are disabled, light contribution still needs to be considered
1 parent 778eb8c commit d5cb6d3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

examples/jsm/csm/CSMShader.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,15 @@ IncidentLight directLight;
162162
163163
}
164164
#pragma unroll_loop_end
165-
#else
165+
#elif defined (USE_SHADOWMAP)
166166
167167
#pragma unroll_loop_start
168168
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
169169
170170
directionalLight = directionalLights[ i ];
171171
getDirectionalLightInfo( directionalLight, directLight );
172172
173-
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
173+
#if ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
174174
175175
directionalLightShadow = directionalLightShadows[ i ];
176176
if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
@@ -182,6 +182,12 @@ IncidentLight directLight;
182182
}
183183
#pragma unroll_loop_end
184184
185+
#else
186+
187+
// note: no loop here - all CSM lights are in fact one light only
188+
getDirectionalLightInfo( directionalLights[0], directLight );
189+
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
190+
185191
#endif
186192
187193
#if ( NUM_DIR_LIGHTS > NUM_DIR_LIGHT_SHADOWS)

0 commit comments

Comments
 (0)