@@ -518,24 +518,40 @@ class ShadowNode extends ShadowBaseNode {
518518
519519 let shadowColor ;
520520
521- if ( shadowMap . texture . isCubeTexture ) {
521+ if ( renderer . shadowMap . color === true ) {
522522
523- // For cube shadow maps (point lights), use cubeTexture with vec3 coordinates
524- shadowColor = cubeTexture ( shadowMap . texture , shadowCoord . xyz ) ;
523+ if ( shadowMap . texture . isCubeTexture ) {
525524
526- } else {
525+ // For cube shadow maps (point lights), use cubeTexture with vec3 coordinates
526+ shadowColor = cubeTexture ( shadowMap . texture , shadowCoord . xyz ) ;
527527
528- shadowColor = texture ( shadowMap . texture , shadowCoord ) ;
528+ } else {
529529
530- if ( depthTexture . isArrayTexture ) {
530+ shadowColor = texture ( shadowMap . texture , shadowCoord ) ;
531531
532- shadowColor = shadowColor . depth ( this . depthLayer ) ;
532+ if ( depthTexture . isArrayTexture ) {
533+
534+ shadowColor = shadowColor . depth ( this . depthLayer ) ;
535+
536+ }
533537
534538 }
535539
536540 }
537541
538- const shadowOutput = mix ( 1 , shadowNode . rgb . mix ( shadowColor , 1 ) , shadowIntensity . mul ( shadowColor . a ) ) . toVar ( ) ;
542+ //
543+
544+ let shadowOutput ;
545+
546+ if ( shadowColor ) {
547+
548+ shadowOutput = mix ( 1 , shadowNode . rgb . mix ( shadowColor , 1 ) , shadowIntensity . mul ( shadowColor . a ) ) . toVar ( ) ;
549+
550+ } else {
551+
552+ shadowOutput = mix ( 1 , shadowNode , shadowIntensity ) . toVar ( ) ;
553+
554+ }
539555
540556 this . shadowMap = shadowMap ;
541557 this . shadow . map = shadowMap ;
@@ -544,17 +560,23 @@ class ShadowNode extends ShadowBaseNode {
544560
545561 const inspectName = `${ this . light . type } Shadow [ ${ this . light . name || 'ID: ' + this . light . id } ]` ;
546562
547- return shadowOutput . toInspector ( ` ${ inspectName } / Color` , ( ) => {
563+ if ( shadowColor ) {
548564
549- if ( this . shadowMap . texture . isCubeTexture ) {
565+ shadowOutput . toInspector ( ` ${ inspectName } / Color` , ( ) => {
550566
551- return cubeTexture ( this . shadowMap . texture ) ;
567+ if ( this . shadowMap . texture . isCubeTexture ) {
552568
553- }
569+ return cubeTexture ( this . shadowMap . texture ) ;
554570
555- return texture ( this . shadowMap . texture ) ;
571+ }
572+
573+ return texture ( this . shadowMap . texture ) ;
574+
575+ } ) ;
576+
577+ }
556578
557- } ) . toInspector ( `${ inspectName } / Depth` , ( ) => {
579+ return shadowOutput . toInspector ( `${ inspectName } / Depth` , ( ) => {
558580
559581 // TODO: Use linear depth
560582
0 commit comments