LightShadow

Serves as a base class for the other shadow classes.

Constructor

LightShadow(camera : Camera)

camera - the light's view of the world.

Create a new LightShadow. This is not intended to be called directly - it is used as a base class by other light shadows.

Properties

.camera : Camera

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.

.bias : Float

Shadow map bias, how much to add or subtract from the normalized depth when deciding whether a surface is in shadow.
The default is 0. Very tiny adjustments here (in the order of 0.0001) may help reduce artefacts in shadows

.expBias : Float

Exponential bias for ESMShadowMap to reduce light leaking which can happen near an occluder.
The default is 1. Increasing it reduces light leaking but make shadows less soft and make self-shadowing artifacts a bit more noticeable.

.isLightShadow : Boolean

Used to check whether this or derived classes are light shadows. Default is true.

You should not change this, as it used internally for optimization.

.map : WebGLRenderTarget

The depth map generated using the internal camera; a location beyond a pixel's depth is in shadow. Computed internally during rendering.

.mapPass : WebGLRenderTarget

The distribution map generated using the internal camera; an occlusion is calculated based on the distribution of depths. Computed internally during rendering.

.mapSize : Vector2

A Vector2 defining the width and height of the shadow map.

Higher values give better quality shadows at the cost of computation time. Values must be powers of 2, up to the 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).

.matrix : Matrix4

Model to shadow camera space, to compute location and depth in shadow map. Stored in a Matrix4. This is computed internally during rendering.

.radius : Float

Setting this to values greater than 1 will blur the edges of the shadow.
High values will cause unwanted banding effects in the shadows - a greater mapSize will allow for a higher value to be used here before these effects become visible.
If WebGLRenderer.shadowMap.type is set to PCFSoftShadowMap, radius has no effect and it is recommended to increase softness by decreasing mapSize instead.

Note that this has no effect if the WebGLRenderer.shadowMap.type is set to BasicShadowMap.

.slopeScaledBias : Number

An adaptive bias which depends on the polygon's slope relative to the light's camera. Default is 0.

Used mainly for shadow mapping.

Methods

.getFrameExtents () : Vector2

Used internally by the renderer to extend the shadow map to contain all viewports

.updateMatrices (light : Light) : null

Update the matrices for the camera and shadow, used internally by the renderer.

light -- the light for which the shadow is being rendered.

.getFrustum () : Frustum

Gets the shadow cameras frustum. Used internally by the renderer to cull objects.

.getViewportCount () : number

Used internally by the renderer to get the number of viewports that need to be rendered for this shadow.

.copy (source : LightShadow) : LightShadow

Copies value of all the properties from the source to this Light.

.clone () : LightShadow

Creates a new LightShadow with the same properties as this one.

.dispose () : null

Disposes shadow map render targets from memory.
You need to call this when you want shadow map resources removed while the application is running.

.toJSON () : Object

Serialize this LightShadow.

Source

For more info on how to obtain the source code of this module see this page.