浏览代码

Removed (long-time broken) Cascaded ShadowMaps code.

Mr.doob 10 年之前
父节点
当前提交
3ed0acb0cf

+ 10 - 63
docs/api/lights/DirectionalLight.html

@@ -27,7 +27,7 @@
 		<div>[example:webgl_geometry_extrude_splines geometry / extrude / splines ]</div>
 		<div>[example:webgl_geometry_extrude_splines geometry / extrude / splines ]</div>
 		<div>[example:webgl_materials_bumpmap materials / bumpmap ]</div>
 		<div>[example:webgl_materials_bumpmap materials / bumpmap ]</div>
 		<div>[example:webgl_materials_cubemap_balls_reflection materials / cubemap / balls / reflection ]</div>
 		<div>[example:webgl_materials_cubemap_balls_reflection materials / cubemap / balls / reflection ]</div>
-		
+
 		<code>// White directional light at half intensity shining from the top.
 		<code>// White directional light at half intensity shining from the top.
 
 
 var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 );
 var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 );
@@ -68,13 +68,13 @@ scene.add( directionalLight );</code>
 			If set to *true* light will only cast shadow but not contribute any lighting (as if *intensity* was 0 but cheaper to compute).<br />
 			If set to *true* light will only cast shadow but not contribute any lighting (as if *intensity* was 0 but cheaper to compute).<br />
 			Default — *false*.
 			Default — *false*.
 		</div>
 		</div>
-		
+
 		<h3>[property:Boolean castShadow]</h3>
 		<h3>[property:Boolean castShadow]</h3>
 		<div>
 		<div>
 			If set to true light will cast dynamic shadows. Warning: This is expensive and requires tweaking to get shadows looking right.<br />
 			If set to true light will cast dynamic shadows. Warning: This is expensive and requires tweaking to get shadows looking right.<br />
 			Default — *false*.
 			Default — *false*.
 		</div>
 		</div>
-		
+
 		<h3>[property:Float shadowCameraNear]</h3>
 		<h3>[property:Float shadowCameraNear]</h3>
 		<div>
 		<div>
 			Orthographic shadow camera frustum parameter.<br />
 			Orthographic shadow camera frustum parameter.<br />
@@ -141,90 +141,37 @@ scene.add( directionalLight );</code>
 			Default — *512*.
 			Default — *512*.
 		</div>
 		</div>
 
 
-		<h3>[property:Boolean shadowCascade]</h3>
-		<div>
-			**Experimental** If true, use a series of shadow maps in a cascade. This can give better z-depth resolution for a directional light. <br />
-			Default — *false*.
-		</div>
-
-		<h3>[property:Integer shadowCascadeCount]</h3>
-		<div>
-			Number of shadow maps to allocate in a cascade (one after another). <br />
-			Default — *2*.
-		</div>
-
-		<h3>[property:Vector3 shadowCascadeOffset]</h3>
-		<div>
-			A relative position to real camera where virtual shadow cameras are attached. A magic vector; scene and light orientation dependent. <br />
-			Default — *Three.Vector3( 0, 0, -1000 )*.
-		</div>
-
-		<h3>[property:Array shadowCascadeBias]</h3>
-		<div>
-			An array of shadowMapBias values for the corresponding shadow map in the cascade, near to far. <br />
-			Default — <strong>[ 0, 0, 0 ]</strong>.
-		</div>
-
-		<h3>[property:Array shadowCascadeWidth]</h3>
-		<div>
-			An array of shadowMapWidth values for the corresponding shadow map in the cascade, near to far. <br />
-			Default — <strong>[ 512, 512, 512 ]</strong>.
-		</div>
-
-		<h3>[property:Array shadowCascadeHeight]</h3>
-		<div>
-			An array of shadowMapHeight values for the corresponding shadow map in the cascade, near to far. <br />
-			Default — <strong>[ 512, 512, 512 ]</strong>.
-		</div>
-
-		<h3>[property:Array shadowCascadeNearZ]</h3>
-		<div>
-			An array of shadowMapNear values for the corresponding shadow map in the cascade, near to far. These typically start with -1.0 (near plane) and match with the previous shadowCascadeFarZ array value.<br />
-			Default — <strong>[ -1.000, 0.990, 0.998 ]</strong>.
-		</div>
-
-		<h3>[property:Array shadowCascadeFarZ]</h3>
-		<div>
-			An array of shadowMapFar values for the corresponding shadow map in the cascade, near to far. These typically match with the next shadowCascadeNearZ array value, ending in 1.0.<br />
-			Default — <strong>[ 0.990, 0.998, 1.000 ]</strong>.
-		</div>
-
-		<h3>[property:Array shadowCascadeArray]</h3>
-		<div>
-			Array of size shadowCascadeCount of [page:DirectionalLight THREE.DirectionalLight] objects. This holds the series of separate shadow maps in a cascade, near to far. Created internally.
-		</div>
-
 		<h3>[property:Vector2 shadowMapSize]</h3>
 		<h3>[property:Vector2 shadowMapSize]</h3>
 		<div>
 		<div>
 			The shadowMapWidth and shadowMapHeight stored in a [page:Vector2 THREE.Vector2]. Set internally during rendering.
 			The shadowMapWidth and shadowMapHeight stored in a [page:Vector2 THREE.Vector2]. Set internally during rendering.
-		</div> 
+		</div>
 
 
 		<h3>[property:OrthographicCamera shadowCamera]</h3>
 		<h3>[property:OrthographicCamera shadowCamera]</h3>
 		<div>
 		<div>
 			The shadow's view of the world. Computed internally during rendering from the shadowCamera* settings.
 			The shadow's view of the world. Computed internally during rendering from the shadowCamera* settings.
-		</div> 
+		</div>
 
 
 		<h3>[property:Matrix4 shadowMatrix]</h3>
 		<h3>[property:Matrix4 shadowMatrix]</h3>
 		<div>
 		<div>
 			Model to shadow camera space, to compute location and depth in shadow map. Computed internally during rendering.
 			Model to shadow camera space, to compute location and depth in shadow map. Computed internally during rendering.
-		</div> 
+		</div>
 
 
 		<h3>[property:WebGLRenderTarget shadowMap]</h3>
 		<h3>[property:WebGLRenderTarget shadowMap]</h3>
 		<div>
 		<div>
 		    The depth map generated using the shadowCamera; a location beyond a pixel's depth is in shadow. Computed internally during rendering.
 		    The depth map generated using the shadowCamera; a location beyond a pixel's depth is in shadow. Computed internally during rendering.
-		</div> 
-		
+		</div>
+
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 		<h3>[method:DirectionalLight clone]()</h3>
 		<h3>[method:DirectionalLight clone]()</h3>
 		<div>
 		<div>
 		It returns a clone of DirectionalLight.
 		It returns a clone of DirectionalLight.
 		</div>
 		</div>
-		
+
 		<h3>[method:JSON toJSON]()</h3>
 		<h3>[method:JSON toJSON]()</h3>
 		<div>
 		<div>
 		Return DirectionalLight data in JSON format.
 		Return DirectionalLight data in JSON format.
 		</div>
 		</div>
-		
+
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 4 - 4
examples/webgl_lights_hemisphere.html

@@ -276,14 +276,14 @@
 
 
 				switch ( event.keyCode ) {
 				switch ( event.keyCode ) {
 
 
-					case 72: /*h*/
+					case 72: // h
 
 
-					hemiLight.intensity = 0.6 - hemiLight.intensity;
+					hemiLight.visible = !hemiLight.visible;
 					break;
 					break;
 
 
-					case 68: /*d*/
+					case 68: // d
 
 
-					dirLight.intensity = 1 - dirLight.intensity;
+					dirLight.visible = !dirLight.visible;
 					break;
 					break;
 
 
 				}
 				}

+ 0 - 9
examples/webgl_morphtargets_md2_control.html

@@ -117,14 +117,6 @@
 				light.shadowCameraRight = 900;
 				light.shadowCameraRight = 900;
 				light.shadowCameraLeft = -1000;
 				light.shadowCameraLeft = -1000;
 
 
-				// cascaded shadows don't appear to be working, and add little
-				// light.shadowCascade = true;
-				//light.shadowCascadeCount = 3;
-				//light.shadowCascadeNearZ = [ -1.000, 0.995, 0.998 ];
-				//light.shadowCascadeFarZ  = [  0.995, 0.998, 1.000 ];
-				//light.shadowCascadeWidth = [ 1024, 1024, 1024 ];
-				//light.shadowCascadeHeight = [ 1024, 1024, 1024 ];
-
 				scene.add( light );
 				scene.add( light );
 
 
 
 
@@ -157,7 +149,6 @@
 				renderer.gammaOutput = true;
 				renderer.gammaOutput = true;
 				renderer.shadowMap.enabled = true;
 				renderer.shadowMap.enabled = true;
 
 
-				//renderer.shadowMap.cascade = true;
 				//renderer.shadowMap.type = THREE.PCFSoftShadowMap;
 				//renderer.shadowMap.type = THREE.PCFSoftShadowMap;
 				//renderer.shadowMap.debug = true;
 				//renderer.shadowMap.debug = true;
 
 

+ 0 - 30
src/lights/DirectionalLight.js

@@ -37,22 +37,6 @@ THREE.DirectionalLight = function ( color, intensity ) {
 
 
 	//
 	//
 
 
-	this.shadowCascade = false;
-
-	this.shadowCascadeOffset = new THREE.Vector3( 0, 0, - 1000 );
-	this.shadowCascadeCount = 2;
-
-	this.shadowCascadeBias = [ 0, 0, 0 ];
-	this.shadowCascadeWidth = [ 512, 512, 512 ];
-	this.shadowCascadeHeight = [ 512, 512, 512 ];
-
-	this.shadowCascadeNearZ = [ - 1.000, 0.990, 0.998 ];
-	this.shadowCascadeFarZ = [ 0.990, 0.998, 1.000 ];
-
-	this.shadowCascadeArray = [];
-
-	//
-
 	this.shadowMap = null;
 	this.shadowMap = null;
 	this.shadowMapSize = null;
 	this.shadowMapSize = null;
 	this.shadowCamera = null;
 	this.shadowCamera = null;
@@ -94,20 +78,6 @@ THREE.DirectionalLight.prototype.clone = function () {
 	light.shadowMapWidth = this.shadowMapWidth;
 	light.shadowMapWidth = this.shadowMapWidth;
 	light.shadowMapHeight = this.shadowMapHeight;
 	light.shadowMapHeight = this.shadowMapHeight;
 
 
-	//
-
-	light.shadowCascade = this.shadowCascade;
-
-	light.shadowCascadeOffset.copy( this.shadowCascadeOffset );
-	light.shadowCascadeCount = this.shadowCascadeCount;
-
-	light.shadowCascadeBias = this.shadowCascadeBias.slice( 0 );
-	light.shadowCascadeWidth = this.shadowCascadeWidth.slice( 0 );
-	light.shadowCascadeHeight = this.shadowCascadeHeight.slice( 0 );
-
-	light.shadowCascadeNearZ = this.shadowCascadeNearZ.slice( 0 );
-	light.shadowCascadeFarZ = this.shadowCascadeFarZ.slice( 0 );
-
 	return light;
 	return light;
 
 
 };
 };

+ 2 - 16
src/renderers/WebGLRenderer.js

@@ -1939,7 +1939,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 			shadowMapEnabled: shadowMap.enabled && object.receiveShadow && maxShadows > 0,
 			shadowMapEnabled: shadowMap.enabled && object.receiveShadow && maxShadows > 0,
 			shadowMapType: shadowMap.type,
 			shadowMapType: shadowMap.type,
 			shadowMapDebug: shadowMap.debug,
 			shadowMapDebug: shadowMap.debug,
-			shadowMapCascade: shadowMap.cascade,
 
 
 			alphaTest: material.alphaTest,
 			alphaTest: material.alphaTest,
 			metal: material.metal,
 			metal: material.metal,
@@ -2616,7 +2615,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				if ( ! light.castShadow ) continue;
 				if ( ! light.castShadow ) continue;
 
 
-				if ( light instanceof THREE.SpotLight || ( light instanceof THREE.DirectionalLight && ! light.shadowCascade ) ) {
+				if ( light instanceof THREE.SpotLight || ( light instanceof THREE.DirectionalLight ) ) {
 
 
 					uniforms.shadowMap.value[ j ] = light.shadowMap;
 					uniforms.shadowMap.value[ j ] = light.shadowMap;
 					uniforms.shadowMapSize.value[ j ] = light.shadowMapSize;
 					uniforms.shadowMapSize.value[ j ] = light.shadowMapSize;
@@ -4037,7 +4036,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			if ( ! light.castShadow ) continue;
 			if ( ! light.castShadow ) continue;
 
 
 			if ( light instanceof THREE.SpotLight ) maxShadows ++;
 			if ( light instanceof THREE.SpotLight ) maxShadows ++;
-			if ( light instanceof THREE.DirectionalLight && ! light.shadowCascade ) maxShadows ++;
+			if ( light instanceof THREE.DirectionalLight ) maxShadows ++;
 
 
 		}
 		}
 
 
@@ -4122,19 +4121,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 				console.warn( 'THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug.' );
 				console.warn( 'THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug.' );
 				shadowMap.debug = value;
 				shadowMap.debug = value;
 
 
-			}
-		},
-		shadowMapCascade: {
-			get: function () {
-
-				return shadowMap.cascade;
-
-			},
-			set: function ( value ) {
-
-				console.warn( 'THREE.WebGLRenderer: .shadowMapCascade is now .shadowMap.cascade.' );
-				shadowMap.cascade = value;
-
 			}
 			}
 		}
 		}
 	} );
 	} );

+ 2 - 29
src/renderers/shaders/ShaderChunk/shadowmap_fragment.glsl

@@ -9,12 +9,6 @@
 
 
 	#endif
 	#endif
 
 
-	#ifdef SHADOWMAP_CASCADE
-
-		int inFrustumCount = 0;
-
-	#endif
-
 	float fDepth;
 	float fDepth;
 	vec3 shadowColor = vec3( 1.0 );
 	vec3 shadowColor = vec3( 1.0 );
 
 
@@ -28,20 +22,7 @@
 		bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
 		bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
 		bool inFrustum = all( inFrustumVec );
 		bool inFrustum = all( inFrustumVec );
 
 
-				// don't shadow pixels outside of light frustum
-				// use just first frustum (for cascades)
-				// don't shadow pixels behind far plane of light frustum
-
-		#ifdef SHADOWMAP_CASCADE
-
-			inFrustumCount += int( inFrustum );
-			bvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );
-
-		#else
-
-			bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
-
-		#endif
+		bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
 
 
 		bool frustumTest = all( frustumTestVec );
 		bool frustumTest = all( frustumTestVec );
 
 
@@ -195,15 +176,7 @@
 
 
 		#ifdef SHADOWMAP_DEBUG
 		#ifdef SHADOWMAP_DEBUG
 
 
-			#ifdef SHADOWMAP_CASCADE
-
-				if ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ i ];
-
-			#else
-
-				if ( inFrustum ) outgoingLight *= frustumColors[ i ];
-
-			#endif
+			if ( inFrustum ) outgoingLight *= frustumColors[ i ];
 
 
 		#endif
 		#endif
 
 

+ 0 - 2
src/renderers/webgl/WebGLProgram.js

@@ -218,7 +218,6 @@ THREE.WebGLProgram = ( function () {
 				parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',
 				parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',
 				parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',
 				parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',
 				parameters.shadowMapDebug ? '#define SHADOWMAP_DEBUG' : '',
 				parameters.shadowMapDebug ? '#define SHADOWMAP_DEBUG' : '',
-				parameters.shadowMapCascade ? '#define SHADOWMAP_CASCADE' : '',
 
 
 				parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',
 				parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',
 
 
@@ -329,7 +328,6 @@ THREE.WebGLProgram = ( function () {
 				parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',
 				parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',
 				parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',
 				parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',
 				parameters.shadowMapDebug ? '#define SHADOWMAP_DEBUG' : '',
 				parameters.shadowMapDebug ? '#define SHADOWMAP_DEBUG' : '',
-				parameters.shadowMapCascade ? '#define SHADOWMAP_CASCADE' : '',
 
 
 				parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
 				parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
 				parameters.logarithmicDepthBuffer && renderer.extensions.get( 'EXT_frag_depth' ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
 				parameters.logarithmicDepthBuffer && renderer.extensions.get( 'EXT_frag_depth' ) ? '#define USE_LOGDEPTHBUF_EXT' : '',

+ 9 - 209
src/renderers/webgl/WebGLShadowMap.js

@@ -66,23 +66,12 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 
 
 	this.type = THREE.PCFShadowMap;
 	this.type = THREE.PCFShadowMap;
 	this.cullFace = THREE.CullFaceFront;
 	this.cullFace = THREE.CullFaceFront;
-	this.cascade = false;
 
 
 	this.render = function ( scene, camera ) {
 	this.render = function ( scene, camera ) {
 
 
 		if ( scope.enabled === false ) return;
 		if ( scope.enabled === false ) return;
 		if ( scope.autoUpdate === false && scope.needsUpdate === false ) return;
 		if ( scope.autoUpdate === false && scope.needsUpdate === false ) return;
 
 
-		var i, il, j, jl, n,
-
-		shadowMap, shadowMatrix, shadowCamera,
-		webglObject, object, material, light,
-
-		lights = [],
-		k = 0,
-
-		fog = null;
-
 		// set GL state for depth map
 		// set GL state for depth map
 
 
 		_gl.clearColor( 1, 1, 1, 1 );
 		_gl.clearColor( 1, 1, 1, 1 );
@@ -103,67 +92,14 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 
 
 		_state.setDepthTest( true );
 		_state.setDepthTest( true );
 
 
-		// preprocess lights
-		// 	- skip lights that are not casting shadows
-		//	- create virtual lights for cascaded shadow maps
+		// render depth map
 
 
-		for ( i = 0, il = _lights.length; i < il; i ++ ) {
+		for ( var i = 0, il = _lights.length; i < il; i ++ ) {
 
 
-			light = _lights[ i ];
+			var light = _lights[ i ];
 
 
 			if ( ! light.castShadow ) continue;
 			if ( ! light.castShadow ) continue;
 
 
-			if ( ( light instanceof THREE.DirectionalLight ) && light.shadowCascade ) {
-
-				for ( n = 0; n < light.shadowCascadeCount; n ++ ) {
-
-					var virtualLight;
-
-					if ( ! light.shadowCascadeArray[ n ] ) {
-
-						virtualLight = createVirtualLight( light, n );
-						virtualLight.originalCamera = camera;
-
-						var gyro = new THREE.Gyroscope();
-						gyro.position.copy( light.shadowCascadeOffset );
-
-						gyro.add( virtualLight );
-						gyro.add( virtualLight.target );
-
-						camera.add( gyro );
-
-						light.shadowCascadeArray[ n ] = virtualLight;
-
-						//console.log( "Created virtualLight", virtualLight );
-
-					} else {
-
-						virtualLight = light.shadowCascadeArray[ n ];
-
-					}
-
-					updateVirtualLight( light, n );
-
-					lights[ k ] = virtualLight;
-					k ++;
-
-				}
-
-			} else {
-
-				lights[ k ] = light;
-				k ++;
-
-			}
-
-		}
-
-		// render depth map
-
-		for ( i = 0, il = lights.length; i < il; i ++ ) {
-
-			light = lights[ i ];
-
 			if ( ! light.shadowMap ) {
 			if ( ! light.shadowMap ) {
 
 
 				var shadowFilter = THREE.LinearFilter;
 				var shadowFilter = THREE.LinearFilter;
@@ -213,15 +149,9 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 
 
 			}
 			}
 
 
-			if ( light.isVirtual && virtualLight.originalCamera == camera ) {
-
-				updateShadowCamera( camera, light );
-
-			}
-
-			shadowMap = light.shadowMap;
-			shadowMatrix = light.shadowMatrix;
-			shadowCamera = light.shadowCamera;
+			var shadowMap = light.shadowMap;
+			var shadowMatrix = light.shadowMatrix;
+			var shadowCamera = light.shadowCamera;
 
 
 			//
 			//
 
 
@@ -268,9 +198,10 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 
 
 			// render regular objects
 			// render regular objects
 
 
+			var webglObject, object, material;
 			var objectMaterial, useMorphing, useSkinning;
 			var objectMaterial, useMorphing, useSkinning;
 
 
-			for ( j = 0, jl = _renderList.length; j < jl; j ++ ) {
+			for ( var j = 0, jl = _renderList.length; j < jl; j ++ ) {
 
 
 				webglObject = _renderList[ j ];
 				webglObject = _renderList[ j ];
 
 
@@ -308,7 +239,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 
 
 				}
 				}
 
 
-				_renderer.renderBufferDirect( shadowCamera, _lights, fog, material, object );
+				_renderer.renderBufferDirect( shadowCamera, _lights, null, material, object );
 
 
 			}
 			}
 
 
@@ -357,137 +288,6 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 
 
 	}
 	}
 
 
-	function createVirtualLight( light, cascade ) {
-
-		var virtualLight = new THREE.DirectionalLight();
-
-		virtualLight.isVirtual = true;
-
-		virtualLight.onlyShadow = true;
-		virtualLight.castShadow = true;
-
-		virtualLight.shadowCameraNear = light.shadowCameraNear;
-		virtualLight.shadowCameraFar = light.shadowCameraFar;
-
-		virtualLight.shadowCameraLeft = light.shadowCameraLeft;
-		virtualLight.shadowCameraRight = light.shadowCameraRight;
-		virtualLight.shadowCameraBottom = light.shadowCameraBottom;
-		virtualLight.shadowCameraTop = light.shadowCameraTop;
-
-		virtualLight.shadowCameraVisible = light.shadowCameraVisible;
-
-		virtualLight.shadowDarkness = light.shadowDarkness;
-
-		virtualLight.shadowBias = light.shadowCascadeBias[ cascade ];
-		virtualLight.shadowMapWidth = light.shadowCascadeWidth[ cascade ];
-		virtualLight.shadowMapHeight = light.shadowCascadeHeight[ cascade ];
-
-		virtualLight.pointsWorld = [];
-		virtualLight.pointsFrustum = [];
-
-		var pointsWorld = virtualLight.pointsWorld,
-			pointsFrustum = virtualLight.pointsFrustum;
-
-		for ( var i = 0; i < 8; i ++ ) {
-
-			pointsWorld[ i ] = new THREE.Vector3();
-			pointsFrustum[ i ] = new THREE.Vector3();
-
-		}
-
-		var nearZ = light.shadowCascadeNearZ[ cascade ];
-		var farZ = light.shadowCascadeFarZ[ cascade ];
-
-		pointsFrustum[ 0 ].set( - 1, - 1, nearZ );
-		pointsFrustum[ 1 ].set(  1, - 1, nearZ );
-		pointsFrustum[ 2 ].set( - 1,  1, nearZ );
-		pointsFrustum[ 3 ].set(  1,  1, nearZ );
-
-		pointsFrustum[ 4 ].set( - 1, - 1, farZ );
-		pointsFrustum[ 5 ].set(  1, - 1, farZ );
-		pointsFrustum[ 6 ].set( - 1,  1, farZ );
-		pointsFrustum[ 7 ].set(  1,  1, farZ );
-
-		return virtualLight;
-
-	}
-
-	// Synchronize virtual light with the original light
-
-	function updateVirtualLight( light, cascade ) {
-
-		var virtualLight = light.shadowCascadeArray[ cascade ];
-
-		virtualLight.position.copy( light.position );
-		virtualLight.target.position.copy( light.target.position );
-		virtualLight.lookAt( virtualLight.target );
-
-		virtualLight.shadowCameraVisible = light.shadowCameraVisible;
-		virtualLight.shadowDarkness = light.shadowDarkness;
-
-		virtualLight.shadowBias = light.shadowCascadeBias[ cascade ];
-
-		var nearZ = light.shadowCascadeNearZ[ cascade ];
-		var farZ = light.shadowCascadeFarZ[ cascade ];
-
-		var pointsFrustum = virtualLight.pointsFrustum;
-
-		pointsFrustum[ 0 ].z = nearZ;
-		pointsFrustum[ 1 ].z = nearZ;
-		pointsFrustum[ 2 ].z = nearZ;
-		pointsFrustum[ 3 ].z = nearZ;
-
-		pointsFrustum[ 4 ].z = farZ;
-		pointsFrustum[ 5 ].z = farZ;
-		pointsFrustum[ 6 ].z = farZ;
-		pointsFrustum[ 7 ].z = farZ;
-
-	}
-
-	// Fit shadow camera's ortho frustum to camera frustum
-
-	function updateShadowCamera( camera, light ) {
-
-		var shadowCamera = light.shadowCamera,
-			pointsFrustum = light.pointsFrustum,
-			pointsWorld = light.pointsWorld;
-
-		_min.set( Infinity, Infinity, Infinity );
-		_max.set( - Infinity, - Infinity, - Infinity );
-
-		for ( var i = 0; i < 8; i ++ ) {
-
-			var p = pointsWorld[ i ];
-
-			p.copy( pointsFrustum[ i ] );
-			p.unproject( camera );
-
-			p.applyMatrix4( shadowCamera.matrixWorldInverse );
-
-			if ( p.x < _min.x ) _min.x = p.x;
-			if ( p.x > _max.x ) _max.x = p.x;
-
-			if ( p.y < _min.y ) _min.y = p.y;
-			if ( p.y > _max.y ) _max.y = p.y;
-
-			if ( p.z < _min.z ) _min.z = p.z;
-			if ( p.z > _max.z ) _max.z = p.z;
-
-		}
-
-		shadowCamera.left = _min.x;
-		shadowCamera.right = _max.x;
-		shadowCamera.top = _max.y;
-		shadowCamera.bottom = _min.y;
-
-		// can't really fit near/far
-		//shadowCamera.near = _min.z;
-		//shadowCamera.far = _max.z;
-
-		shadowCamera.updateProjectionMatrix();
-
-	}
-
 	// For the moment just ignore objects that have multiple materials with different animation methods
 	// For the moment just ignore objects that have multiple materials with different animation methods
 	// Only the first material will be taken into account for deciding which depth material to use for shadow maps
 	// Only the first material will be taken into account for deciding which depth material to use for shadow maps