ソースを参照

LightShadow: Rename radius to softness.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mr.doob 2 週間 前
コミット
d456a83817
35 ファイル変更107 行追加82 行削除
  1. 10 10
      editor/js/Sidebar.Object.js
  2. 6 6
      editor/js/Strings.js
  3. 1 1
      examples/games_fps.html
  4. 1 1
      examples/physics_rapier_basic.html
  5. 1 1
      examples/physics_rapier_character_controller.html
  6. 1 1
      examples/physics_rapier_joints.html
  7. 1 1
      examples/physics_rapier_vehicle_controller.html
  8. 1 1
      examples/webgl_gpgpu_water.html
  9. 1 1
      examples/webgl_lightprobes.html
  10. 2 2
      examples/webgl_lightprobes_complex.html
  11. 1 1
      examples/webgl_loader_draco.html
  12. 1 1
      examples/webgl_random_uv.html
  13. 1 1
      examples/webgl_shadowmap_pointlight.html
  14. 8 8
      examples/webgl_shadowmap_vsm.html
  15. 2 2
      examples/webgl_tsl_shadowmap.html
  16. 1 1
      examples/webgl_watch.html
  17. 1 1
      examples/webgpu_clipping.html
  18. 1 1
      examples/webgpu_lightprobes.html
  19. 2 2
      examples/webgpu_lightprobes_complex.html
  20. 1 1
      examples/webgpu_postprocessing_ssgi_ballpool.html
  21. 2 2
      examples/webgpu_shadowmap.html
  22. 1 1
      examples/webgpu_shadowmap_array.html
  23. 1 1
      examples/webgpu_shadowmap_opacity.html
  24. 1 1
      examples/webgpu_shadowmap_pointlight.html
  25. 8 8
      examples/webgpu_shadowmap_vsm.html
  26. 1 1
      manual/examples/shadows-spot-light-with-shadow-radius.html
  27. 27 3
      src/lights/LightShadow.js
  28. 2 1
      src/loaders/ObjectLoader.js
  29. 2 2
      src/nodes/lighting/PointShadowNode.js
  30. 2 2
      src/nodes/lighting/ShadowFilterNode.js
  31. 9 9
      src/nodes/lighting/ShadowNode.js
  32. 3 3
      src/renderers/webgl/WebGLLights.js
  33. 2 2
      src/renderers/webgl/WebGLShadowMap.js
  34. 1 1
      test/unit/src/lights/DirectionalLightShadow.tests.js
  35. 1 1
      test/unit/src/lights/SpotLightShadow.tests.js

+ 10 - 10
editor/js/Sidebar.Object.js

@@ -330,16 +330,16 @@ function SidebarObject( editor ) {
 
 	container.add( objectShadowNormalBiasRow );
 
-	// shadow radius
+	// shadow softness
 
-	const objectShadowRadiusRow = new UIRow();
+	const objectShadowSoftnessRow = new UIRow();
 
-	objectShadowRadiusRow.add( new UIText( strings.getKey( 'sidebar/object/shadowRadius' ) ).setClass( 'Label' ) );
+	objectShadowSoftnessRow.add( new UIText( strings.getKey( 'sidebar/object/shadowSoftness' ) ).setClass( 'Label' ) );
 
-	const objectShadowRadius = new UINumber( 1 ).onChange( update );
-	objectShadowRadiusRow.add( objectShadowRadius );
+	const objectShadowSoftness = new UINumber( 1 ).onChange( update );
+	objectShadowSoftnessRow.add( objectShadowSoftness );
 
-	container.add( objectShadowRadiusRow );
+	container.add( objectShadowSoftnessRow );
 
 	// visible
 
@@ -604,9 +604,9 @@ function SidebarObject( editor ) {
 
 				}
 
-				if ( object.shadow.radius !== objectShadowRadius.getValue() ) {
+				if ( object.shadow.softness !== objectShadowSoftness.getValue() ) {
 
-					editor.execute( new SetShadowValueCommand( editor, object, 'radius', objectShadowRadius.getValue() ) );
+					editor.execute( new SetShadowValueCommand( editor, object, 'softness', objectShadowSoftness.getValue() ) );
 
 				}
 
@@ -650,7 +650,7 @@ function SidebarObject( editor ) {
 			'decay': objectDecayRow,
 			'castShadow': objectShadowRow,
 			'receiveShadow': objectReceiveShadow,
-			'shadow': [ objectShadowIntensityRow, objectShadowBiasRow, objectShadowNormalBiasRow, objectShadowRadiusRow ]
+			'shadow': [ objectShadowIntensityRow, objectShadowBiasRow, objectShadowNormalBiasRow, objectShadowSoftnessRow ]
 		};
 
 		for ( const property in properties ) {
@@ -860,7 +860,7 @@ function SidebarObject( editor ) {
 			objectShadowIntensity.setValue( object.shadow.intensity );
 			objectShadowBias.setValue( object.shadow.bias );
 			objectShadowNormalBias.setValue( object.shadow.normalBias );
-			objectShadowRadius.setValue( object.shadow.radius );
+			objectShadowSoftness.setValue( object.shadow.softness );
 
 		}
 

+ 6 - 6
editor/js/Strings.js

@@ -154,7 +154,7 @@ function Strings( config ) {
 			'sidebar/object/shadowIntensity': 'شدت سایه',
 			'sidebar/object/shadowBias': 'انحراف سایه',
 			'sidebar/object/shadowNormalBias': 'انحراف معمول سایه',
-			'sidebar/object/shadowRadius': 'شعاع سایه',
+			'sidebar/object/shadowSoftness': 'نرمی سایه',
 			'sidebar/object/cast': 'سایه انداختن',
 			'sidebar/object/receive': 'دریافت',
 			'sidebar/object/visible': 'آشکار',
@@ -603,7 +603,7 @@ function Strings( config ) {
 			'sidebar/object/shadowIntensity': 'Shadow Intensity',
 			'sidebar/object/shadowBias': 'Shadow Bias',
 			'sidebar/object/shadowNormalBias': 'Shadow Normal Bias',
-			'sidebar/object/shadowRadius': 'Shadow Radius',
+			'sidebar/object/shadowSoftness': 'Shadow Softness',
 			'sidebar/object/cast': 'cast',
 			'sidebar/object/receive': 'receive',
 			'sidebar/object/visible': 'Visible',
@@ -1056,7 +1056,7 @@ function Strings( config ) {
 			'sidebar/object/shadowIntensity': 'Shadow Intensity',
 			'sidebar/object/shadowBias': 'Biais directionnel des ombres',
 			'sidebar/object/shadowNormalBias': 'Shadow Normal Bias',
-			'sidebar/object/shadowRadius': 'Rayon de l\'ombre',
+			'sidebar/object/shadowSoftness': 'Douceur de l\'ombre',
 			'sidebar/object/cast': 'Projète',
 			'sidebar/object/receive': 'Reçoit',
 			'sidebar/object/visible': 'Visible',
@@ -1506,7 +1506,7 @@ function Strings( config ) {
 			'sidebar/object/shadowIntensity': '阴影强度',
 			'sidebar/object/shadowBias': '阴影偏移',
 			'sidebar/object/shadowNormalBias': '阴影法线偏移',
-			'sidebar/object/shadowRadius': '阴影半径',
+			'sidebar/object/shadowSoftness': '阴影柔和度',
 			'sidebar/object/cast': '产生',
 			'sidebar/object/receive': '接受',
 			'sidebar/object/visible': '可见性',
@@ -1956,7 +1956,7 @@ function Strings( config ) {
 			'sidebar/object/shadowIntensity': 'Shadow Intensity',
 			'sidebar/object/shadowBias': '影のバイアス',
 			'sidebar/object/shadowNormalBias': '影のノーマルバイアス',
-			'sidebar/object/shadowRadius': '影の半径',
+			'sidebar/object/shadowSoftness': '影の柔らかさ',
 			'sidebar/object/cast': 'キャスト',
 			'sidebar/object/receive': 'レシーブ',
 			'sidebar/object/visible': '表示',
@@ -2405,7 +2405,7 @@ function Strings( config ) {
 			'sidebar/object/shadowIntensity': '그림자 강도',
 			'sidebar/object/shadowBias': '그림자 바이어스',
 			'sidebar/object/shadowNormalBias': '그림자 노멀 바이어스',
-			'sidebar/object/shadowRadius': '그림자 반지름',
+			'sidebar/object/shadowSoftness': '그림자 부드러움',
 			'sidebar/object/cast': 'cast',
 			'sidebar/object/receive': 'receive',
 			'sidebar/object/visible': '보임',

+ 1 - 1
examples/games_fps.html

@@ -67,7 +67,7 @@
 			directionalLight.shadow.camera.bottom = - 30;
 			directionalLight.shadow.mapSize.width = 1024;
 			directionalLight.shadow.mapSize.height = 1024;
-			directionalLight.shadow.radius = 4;
+			directionalLight.shadow.softness = 4;
 			directionalLight.shadow.bias = - 0.00006;
 			scene.add( directionalLight );
 

+ 1 - 1
examples/physics_rapier_basic.html

@@ -60,7 +60,7 @@
 
 				light.position.set( 0, 12.5, 12.5 );
 				light.castShadow = true;
-				light.shadow.radius = 3;
+				light.shadow.softness = 3;
 				light.shadow.blurSamples = 8;
 				light.shadow.mapSize.width = 1024;
 				light.shadow.mapSize.height = 1024;

+ 1 - 1
examples/physics_rapier_character_controller.html

@@ -62,7 +62,7 @@
 
 				light.position.set( 0, 12.5, 12.5 );
 				light.castShadow = true;
-				light.shadow.radius = 3;
+				light.shadow.softness = 3;
 				light.shadow.blurSamples = 8;
 				light.shadow.mapSize.width = 1024;
 				light.shadow.mapSize.height = 1024;

+ 1 - 1
examples/physics_rapier_joints.html

@@ -59,7 +59,7 @@
 
 				light.position.set( 0, 12.5, 12.5 );
 				light.castShadow = true;
-				light.shadow.radius = 3;
+				light.shadow.softness = 3;
 				light.shadow.blurSamples = 8;
 				light.shadow.mapSize.width = 1024;
 				light.shadow.mapSize.height = 1024;

+ 1 - 1
examples/physics_rapier_vehicle_controller.html

@@ -63,7 +63,7 @@
 
 				light.position.set( 0, 12.5, 12.5 );
 				light.castShadow = true;
-				light.shadow.radius = 3;
+				light.shadow.softness = 3;
 				light.shadow.blurSamples = 8;
 				light.shadow.mapSize.width = 2048;
 				light.shadow.mapSize.height = 2048;

+ 1 - 1
examples/webgl_gpgpu_water.html

@@ -445,7 +445,7 @@
 					renderer.shadowMap.type = THREE.VSMShadowMap;
 					const shadow = sun.shadow;
 					shadow.mapSize.width = shadow.mapSize.height = 2048;
-					shadow.radius = 2;
+					shadow.softness = 2;
 					shadow.bias = - 0.0005;
 					const shadowCam = shadow.camera, s = 5;
 					shadowCam.near = 0.1;

+ 1 - 1
examples/webgl_lightprobes.html

@@ -130,7 +130,7 @@
 				light.position.set( 0, 4.5, 0 );
 				light.castShadow = true;
 				light.shadow.mapSize.setScalar( 256 );
-				light.shadow.radius = 10;
+				light.shadow.softness = 10;
 				light.shadow.normalBias = - 0.02;
 				scene.add( light );
 

+ 2 - 2
examples/webgl_lightprobes_complex.html

@@ -241,7 +241,7 @@
 				warmLight.position.set( - 4, 4.5, 0 );
 				warmLight.castShadow = true;
 				warmLight.shadow.mapSize.setScalar( 256 );
-				warmLight.shadow.radius = 12;
+				warmLight.shadow.softness = 12;
 				warmLight.shadow.bias = - 0.002;
 				scene.add( warmLight );
 
@@ -250,7 +250,7 @@
 				coolLight.position.set( 4, 4.5, 0 );
 				coolLight.castShadow = true;
 				coolLight.shadow.mapSize.setScalar( 256 );
-				coolLight.shadow.radius = 12;
+				coolLight.shadow.softness = 12;
 				coolLight.shadow.bias = - 0.002;
 				scene.add( coolLight );
 

+ 1 - 1
examples/webgl_loader_draco.html

@@ -69,7 +69,7 @@
 			spotLight.angle = Math.PI / 16;
 			spotLight.penumbra = 0.5;
 			spotLight.castShadow = true;
-			spotLight.shadow.radius = 8;
+			spotLight.shadow.softness = 8;
 			spotLight.position.set( - 1, 1, 1 );
 			scene.add( spotLight );
 

+ 1 - 1
examples/webgl_random_uv.html

@@ -66,7 +66,7 @@
 				scene.add( dirLight );
 				const shadow = dirLight.shadow;
 				shadow.mapSize.width = shadow.mapSize.height = 1024;
-				shadow.radius = 16;
+				shadow.softness = 16;
 				shadow.bias = - 0.0005;
 				const shadowCam = shadow.camera, s = 2;
 				shadowCam.near = 0.5;

+ 1 - 1
examples/webgl_shadowmap_pointlight.html

@@ -55,7 +55,7 @@
 					light.castShadow = true;
 					light.shadow.bias = - 0.005; // reduces self-shadowing on double-sided objects
 					light.shadow.mapSize.width = 128;
-					light.shadow.radius = 10;
+					light.shadow.softness = 10;
 
 					let geometry = new THREE.SphereGeometry( 0.3, 12, 6 );
 					let material = new THREE.MeshBasicMaterial( { color: color } );

+ 8 - 8
examples/webgl_shadowmap_vsm.html

@@ -48,16 +48,16 @@
 				const gui = new GUI();
 
 				const config = {
-					spotlightRadius: 4,
+					spotlightSoftness: 4,
 					spotlightSamples: 8,
-					dirlightRadius: 4,
+					dirlightSoftness: 4,
 					dirlightSamples: 8
 				};
 
 				const spotlightFolder = gui.addFolder( 'Spotlight' );
-				spotlightFolder.add( config, 'spotlightRadius' ).name( 'radius' ).min( 0 ).max( 25 ).onChange( function ( value ) {
+				spotlightFolder.add( config, 'spotlightSoftness' ).name( 'softness' ).min( 0 ).max( 25 ).onChange( function ( value ) {
 
-					spotLight.shadow.radius = value;
+					spotLight.shadow.softness = value;
 
 				} );
 
@@ -69,9 +69,9 @@
 				spotlightFolder.open();
 
 				const dirlightFolder = gui.addFolder( 'Directional Light' );
-				dirlightFolder.add( config, 'dirlightRadius' ).name( 'radius' ).min( 0 ).max( 25 ).onChange( function ( value ) {
+				dirlightFolder.add( config, 'dirlightSoftness' ).name( 'softness' ).min( 0 ).max( 25 ).onChange( function ( value ) {
 
-					dirLight.shadow.radius = value;
+					dirLight.shadow.softness = value;
 
 				} );
 
@@ -110,7 +110,7 @@
 				spotLight.shadow.mapSize.width = 256;
 				spotLight.shadow.mapSize.height = 256;
 				spotLight.shadow.bias = - 0.002;
-				spotLight.shadow.radius = 4;
+				spotLight.shadow.softness = 4;
 				scene.add( spotLight );
 
 
@@ -125,7 +125,7 @@
 				dirLight.shadow.camera.bottom = - 17;
 				dirLight.shadow.mapSize.width = 512;
 				dirLight.shadow.mapSize.height = 512;
-				dirLight.shadow.radius = 4;
+				dirLight.shadow.softness = 4;
 				dirLight.shadow.bias = - 0.0005;
 
 				dirGroup = new THREE.Group();

+ 2 - 2
examples/webgl_tsl_shadowmap.html

@@ -72,7 +72,7 @@
 				spotLight.shadow.camera.far = 200;
 				spotLight.shadow.mapSize.width = 2048;
 				spotLight.shadow.mapSize.height = 2048;
-				spotLight.shadow.radius = 4;
+				spotLight.shadow.softness = 4;
 				scene.add( spotLight );
 
 
@@ -87,7 +87,7 @@
 				dirLight.shadow.camera.bottom = - 17;
 				dirLight.shadow.mapSize.width = 2048;
 				dirLight.shadow.mapSize.height = 2048;
-				dirLight.shadow.radius = 4;
+				dirLight.shadow.softness = 4;
 
 				dirGroup = new THREE.Group();
 				dirGroup.add( dirLight );

+ 1 - 1
examples/webgl_watch.html

@@ -166,7 +166,7 @@
 				scene.add( dirLight );
 				const shadow = dirLight.shadow;
 				shadow.mapSize.width = shadow.mapSize.height = 2048;
-				shadow.radius = 8;
+				shadow.softness = 8;
 				shadow.bias = - 0.0005;
 				const shadowCam = shadow.camera, s = 0.5;
 				shadowCam.near = 0.1;

+ 1 - 1
examples/webgpu_clipping.html

@@ -65,7 +65,7 @@
 				spotLight.shadow.camera.far = 10;
 				spotLight.shadow.mapSize.width = 2048;
 				spotLight.shadow.mapSize.height = 2048;
-				spotLight.shadow.radius = 4;
+				spotLight.shadow.softness = 4;
 				scene.add( spotLight );
 
 				const dirLight = new THREE.DirectionalLight( 0x55505a, 3 );

+ 1 - 1
examples/webgpu_lightprobes.html

@@ -137,7 +137,7 @@
 				light.position.set( 0, 4.5, 0 );
 				light.castShadow = true;
 				light.shadow.mapSize.setScalar( 256 );
-				light.shadow.radius = 10;
+				light.shadow.softness = 10;
 				light.shadow.normalBias = - 0.02;
 				scene.add( light );
 

+ 2 - 2
examples/webgpu_lightprobes_complex.html

@@ -248,7 +248,7 @@
 				warmLight.position.set( - 4, 4.5, 0 );
 				warmLight.castShadow = true;
 				warmLight.shadow.mapSize.setScalar( 256 );
-				warmLight.shadow.radius = 12;
+				warmLight.shadow.softness = 12;
 				warmLight.shadow.bias = - 0.002;
 				scene.add( warmLight );
 
@@ -257,7 +257,7 @@
 				coolLight.position.set( 4, 4.5, 0 );
 				coolLight.castShadow = true;
 				coolLight.shadow.mapSize.setScalar( 256 );
-				coolLight.shadow.radius = 12;
+				coolLight.shadow.softness = 12;
 				coolLight.shadow.bias = - 0.002;
 				scene.add( coolLight );
 

+ 1 - 1
examples/webgpu_postprocessing_ssgi_ballpool.html

@@ -156,7 +156,7 @@
 				mouseLight.position.set( 0, BOX_HEIGHT / 2, BOX_DEPTH / 2 );
 				mouseLight.castShadow = true;
 				mouseLight.shadow.mapSize.set( 1024, 1024 );
-				mouseLight.shadow.radius = 20;
+				mouseLight.shadow.softness = 20;
 				scene.add( mouseLight );
 
 				//

+ 2 - 2
examples/webgpu_shadowmap.html

@@ -72,7 +72,7 @@
 				spotLight.shadow.camera.far = 200;
 				spotLight.shadow.mapSize.width = 2048;
 				spotLight.shadow.mapSize.height = 2048;
-				spotLight.shadow.radius = 4;
+				spotLight.shadow.softness = 4;
 				scene.add( spotLight );
 
 
@@ -87,7 +87,7 @@
 				dirLight.shadow.camera.bottom = - 17;
 				dirLight.shadow.mapSize.width = 2048;
 				dirLight.shadow.mapSize.height = 2048;
-				dirLight.shadow.radius = 4;
+				dirLight.shadow.softness = 4;
 
 				dirGroup = new THREE.Group();
 				dirGroup.add( dirLight );

+ 1 - 1
examples/webgpu_shadowmap_array.html

@@ -96,7 +96,7 @@
 				dirLight.shadow.camera.bottom = - 160;
 				dirLight.shadow.mapSize.width = 1024 * 4;
 				dirLight.shadow.mapSize.height = 1024 * 4;
-				dirLight.shadow.radius = 1;
+				dirLight.shadow.softness = 1;
 
 				// Set up the tile shadow mapping
 				const tsm = new TileShadowNode( dirLight, {

+ 1 - 1
examples/webgpu_shadowmap_opacity.html

@@ -86,7 +86,7 @@
 				dirLight.shadow.camera.bottom = - 5;
 				dirLight.shadow.mapSize.width = 2048;
 				dirLight.shadow.mapSize.height = 2048;
-				dirLight.shadow.radius = 4;
+				dirLight.shadow.softness = 4;
 
 				dirLight.shadow.autoUpdate = false;
 				dirLight.shadow.needsUpdate = true;

+ 1 - 1
examples/webgpu_shadowmap_pointlight.html

@@ -64,7 +64,7 @@
 					light.castShadow = true;
 					light.shadow.bias = - 0.005; // reduces self-shadowing on double-sided objects
 					light.shadow.mapSize.width = 128;
-					light.shadow.radius = 10;
+					light.shadow.softness = 10;
 
 					let geometry = new THREE.SphereGeometry( 0.3, 12, 6 );
 					let material = new THREE.MeshBasicMaterial( { color: color } );

+ 8 - 8
examples/webgpu_shadowmap_vsm.html

@@ -48,9 +48,9 @@
 			let torusKnot, dirGroup;
 
 			const config = {
-				spotlightRadius: 4,
+				spotlightSoftness: 4,
 				spotlightSamples: 8,
-				dirlightRadius: 4,
+				dirlightSoftness: 4,
 				dirlightSamples: 8,
 				animate: true
 			};
@@ -66,9 +66,9 @@
 				const gui = renderer.inspector.createParameters( 'Settings' );
 
 				const spotlightFolder = gui.addFolder( 'Spotlight' );
-				spotlightFolder.add( config, 'spotlightRadius', 0, 25 ).name( 'radius' ).onChange( function ( value ) {
+				spotlightFolder.add( config, 'spotlightSoftness', 0, 25 ).name( 'softness' ).onChange( function ( value ) {
 
-					spotLight.shadow.radius = value;
+					spotLight.shadow.softness = value;
 
 				} );
 
@@ -79,9 +79,9 @@
 				} );
 
 				const dirlightFolder = gui.addFolder( 'Directional Light' );
-				dirlightFolder.add( config, 'dirlightRadius', 0, 25 ).name( 'radius' ).onChange( function ( value ) {
+				dirlightFolder.add( config, 'dirlightSoftness', 0, 25 ).name( 'softness' ).onChange( function ( value ) {
 
-					dirLight.shadow.radius = value;
+					dirLight.shadow.softness = value;
 
 				} );
 
@@ -121,7 +121,7 @@
 				spotLight.shadow.mapSize.width = 256;
 				spotLight.shadow.mapSize.height = 256;
 				spotLight.shadow.bias = - 0.002;
-				spotLight.shadow.radius = 4;
+				spotLight.shadow.softness = 4;
 				scene.add( spotLight );
 
 
@@ -136,7 +136,7 @@
 				dirLight.shadow.camera.bottom = - 17;
 				dirLight.shadow.mapSize.width = 512;
 				dirLight.shadow.mapSize.height = 512;
-				dirLight.shadow.radius = 4;
+				dirLight.shadow.softness = 4;
 				dirLight.shadow.bias = - 0.0005;
 
 				dirGroup = new THREE.Group();

+ 1 - 1
manual/examples/shadows-spot-light-with-shadow-radius.html

@@ -230,7 +230,7 @@ function main() {
 		gui.add( new DegRadHelper( light, 'angle' ), 'value', 0, 90 ).name( 'angle' ).onChange( updateCamera );
 		gui.add( light, 'penumbra', 0, 1, 0.01 );
 
-		gui.add( light.shadow, 'radius', 0, 50, 0.01 );
+		gui.add( light.shadow, 'softness', 0, 50, 0.01 );
 
 		{
 

+ 27 - 3
src/lights/LightShadow.js

@@ -4,6 +4,7 @@ import { Vector3 } from '../math/Vector3.js';
 import { Vector4 } from '../math/Vector4.js';
 import { Frustum } from '../math/Frustum.js';
 import { UnsignedByteType, WebGPUCoordinateSystem } from '../constants.js';
+import { warnOnce } from '../utils.js';
 
 const _projScreenMatrix = /*@__PURE__*/ new Matrix4();
 const _lightPositionWorld = /*@__PURE__*/ new Vector3();
@@ -84,7 +85,7 @@ class LightShadow {
 		 * @type {number}
 		 * @default 1
 		 */
-		this.radius = 1;
+		this.softness = 1;
 
 		/**
 		 * The amount of samples to use when blurring a VSM shadow map.
@@ -170,6 +171,29 @@ class LightShadow {
 
 	}
 
+	/**
+	 * The softness of the shadow.
+	 *
+	 * @deprecated since r186. Use {@link LightShadow#softness} instead.
+	 * @type {number}
+	 * @default 1
+	 */
+	get radius() {
+
+		warnOnce( 'LightShadow: The "radius" property has been renamed to "softness".' ); // @deprecated r186
+
+		return this.softness;
+
+	}
+
+	set radius( value ) {
+
+		warnOnce( 'LightShadow: The "radius" property has been renamed to "softness".' ); // @deprecated r186
+
+		this.softness = value;
+
+	}
+
 	/**
 	 * Used internally by the renderer to get the number of viewports that need
 	 * to be rendered for this shadow.
@@ -293,7 +317,7 @@ class LightShadow {
 		this.intensity = source.intensity;
 
 		this.bias = source.bias;
-		this.radius = source.radius;
+		this.softness = source.softness;
 
 		this.autoUpdate = source.autoUpdate;
 		this.needsUpdate = source.needsUpdate;
@@ -332,7 +356,7 @@ class LightShadow {
 		if ( this.intensity !== 1 ) object.intensity = this.intensity;
 		if ( this.bias !== 0 ) object.bias = this.bias;
 		if ( this.normalBias !== 0 ) object.normalBias = this.normalBias;
-		if ( this.radius !== 1 ) object.radius = this.radius;
+		if ( this.softness !== 1 ) object.softness = this.softness;
 		if ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();
 
 		object.camera = this.camera.toJSON( false ).object;

+ 2 - 1
src/loaders/ObjectLoader.js

@@ -1161,7 +1161,8 @@ class ObjectLoader extends Loader {
 			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.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;
-			if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;
+			if ( data.shadow.softness !== undefined ) object.shadow.softness = data.shadow.softness;
+			if ( data.shadow.radius !== undefined ) object.shadow.softness = data.shadow.radius; // @deprecated r186
 			if ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize );
 			if ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera );
 

+ 2 - 2
src/nodes/lighting/PointShadowNode.js

@@ -65,10 +65,10 @@ export const BasicPointShadowFilter = /*@__PURE__*/ Fn( ( { depthTexture, bd3D,
  */
 export const PointShadowFilter = /*@__PURE__*/ Fn( ( { depthTexture, bd3D, dp, shadow } ) => {
 
-	const radius = reference( 'radius', 'float', shadow ).setGroup( renderGroup );
+	const softness = reference( 'softness', 'float', shadow ).setGroup( renderGroup );
 	const mapSize = reference( 'mapSize', 'vec2', shadow ).setGroup( renderGroup );
 
-	const texelSize = radius.div( mapSize.x );
+	const texelSize = softness.div( mapSize.x );
 
 	// Build a tangent-space coordinate system for applying offsets
 	const absDir = abs( bd3D );

+ 2 - 2
src/nodes/lighting/ShadowFilterNode.js

@@ -66,10 +66,10 @@ export const PCFShadowFilter = /*@__PURE__*/ Fn( ( { depthTexture, shadowCoord,
 	};
 
 	const mapSize = reference( 'mapSize', 'vec2', shadow ).setGroup( renderGroup );
-	const radius = reference( 'radius', 'float', shadow ).setGroup( renderGroup );
+	const softness = reference( 'softness', 'float', shadow ).setGroup( renderGroup );
 
 	const texelSize = vec2( 1 ).div( mapSize );
-	const radiusScaled = radius.mul( texelSize.x );
+	const radiusScaled = softness.mul( texelSize.x );
 
 	// Use IGN to rotate sampling pattern per pixel (phi = IGN * 2π)
 	const phi = interleavedGradientNoise( screenCoordinate.xy ).mul( 6.28318530718 );

+ 9 - 9
src/nodes/lighting/ShadowNode.js

@@ -89,12 +89,12 @@ export const getShadowRenderObjectFunction = ( renderer, shadow, shadowType, use
  * @method
  * @param {Object} inputs - The input parameter object.
  * @param {Node<float>} inputs.samples - The number of samples
- * @param {Node<float>} inputs.radius - The radius.
+ * @param {Node<float>} inputs.softness - The softness.
  * @param {Node<float>} inputs.size - The size.
  * @param {TextureNode} inputs.shadowPass - A reference to the render target's depth data.
  * @return {Node<vec2>} The VSM output.
  */
-const VSMPassVertical = /*@__PURE__*/ Fn( ( { samples, radius, size, shadowPass, depthLayer } ) => {
+const VSMPassVertical = /*@__PURE__*/ Fn( ( { samples, softness, size, shadowPass, depthLayer } ) => {
 
 	const mean = float( 0 ).toVar( 'meanVertical' );
 	const squaredMean = float( 0 ).toVar( 'squareMeanVertical' );
@@ -106,7 +106,7 @@ const VSMPassVertical = /*@__PURE__*/ Fn( ( { samples, radius, size, shadowPass,
 
 		const uvOffset = uvStart.add( float( i ).mul( uvStride ) );
 
-		let depth = shadowPass.sample( add( screenCoordinate.xy, vec2( 0, uvOffset ).mul( radius ) ).div( size ) );
+		let depth = shadowPass.sample( add( screenCoordinate.xy, vec2( 0, uvOffset ).mul( softness ) ).div( size ) );
 
 		if ( shadowPass.value.isArrayTexture ) {
 
@@ -136,12 +136,12 @@ const VSMPassVertical = /*@__PURE__*/ Fn( ( { samples, radius, size, shadowPass,
  * @method
  * @param {Object} inputs - The input parameter object.
  * @param {Node<float>} inputs.samples - The number of samples
- * @param {Node<float>} inputs.radius - The radius.
+ * @param {Node<float>} inputs.softness - The softness.
  * @param {Node<float>} inputs.size - The size.
  * @param {TextureNode} inputs.shadowPass - The result of the first VSM render pass.
  * @return {Node<vec2>} The VSM output.
  */
-const VSMPassHorizontal = /*@__PURE__*/ Fn( ( { samples, radius, size, shadowPass, depthLayer } ) => {
+const VSMPassHorizontal = /*@__PURE__*/ Fn( ( { samples, softness, size, shadowPass, depthLayer } ) => {
 
 	const mean = float( 0 ).toVar( 'meanHorizontal' );
 	const squaredMean = float( 0 ).toVar( 'squareMeanHorizontal' );
@@ -153,7 +153,7 @@ const VSMPassHorizontal = /*@__PURE__*/ Fn( ( { samples, radius, size, shadowPas
 
 		const uvOffset = uvStart.add( float( i ).mul( uvStride ) );
 
-		let distribution = shadowPass.sample( add( screenCoordinate.xy, vec2( uvOffset, 0 ).mul( radius ) ).div( size ) );
+		let distribution = shadowPass.sample( add( screenCoordinate.xy, vec2( uvOffset, 0 ).mul( softness ) ).div( size ) );
 
 		if ( shadowPass.value.isArrayTexture ) {
 
@@ -489,15 +489,15 @@ class ShadowNode extends ShadowBaseNode {
 			}
 
 			const samples = reference( 'blurSamples', 'float', shadow ).setGroup( renderGroup );
-			const radius = reference( 'radius', 'float', shadow ).setGroup( renderGroup );
+			const softness = reference( 'softness', 'float', shadow ).setGroup( renderGroup );
 			const size = reference( 'mapSize', 'vec2', shadow ).setGroup( renderGroup );
 
 			let material = this.vsmMaterialVertical || ( this.vsmMaterialVertical = new NodeMaterial() );
-			material.fragmentNode = VSMPassVertical( { samples, radius, size, shadowPass: shadowPassVertical, depthLayer: this.depthLayer } ).context( builder.getSharedContext() );
+			material.fragmentNode = VSMPassVertical( { samples, softness, size, shadowPass: shadowPassVertical, depthLayer: this.depthLayer } ).context( builder.getSharedContext() );
 			material.name = 'VSMVertical';
 
 			material = this.vsmMaterialHorizontal || ( this.vsmMaterialHorizontal = new NodeMaterial() );
-			material.fragmentNode = VSMPassHorizontal( { samples, radius, size, shadowPass: shadowPassHorizontal, depthLayer: this.depthLayer } ).context( builder.getSharedContext() );
+			material.fragmentNode = VSMPassHorizontal( { samples, softness, size, shadowPass: shadowPassHorizontal, depthLayer: this.depthLayer } ).context( builder.getSharedContext() );
 			material.name = 'VSMHorizontal';
 
 		}

+ 3 - 3
src/renderers/webgl/WebGLLights.js

@@ -289,7 +289,7 @@ function WebGLLights( extensions ) {
 					shadowUniforms.shadowIntensity = shadow.intensity;
 					shadowUniforms.shadowBias = shadow.bias;
 					shadowUniforms.shadowNormalBias = shadow.normalBias;
-					shadowUniforms.shadowRadius = shadow.radius;
+					shadowUniforms.shadowRadius = shadow.softness;
 					shadowUniforms.shadowMapSize = shadow.mapSize;
 
 					state.directionalShadow[ directionalLength ] = shadowUniforms;
@@ -343,7 +343,7 @@ function WebGLLights( extensions ) {
 					shadowUniforms.shadowIntensity = shadow.intensity;
 					shadowUniforms.shadowBias = shadow.bias;
 					shadowUniforms.shadowNormalBias = shadow.normalBias;
-					shadowUniforms.shadowRadius = shadow.radius;
+					shadowUniforms.shadowRadius = shadow.softness;
 					shadowUniforms.shadowMapSize = shadow.mapSize;
 
 					state.spotShadow[ spotLength ] = shadowUniforms;
@@ -385,7 +385,7 @@ function WebGLLights( extensions ) {
 					shadowUniforms.shadowIntensity = shadow.intensity;
 					shadowUniforms.shadowBias = shadow.bias;
 					shadowUniforms.shadowNormalBias = shadow.normalBias;
-					shadowUniforms.shadowRadius = shadow.radius;
+					shadowUniforms.shadowRadius = shadow.softness;
 					shadowUniforms.shadowMapSize = shadow.mapSize;
 					shadowUniforms.shadowCameraNear = shadow.camera.near;
 					shadowUniforms.shadowCameraFar = shadow.camera.far;

+ 2 - 2
src/renderers/webgl/WebGLShadowMap.js

@@ -399,7 +399,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
 
 		shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.depthTexture;
 		shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;
-		shadowMaterialVertical.uniforms.radius.value = shadow.radius;
+		shadowMaterialVertical.uniforms.radius.value = shadow.softness;
 		renderer.setRenderTarget( shadow.mapPass );
 		renderer.clear();
 		renderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );
@@ -408,7 +408,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
 
 		shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;
 		shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;
-		shadowMaterialHorizontal.uniforms.radius.value = shadow.radius;
+		shadowMaterialHorizontal.uniforms.radius.value = shadow.softness;
 		renderer.setRenderTarget( shadow.map );
 		renderer.clear();
 		renderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );

+ 1 - 1
test/unit/src/lights/DirectionalLightShadow.tests.js

@@ -66,7 +66,7 @@ export default QUnit.module( 'Lights', () => {
 			const shadow = new DirectionalLightShadow();
 
 			shadow.bias = 10;
-			shadow.radius = 5;
+			shadow.softness = 5;
 			shadow.mapSize.set( 1024, 1024 );
 			light.shadow = shadow;
 

+ 1 - 1
test/unit/src/lights/SpotLightShadow.tests.js

@@ -66,7 +66,7 @@ export default QUnit.module( 'Lights', () => {
 			const shadow = new SpotLightShadow();
 
 			shadow.bias = 10;
-			shadow.radius = 5;
+			shadow.softness = 5;
 			shadow.mapSize.set( 128, 128 );
 			light.shadow = shadow;
 

粤ICP备19079148号