CLASSES
TagsA - Z

ShadowGenerator

Description

class ShadowGenerator

Shadows are dynamic, they are dynamically generated depending upon a Directionallight.

A tutorial about shadows can be found here : https://doc.babylonjs.com/tutorials/shadows

Constructor

new ShadowGenerator(mapSize, light)

Creates a new ShadowGenerator object

Parameters

Name Type Description
mapSize number The size of the shadow map
light IShadowLight The light used for the shadow map's computation

Members

static FILTER_NONE : number

No filter will be used for this shadow

static FILTER_VARIANCESHADOWMAP : number

The variance shadowmap will be used for this shadow

static FILTER_POISSONSAMPLING : number

The poisson sampling filter will be used

static FILTER_BLURVARIANCESHADOWMAP : number

blurScale : number

forceBackFacesOnly : boolean

bias : number

blurBoxOffset : number

filter : number

One of the following values : FILTER_NONE, FILTER_VARIANCESHADOWMAP, FILTER_POISSONSAMPLING

useVarianceShadowMap : boolean

True by default, defines the realtime shadowing algorithm, using the light's point of view

usePoissonSampling : boolean

Disables the useVarianceShadowMap and activates poisson sampling to soften shadows

useBlurVarianceShadowMap : boolean

Methods

isReady(subMesh, useInstances) → boolean

Parameters

Name Type Description
subMesh SubMesh @param subMesh
useInstances boolean @param useInstances

getShadowMap() → RenderTargetTexture

Defines which shadow will be rendered

getShadowMapForRendering() → RenderTargetTexture

getLight() → IShadowLight

Returns the DirectionalLight of this ShadowGenerator

getTransformMatrix() → Matrix

Returns the transform matrix of this ShadowGenerator

getDarkness() → number

Returns the darkness

setDarkness(darkness) → void

Sets the darkness with the given float between 0.0 to 1.0

Parameters

Name Type Description
darkness number The given darkness

setTransparencyShadow(hasShadow) → void

Defines if the light goes through the object's holes and non opaque surfaces

Parameters

Name Type Description
hasShadow boolean default : false. True to activate transparency shadow, else false

dispose() → void

serialize() → any

static Parse(parsedShadowGenerator, scene) → ShadowGenerator

Parameters

Name Type Description
parsedShadowGenerator any
scene Scene