CLASSES
TagsA - Z

ShadowGenerator

Description

class ShadowGenerator

Constructor

new ShadowGenerator(mapSize, light, useFullFloatFirst)

Creates a ShadowGenerator object.

A ShadowGenerator is the required tool to use the shadows.

Each light casting shadows needs to use its own ShadowGenerator.

Required parameters :

Documentation : http://doc.babylonjs.com/tutorials/shadows

Parameters

Name Type Description
mapSize number
light IShadowLight
optional useFullFloatFirst boolean

Members

static FILTER_NONE : number

static FILTER_POISSONSAMPLING : number

static FILTER_EXPONENTIALSHADOWMAP : number

static FILTER_BLUREXPONENTIALSHADOWMAP : number

static FILTER_CLOSEEXPONENTIALSHADOWMAP : number

static FILTER_BLURCLOSEEXPONENTIALSHADOWMAP : number

bias : number

blurBoxOffset : number

blurScale : number

blurKernel : number

useKernelBlur : boolean

depthScale : number

filter : number

usePoissonSampling : boolean

useVarianceShadowMap : boolean

useBlurVarianceShadowMap : boolean

useExponentialShadowMap : boolean

useBlurExponentialShadowMap : boolean

useCloseExponentialShadowMap : boolean

useBlurCloseExponentialShadowMap : boolean

frustumEdgeFalloff : number

Controls the extent to which the shadows fade out at the edge of the frustum

Used only by directionals and spots

forceBackFacesOnly : boolean

Methods

getDarkness() number

Returns the darkness value (float).

setDarkness(darkness) ShadowGenerator

Sets the ShadowGenerator darkness value (float <= 1.0).

Returns the ShadowGenerator.

Parameters

Name Type Description
darkness number

setTransparencyShadow(hasShadow) ShadowGenerator

Sets the ability to have transparent shadow (boolean).

Returns the ShadowGenerator.

Parameters

Name Type Description
hasShadow boolean

getShadowMap() Nullable<RenderTargetTexture>

Returns a RenderTargetTexture object : the shadow map texture.

getShadowMapForRendering() Nullable<RenderTargetTexture>

Returns the most ready computed shadow map as a RenderTargetTexture object.

addShadowCaster(mesh, includeDescendants) ShadowGenerator

Helper function to add a mesh and its descendants to the list of shadow casters

Parameters

Name Type Description
mesh AbstractMesh Mesh to add
optional includeDescendants boolean boolean indicating if the descendants should be added. Default to true

removeShadowCaster(mesh, includeDescendants) ShadowGenerator

Helper function to remove a mesh and its descendants from the list of shadow casters

Parameters

Name Type Description
mesh AbstractMesh Mesh to remove
optional includeDescendants boolean boolean indicating if the descendants should be removed. Default to true

getLight() IShadowLight

Returns the associated light object.

forceCompilation(onCompiled, options) void

Force shader compilation including textures ready check

Parameters

Name Type Description
onCompiled (generator: ShadowGenerator) => void
optional options { useInstances: boolean }

isReady(subMesh, useInstances) boolean

Boolean : true when the ShadowGenerator is finally computed.

Parameters

Name Type Description
subMesh SubMesh
useInstances boolean

prepareDefines(defines, lightIndex) void

This creates the defines related to the standard BJS materials.

Parameters

Name Type Description
defines any
lightIndex number

bindShadowLight(lightIndex, effect) void

This binds shadow lights related to the standard BJS materials.

It implies the unifroms available on the materials are the standard BJS ones.

Parameters

Name Type Description
lightIndex string
effect Effect

getTransformMatrix() Matrix

Returns a Matrix object : the updated transformation matrix.

recreateShadowMap() void

dispose() void

Disposes the ShadowGenerator.

Returns nothing.

serialize() any

Serializes the ShadowGenerator and returns a serializationObject.

static Parse(parsedShadowGenerator, scene) ShadowGenerator

Parses a serialized ShadowGenerator and returns a new ShadowGenerator.

Parameters

Name Type Description
parsedShadowGenerator any
scene Scene