|
|
@@ -518,24 +518,40 @@ class ShadowNode extends ShadowBaseNode {
|
|
|
|
|
|
let shadowColor;
|
|
|
|
|
|
- if ( shadowMap.texture.isCubeTexture ) {
|
|
|
+ if ( renderer.shadowMap.color === true ) {
|
|
|
|
|
|
- // For cube shadow maps (point lights), use cubeTexture with vec3 coordinates
|
|
|
- shadowColor = cubeTexture( shadowMap.texture, shadowCoord.xyz );
|
|
|
+ if ( shadowMap.texture.isCubeTexture ) {
|
|
|
|
|
|
- } else {
|
|
|
+ // For cube shadow maps (point lights), use cubeTexture with vec3 coordinates
|
|
|
+ shadowColor = cubeTexture( shadowMap.texture, shadowCoord.xyz );
|
|
|
|
|
|
- shadowColor = texture( shadowMap.texture, shadowCoord );
|
|
|
+ } else {
|
|
|
|
|
|
- if ( depthTexture.isArrayTexture ) {
|
|
|
+ shadowColor = texture( shadowMap.texture, shadowCoord );
|
|
|
|
|
|
- shadowColor = shadowColor.depth( this.depthLayer );
|
|
|
+ if ( depthTexture.isArrayTexture ) {
|
|
|
+
|
|
|
+ shadowColor = shadowColor.depth( this.depthLayer );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- const shadowOutput = mix( 1, shadowNode.rgb.mix( shadowColor, 1 ), shadowIntensity.mul( shadowColor.a ) ).toVar();
|
|
|
+ //
|
|
|
+
|
|
|
+ let shadowOutput;
|
|
|
+
|
|
|
+ if ( shadowColor ) {
|
|
|
+
|
|
|
+ shadowOutput = mix( 1, shadowNode.rgb.mix( shadowColor, 1 ), shadowIntensity.mul( shadowColor.a ) ).toVar();
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ shadowOutput = mix( 1, shadowNode, shadowIntensity ).toVar();
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
this.shadowMap = shadowMap;
|
|
|
this.shadow.map = shadowMap;
|
|
|
@@ -544,17 +560,23 @@ class ShadowNode extends ShadowBaseNode {
|
|
|
|
|
|
const inspectName = `${ this.light.type } Shadow [ ${ this.light.name || 'ID: ' + this.light.id } ]`;
|
|
|
|
|
|
- return shadowOutput.toInspector( `${ inspectName } / Color`, () => {
|
|
|
+ if ( shadowColor ) {
|
|
|
|
|
|
- if ( this.shadowMap.texture.isCubeTexture ) {
|
|
|
+ shadowOutput.toInspector( `${ inspectName } / Color`, () => {
|
|
|
|
|
|
- return cubeTexture( this.shadowMap.texture );
|
|
|
+ if ( this.shadowMap.texture.isCubeTexture ) {
|
|
|
|
|
|
- }
|
|
|
+ return cubeTexture( this.shadowMap.texture );
|
|
|
|
|
|
- return texture( this.shadowMap.texture );
|
|
|
+ }
|
|
|
+
|
|
|
+ return texture( this.shadowMap.texture );
|
|
|
+
|
|
|
+ } );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- } ).toInspector( `${ inspectName } / Depth`, () => {
|
|
|
+ return shadowOutput.toInspector( `${ inspectName } / Depth`, () => {
|
|
|
|
|
|
// TODO: Use linear depth
|
|
|
|