123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <base href="../../../../" />
- <script src="list.js"></script>
- <script src="page.js"></script>
- <link type="text/css" rel="stylesheet" href="page.css" />
- </head>
- <body>
- <h1>[name]</h1>
- <p class="desc">
- This is used internally by [page:PointLight PointLights] for calculating shadows, and also serves as
- a base class for the other shadow classes.
- </p>
- <h2>Example</h2>
- <p>
- <code>
- //Create a WebGLRenderer and turn on shadows in the renderer
- var renderer = new THREE.WebGLRenderer();
- renderer.shadowMap.enabled = true;
- renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
- //Create a PointLight and turn on shadows for the light
- var light = new THREE.PointLight( 0xffffff, 1, 100 );
- light.position.set( 0, 10, 0 );
- light.castShadow = true; // default false
- scene.add( light );
- //Set up shadow properties for the light
- light.shadow.mapSize.width = 512; // default
- light.shadow.mapSize.height = 512; // default
- light.shadow.camera.near = 0.5; // default
- light.shadow.camera.far = 500 // default
- //Create a sphere that cast shadows (but does not receive them)
- var sphereGeometry = new THREE.SphereBufferGeometry( 5, 32, 32 );
- var sphereMaterial = new THREE.MeshStandardMaterial( { color: 0xff0000 } );
- var sphere = new THREE.Mesh( sphereGeometry, sphereMaterial );
- sphere.castShadow = true; //default is false
- sphere.receiveShadow = false; //default
- scene.add( sphere );
- //Create a plane that receives shadows (but does not cast them)
- var planeGeometry = new THREE.PlaneBufferGeometry( 20, 20, 32, 32 );
- var planeMaterial = new THREE.MeshStandardMaterial( { color: 0x00ff00 } )
- var plane = new THREE.Mesh( planeGeometry, planeMaterial );
- plane.receiveShadow = true;
- scene.add( plane );
- //Create a helper for the shadow camera (optional)
- var helper = new THREE.CameraHelper( light.shadow.camera );
- scene.add( helper );
- </code>
- </p>
- <h2>Constructor</h2>
- <h3>[name]( [param:Camera camera] )</h3>
- <p>
- [page:Camera camera] - the light's view of the world.<br /><br />
- Create a new [name]. This is not intended to be called directly - it is called
- internally by [page:PointLight] or used as a base class by other light shadows.
- </p>
- <h2>Properties</h2>
- <h3>[property:Camera camera]</h3>
- <p>
- The light's view of the world. This is used to generate a depth map of the scene; objects behind
- other objects from the light's perspective will be in shadow.
- </p>
- <h3>[property:Float bias]</h3>
- <p>
- Shadow map bias, how much to add or subtract from the normalized depth when deciding whether a surface is in shadow.<br />
- The default is 0. Very tiny adjustments here (in the order of 0.0001) may help reduce artefacts in shadows
- </p>
- <h3>[property:WebGLRenderTarget map]</h3>
- <p>
- The depth map generated using the internal camera; a location beyond a pixel's depth is
- in shadow. Computed internally during rendering.
- </p>
- <h3>[property:Vector2 mapSize]</h3>
- <p>
- A [Page:Vector2] defining the width and height of the shadow map.<br /><br />
- Higher values give better quality shadows at the cost of computation time. Values must be
- powers of 2, up to the [page:WebGLRenderer.capabilities].maxTextureSize for a given device,
- although the width and height don't have to be the same (so, for example, (512, 1024) is valid).
- The default is *( 512, 512 )*.
- </p>
- <h3>[property:Matrix4 matrix]</h3>
- <p>
- Model to shadow camera space, to compute location and depth in shadow map. Stored
- in a [page:Matrix4 Matrix4]. This is computed internally during rendering.
- </p>
- <h3>[property:Float radius]</h3>
- <p>
- Setting this to values greater than 1 will blur the edges of the shadow.<br />
- High values will cause unwanted banding effects in the shadows - a greater [page:.mapSize mapSize]
- will allow for a higher value to be used here before these effects become visible.<br /><br />
- Note that this has no effect if the [page:WebGLRenderer.shadowMap.type] is set to [page:Renderer BasicShadowMap].
- </p>
- <h2>Methods</h2>
- <h3>[method:LightShadow copy]( [param:LightShadow source] )</h3>
- <p>
- Copies value of all the properties from the [page:LightShadow source] to this
- SpotLight.
- </p>
- <h3>[method:LightShadow clone]()</h3>
- <p>
- Creates a new LightShadow with the same properties as this one.
- </p>
- <h3>[method:Object toJSON]()</h3>
- <p>
- Serialize this LightShadow.
- </p>
- <h2>Source</h2>
- [link:https://github.com/mrdoob/three.js/blob/master/src/lights/[name].js src/lights/[name].js]
- </body>
- </html>
|