소스 검색

LightShadow: Add `intensity`. (#28588)

* LightShadow: Add `intensity`.

* CSMShader: Fix `getShadow()` call.

* WebGLRenderer: Fix copy/paste error.
Michael Herzog 1 년 전
부모
커밋
8306df542f

+ 5 - 0
docs/api/ar/lights/shadows/LightShadow.html

@@ -46,6 +46,11 @@
 		
 		
 		<h3>[property:Integer blurSamples]</h3>
 		<h3>[property:Integer blurSamples]</h3>
 		<p>عدد العينات المستخدمة عند طمس خريطة ظل VSM.</p>
 		<p>عدد العينات المستخدمة عند طمس خريطة ظل VSM.</p>
+
+		<h3>[property:Float intensity]</h3>
+		<p>
+			The intensity of the shadow. The default is `1`. Valid values are in the range `[0, 1]`.
+		</p>
 		
 		
 		<h3>[property:WebGLRenderTarget map]</h3>
 		<h3>[property:WebGLRenderTarget map]</h3>
 		<p>
 		<p>

+ 5 - 0
docs/api/en/lights/shadows/LightShadow.html

@@ -47,6 +47,11 @@
 		<h3>[property:Integer blurSamples]</h3>
 		<h3>[property:Integer blurSamples]</h3>
 		<p>The amount of samples to use when blurring a VSM shadow map.</p>
 		<p>The amount of samples to use when blurring a VSM shadow map.</p>
 
 
+		<h3>[property:Float intensity]</h3>
+		<p>
+			The intensity of the shadow. The default is `1`. Valid values are in the range `[0, 1]`.
+		</p>
+
 		<h3>[property:WebGLRenderTarget map]</h3>
 		<h3>[property:WebGLRenderTarget map]</h3>
 		<p>
 		<p>
 			The depth map generated using the internal camera; a location beyond a
 			The depth map generated using the internal camera; a location beyond a

+ 5 - 0
docs/api/it/lights/shadows/LightShadow.html

@@ -50,6 +50,11 @@
       La quantità di campioni da utilizzare durante la sfocatura di una mappa ombra VSM.
       La quantità di campioni da utilizzare durante la sfocatura di una mappa ombra VSM.
 		</p>
 		</p>
 
 
+		<h3>[property:Float intensity]</h3>
+		<p>
+			The intensity of the shadow. The default is `1`. Valid values are in the range `[0, 1]`.
+		</p>
+
 		<h3>[property:WebGLRenderTarget map]</h3>
 		<h3>[property:WebGLRenderTarget map]</h3>
 		<p>
 		<p>
       La mappa di profondità generata usando la telecamera interna; una posizione oltre la profondità di un pixel è in ombra.
       La mappa di profondità generata usando la telecamera interna; una posizione oltre la profondità di un pixel è in ombra.

+ 5 - 0
docs/api/zh/lights/shadows/LightShadow.html

@@ -48,6 +48,11 @@
 			The amount of samples to use when blurring a VSM shadow map.
 			The amount of samples to use when blurring a VSM shadow map.
 		</p>
 		</p>
 
 
+		<h3>[property:Float intensity]</h3>
+		<p>
+			The intensity of the shadow. The default is `1`. Valid values are in the range `[0, 1]`.
+		</p>
+
 		<h3>[property:WebGLRenderTarget map]</h3>
 		<h3>[property:WebGLRenderTarget map]</h3>
 		<p>
 		<p>
 			使用内置摄像头生成的深度图;超出像素深度的位置在阴影中。在渲染期间内部计算。
 			使用内置摄像头生成的深度图;超出像素深度的位置在阴影中。在渲染期间内部计算。

+ 4 - 4
examples/jsm/csm/CSMShader.js

@@ -92,7 +92,7 @@ IncidentLight directLight;
 
 
 		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
 		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
 		spotLightShadow = spotLightShadows[ i ];
 		spotLightShadow = spotLightShadows[ i ];
-		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
+		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
 
 
 		#endif
 		#endif
 
 
@@ -141,7 +141,7 @@ IncidentLight directLight;
 
 
 					vec3 prevColor = directLight.color;
 					vec3 prevColor = directLight.color;
 					directionalLightShadow = directionalLightShadows[ i ];
 					directionalLightShadow = directionalLightShadows[ i ];
-					directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
+					directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
 
 
 					bool shouldFadeLastCascade = UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth > cascadeCenter;
 					bool shouldFadeLastCascade = UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth > cascadeCenter;
 					directLight.color = mix( prevColor, directLight.color, shouldFadeLastCascade ? ratio : 1.0 );
 					directLight.color = mix( prevColor, directLight.color, shouldFadeLastCascade ? ratio : 1.0 );
@@ -173,7 +173,7 @@ IncidentLight directLight;
 			#if ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
 			#if ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
 
 
 				directionalLightShadow = directionalLightShadows[ i ];
 				directionalLightShadow = directionalLightShadows[ i ];
-				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;
+				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.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
 
 
 				if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
 				if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
 
 
@@ -225,7 +225,7 @@ IncidentLight directLight;
 
 
 		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
 		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
 		directionalLightShadow = directionalLightShadows[ i ];
 		directionalLightShadow = directionalLightShadows[ i ];
-		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
+		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
 		#endif
 		#endif
 
 
 		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
 		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );

+ 4 - 3
examples/jsm/nodes/lighting/AnalyticLightNode.js

@@ -2,13 +2,13 @@ import LightingNode from './LightingNode.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { uniform } from '../core/UniformNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { addNodeClass } from '../core/Node.js';
 import { addNodeClass } from '../core/Node.js';
-import { /*vec2,*/ vec3, vec4 } from '../shadernode/ShaderNode.js';
+import { vec3, vec4 } from '../shadernode/ShaderNode.js';
 import { reference } from '../accessors/ReferenceNode.js';
 import { reference } from '../accessors/ReferenceNode.js';
 import { texture } from '../accessors/TextureNode.js';
 import { texture } from '../accessors/TextureNode.js';
 import { positionWorld } from '../accessors/PositionNode.js';
 import { positionWorld } from '../accessors/PositionNode.js';
 import { normalWorld } from '../accessors/NormalNode.js';
 import { normalWorld } from '../accessors/NormalNode.js';
 import { WebGPUCoordinateSystem } from 'three';
 import { WebGPUCoordinateSystem } from 'three';
-//import { add } from '../math/OperatorNode.js';
+import { mix } from '../math/MathNode.js';
 
 
 import { Color, DepthTexture, NearestFilter, LessCompare, NoToneMapping } from 'three';
 import { Color, DepthTexture, NearestFilter, LessCompare, NoToneMapping } from 'three';
 
 
@@ -83,6 +83,7 @@ class AnalyticLightNode extends LightingNode {
 
 
 			//
 			//
 
 
+			const shadowIntensity = reference( 'intensity', 'float', shadow );
 			const bias = reference( 'bias', 'float', shadow );
 			const bias = reference( 'bias', 'float', shadow );
 			const normalBias = reference( 'normalBias', 'float', shadow );
 			const normalBias = reference( 'normalBias', 'float', shadow );
 
 
@@ -159,7 +160,7 @@ class AnalyticLightNode extends LightingNode {
 			const shadowMaskNode = frustumTest.mix( 1, shadowNode.mix( shadowColor.a.mix( 1, shadowColor ), 1 ) );
 			const shadowMaskNode = frustumTest.mix( 1, shadowNode.mix( shadowColor.a.mix( 1, shadowColor ), 1 ) );
 
 
 			this.rtt = rtt;
 			this.rtt = rtt;
-			this.colorNode = this.colorNode.mul( shadowMaskNode );
+			this.colorNode = this.colorNode.mul( mix( 1, shadowMaskNode, shadowIntensity ) );
 
 
 			this.shadowNode = shadowNode;
 			this.shadowNode = shadowNode;
 			this.shadowMaskNode = shadowMaskNode;
 			this.shadowMaskNode = shadowMaskNode;

+ 7 - 1
examples/webgl_lights_hemisphere.html

@@ -218,13 +218,19 @@
 						dirLight.visible = ! dirLight.visible;
 						dirLight.visible = ! dirLight.visible;
 						dirLightHelper.visible = ! dirLightHelper.visible;
 						dirLightHelper.visible = ! dirLightHelper.visible;
 
 
-					}
+					},
+					shadowIntensity: 1
 				};
 				};
 
 
 				const gui = new GUI();
 				const gui = new GUI();
 
 
 				gui.add( params, 'toggleHemisphereLight' ).name( 'toggle hemisphere light' );
 				gui.add( params, 'toggleHemisphereLight' ).name( 'toggle hemisphere light' );
 				gui.add( params, 'toggleDirectionalLight' ).name( 'toggle directional light' );
 				gui.add( params, 'toggleDirectionalLight' ).name( 'toggle directional light' );
+				gui.add( params, 'shadowIntensity', 0, 1 ).name( 'shadow intensity' ).onChange( ( value ) => {
+
+					dirLight.shadow.intensity = value;
+
+				} );
 				gui.open();
 				gui.open();
 
 
 				//
 				//

+ 5 - 0
src/lights/LightShadow.js

@@ -14,6 +14,8 @@ class LightShadow {
 
 
 		this.camera = camera;
 		this.camera = camera;
 
 
+		this.intensity = 1;
+
 		this.bias = 0;
 		this.bias = 0;
 		this.normalBias = 0;
 		this.normalBias = 0;
 		this.radius = 1;
 		this.radius = 1;
@@ -111,6 +113,8 @@ class LightShadow {
 
 
 		this.camera = source.camera.clone();
 		this.camera = source.camera.clone();
 
 
+		this.intensity = source.intensity;
+
 		this.bias = source.bias;
 		this.bias = source.bias;
 		this.radius = source.radius;
 		this.radius = source.radius;
 
 
@@ -130,6 +134,7 @@ class LightShadow {
 
 
 		const object = {};
 		const object = {};
 
 
+		if ( this.intensity !== 1 ) object.intensity = this.intensity;
 		if ( this.bias !== 0 ) object.bias = this.bias;
 		if ( this.bias !== 0 ) object.bias = this.bias;
 		if ( this.normalBias !== 0 ) object.normalBias = this.normalBias;
 		if ( this.normalBias !== 0 ) object.normalBias = this.normalBias;
 		if ( this.radius !== 1 ) object.radius = this.radius;
 		if ( this.radius !== 1 ) object.radius = this.radius;

+ 1 - 0
src/loaders/ObjectLoader.js

@@ -1032,6 +1032,7 @@ class ObjectLoader extends Loader {
 
 
 		if ( data.shadow ) {
 		if ( data.shadow ) {
 
 
+			if ( data.shadow.intensity !== undefined ) object.shadow.intensity = data.shadow.intensity;
 			if ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;
 			if ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;
 			if ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;
 			if ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;
 			if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;
 			if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;

+ 3 - 3
src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js

@@ -68,7 +68,7 @@ IncidentLight directLight;
 
 
 		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
 		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
 		pointLightShadow = pointLightShadows[ i ];
 		pointLightShadow = pointLightShadows[ i ];
-		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
+		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
 		#endif
 		#endif
 
 
 		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
 		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
@@ -116,7 +116,7 @@ IncidentLight directLight;
 
 
 		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
 		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
 		spotLightShadow = spotLightShadows[ i ];
 		spotLightShadow = spotLightShadows[ i ];
-		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
+		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
 		#endif
 		#endif
 
 
 		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
 		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
@@ -142,7 +142,7 @@ IncidentLight directLight;
 
 
 		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
 		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
 		directionalLightShadow = directionalLightShadows[ i ];
 		directionalLightShadow = directionalLightShadows[ i ];
-		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
+		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
 		#endif
 		#endif
 
 
 		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
 		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );

+ 7 - 4
src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js

@@ -19,6 +19,7 @@ export default /* glsl */`
 		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
 		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
 
 
 		struct DirectionalLightShadow {
 		struct DirectionalLightShadow {
+			float shadowIntensity;
 			float shadowBias;
 			float shadowBias;
 			float shadowNormalBias;
 			float shadowNormalBias;
 			float shadowRadius;
 			float shadowRadius;
@@ -34,6 +35,7 @@ export default /* glsl */`
 		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
 		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
 
 
 		struct SpotLightShadow {
 		struct SpotLightShadow {
+			float shadowIntensity;
 			float shadowBias;
 			float shadowBias;
 			float shadowNormalBias;
 			float shadowNormalBias;
 			float shadowRadius;
 			float shadowRadius;
@@ -50,6 +52,7 @@ export default /* glsl */`
 		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
 		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
 
 
 		struct PointLightShadow {
 		struct PointLightShadow {
+			float shadowIntensity;
 			float shadowBias;
 			float shadowBias;
 			float shadowNormalBias;
 			float shadowNormalBias;
 			float shadowRadius;
 			float shadowRadius;
@@ -103,7 +106,7 @@ export default /* glsl */`
 
 
 	}
 	}
 
 
-	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
+	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
 
 
 		float shadow = 1.0;
 		float shadow = 1.0;
 
 
@@ -196,7 +199,7 @@ export default /* glsl */`
 
 
 		}
 		}
 
 
-		return shadow;
+		return mix( 1.0, shadow, shadowIntensity );
 
 
 	}
 	}
 
 
@@ -271,7 +274,7 @@ export default /* glsl */`
 
 
 	}
 	}
 
 
-	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
+	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
 
 
 		float shadow = 1.0;
 		float shadow = 1.0;
 
 
@@ -316,7 +319,7 @@ export default /* glsl */`
 
 
 		}
 		}
 
 
-		return shadow;
+		return mix( 1.0, shadow, shadowIntensity );
 
 
 	}
 	}
 
 

+ 3 - 0
src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js

@@ -15,6 +15,7 @@ export default /* glsl */`
 		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
 		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
 
 
 		struct DirectionalLightShadow {
 		struct DirectionalLightShadow {
+			float shadowIntensity;
 			float shadowBias;
 			float shadowBias;
 			float shadowNormalBias;
 			float shadowNormalBias;
 			float shadowRadius;
 			float shadowRadius;
@@ -28,6 +29,7 @@ export default /* glsl */`
 	#if NUM_SPOT_LIGHT_SHADOWS > 0
 	#if NUM_SPOT_LIGHT_SHADOWS > 0
 
 
 		struct SpotLightShadow {
 		struct SpotLightShadow {
+			float shadowIntensity;
 			float shadowBias;
 			float shadowBias;
 			float shadowNormalBias;
 			float shadowNormalBias;
 			float shadowRadius;
 			float shadowRadius;
@@ -44,6 +46,7 @@ export default /* glsl */`
 		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
 		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
 
 
 		struct PointLightShadow {
 		struct PointLightShadow {
+			float shadowIntensity;
 			float shadowBias;
 			float shadowBias;
 			float shadowNormalBias;
 			float shadowNormalBias;
 			float shadowRadius;
 			float shadowRadius;

+ 3 - 3
src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js

@@ -13,7 +13,7 @@ float getShadowMask() {
 	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
 	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
 
 
 		directionalLight = directionalLightShadows[ i ];
 		directionalLight = directionalLightShadows[ i ];
-		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
+		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
 
 
 	}
 	}
 	#pragma unroll_loop_end
 	#pragma unroll_loop_end
@@ -28,7 +28,7 @@ float getShadowMask() {
 	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
 	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
 
 
 		spotLight = spotLightShadows[ i ];
 		spotLight = spotLightShadows[ i ];
-		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
+		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
 
 
 	}
 	}
 	#pragma unroll_loop_end
 	#pragma unroll_loop_end
@@ -43,7 +43,7 @@ float getShadowMask() {
 	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
 	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
 
 
 		pointLight = pointLightShadows[ i ];
 		pointLight = pointLightShadows[ i ];
-		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
+		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
 
 
 	}
 	}
 	#pragma unroll_loop_end
 	#pragma unroll_loop_end

+ 3 - 0
src/renderers/shaders/UniformsLib.js

@@ -130,6 +130,7 @@ const UniformsLib = {
 		} },
 		} },
 
 
 		directionalLightShadows: { value: [], properties: {
 		directionalLightShadows: { value: [], properties: {
+			shadowIntensity: 1,
 			shadowBias: {},
 			shadowBias: {},
 			shadowNormalBias: {},
 			shadowNormalBias: {},
 			shadowRadius: {},
 			shadowRadius: {},
@@ -150,6 +151,7 @@ const UniformsLib = {
 		} },
 		} },
 
 
 		spotLightShadows: { value: [], properties: {
 		spotLightShadows: { value: [], properties: {
+			shadowIntensity: 1,
 			shadowBias: {},
 			shadowBias: {},
 			shadowNormalBias: {},
 			shadowNormalBias: {},
 			shadowRadius: {},
 			shadowRadius: {},
@@ -168,6 +170,7 @@ const UniformsLib = {
 		} },
 		} },
 
 
 		pointLightShadows: { value: [], properties: {
 		pointLightShadows: { value: [], properties: {
+			shadowIntensity: 1,
 			shadowBias: {},
 			shadowBias: {},
 			shadowNormalBias: {},
 			shadowNormalBias: {},
 			shadowRadius: {},
 			shadowRadius: {},

+ 6 - 0
src/renderers/webgl/WebGLLights.js

@@ -99,6 +99,7 @@ function ShadowUniformsCache() {
 
 
 				case 'DirectionalLight':
 				case 'DirectionalLight':
 					uniforms = {
 					uniforms = {
+						shadowIntensity: 1,
 						shadowBias: 0,
 						shadowBias: 0,
 						shadowNormalBias: 0,
 						shadowNormalBias: 0,
 						shadowRadius: 1,
 						shadowRadius: 1,
@@ -108,6 +109,7 @@ function ShadowUniformsCache() {
 
 
 				case 'SpotLight':
 				case 'SpotLight':
 					uniforms = {
 					uniforms = {
+						shadowIntensity: 1,
 						shadowBias: 0,
 						shadowBias: 0,
 						shadowNormalBias: 0,
 						shadowNormalBias: 0,
 						shadowRadius: 1,
 						shadowRadius: 1,
@@ -117,6 +119,7 @@ function ShadowUniformsCache() {
 
 
 				case 'PointLight':
 				case 'PointLight':
 					uniforms = {
 					uniforms = {
+						shadowIntensity: 1,
 						shadowBias: 0,
 						shadowBias: 0,
 						shadowNormalBias: 0,
 						shadowNormalBias: 0,
 						shadowRadius: 1,
 						shadowRadius: 1,
@@ -266,6 +269,7 @@ function WebGLLights( extensions ) {
 
 
 					const shadowUniforms = shadowCache.get( light );
 					const shadowUniforms = shadowCache.get( light );
 
 
+					shadowUniforms.shadowIntensity = shadow.intensity;
 					shadowUniforms.shadowBias = shadow.bias;
 					shadowUniforms.shadowBias = shadow.bias;
 					shadowUniforms.shadowNormalBias = shadow.normalBias;
 					shadowUniforms.shadowNormalBias = shadow.normalBias;
 					shadowUniforms.shadowRadius = shadow.radius;
 					shadowUniforms.shadowRadius = shadow.radius;
@@ -319,6 +323,7 @@ function WebGLLights( extensions ) {
 
 
 					const shadowUniforms = shadowCache.get( light );
 					const shadowUniforms = shadowCache.get( light );
 
 
+					shadowUniforms.shadowIntensity = shadow.intensity;
 					shadowUniforms.shadowBias = shadow.bias;
 					shadowUniforms.shadowBias = shadow.bias;
 					shadowUniforms.shadowNormalBias = shadow.normalBias;
 					shadowUniforms.shadowNormalBias = shadow.normalBias;
 					shadowUniforms.shadowRadius = shadow.radius;
 					shadowUniforms.shadowRadius = shadow.radius;
@@ -360,6 +365,7 @@ function WebGLLights( extensions ) {
 
 
 					const shadowUniforms = shadowCache.get( light );
 					const shadowUniforms = shadowCache.get( light );
 
 
+					shadowUniforms.shadowIntensity = shadow.intensity;
 					shadowUniforms.shadowBias = shadow.bias;
 					shadowUniforms.shadowBias = shadow.bias;
 					shadowUniforms.shadowNormalBias = shadow.normalBias;
 					shadowUniforms.shadowNormalBias = shadow.normalBias;
 					shadowUniforms.shadowRadius = shadow.radius;
 					shadowUniforms.shadowRadius = shadow.radius;