Capítulo 473 de 859

Chapter 473: ShadowNode

Core Idea

Represents the default shadow implementation for lighting nodes.

Key Concepts

  • depthLayer : number (readonly): This index can be used when overriding setupRenderTarget with a RenderTarget Array to specify the depth layer.
  • isShadowNode : boolean (readonly): This flag can be used for type testing.
  • shadow : LightShadow: The light shadow which defines the properties light's shadow.
  • shadowMap : RenderTarget: A reference to the shadow map which is a render target.
  • vsmMaterialHorizontal : NodeMaterial: Only relevant for VSM shadows. Node material which is used to render the second VSM pass.
  • vsmMaterialVertical : NodeMaterial: Only relevant for VSM shadows. Node material which is used to render the first VSM pass.
  • vsmShadowMapHorizontal : RenderTarget: Only relevant for VSM shadows. Render target for the second VSM render pass.
  • vsmShadowMapVertical : RenderTarget: Only relevant for VSM shadows. Render target for the first VSM render pass.

Reference Tables

Constructor

Signature
new ShadowNode( light : Light, shadow : LightShadow )

Properties

PropertyDescription
.depthLayer : number (readonly)This index can be used when overriding setupRenderTarget with a RenderTarget Array to specify the depth layer.
.isShadowNode : boolean (readonly)This flag can be used for type testing.
.shadow : LightShadowThe light shadow which defines the properties light's shadow.
.shadowMap : RenderTargetA reference to the shadow map which is a render target.
.vsmMaterialHorizontal : NodeMaterialOnly relevant for VSM shadows. Node material which is used to render the second VSM pass.
.vsmMaterialVertical : NodeMaterialOnly relevant for VSM shadows. Node material which is used to render the first VSM pass.
.vsmShadowMapHorizontal : RenderTargetOnly relevant for VSM shadows. Render target for the second VSM render pass.
.vsmShadowMapVertical : RenderTargetOnly relevant for VSM shadows. Render target for the first VSM render pass.

Methods

MethodDescription
.dispose()Frees the internal resources of this shadow node.
.getShadowFilterFn( type : number ) : functionReturns the shadow filtering function for the given shadow type.
.renderShadow( frame : NodeFrame )Renders the shadow. The logic of this function could be included into ShadowNode#updateShadow however more specialized shadow nodes might require a custom shadow map r…
.setup( builder : NodeBuilder ) : ShaderCallNodeInternalThe implementation performs the setup of the output node. An output is only produces if shadow mapping is globally enabled in the renderer.
.setupShadow( builder : NodeBuilder ) : Node.<vec3>Setups the shadow output node.
.setupShadowCoord( builder : NodeBuilder, shadowPosition : Node.<vec3> ) : Node.<vec3>Setups the shadow coordinates.
.setupShadowFilter( builder : NodeBuilder, inputs : Object ) : Node.<float>Setups the shadow filtering.
.updateBefore( frame : NodeFrame )The implementation performs the update of the shadow map if necessary.
.updateShadow( frame : NodeFrame )Updates the shadow.
.vsmPass( renderer : Renderer )For VSM additional render passes are required.

Key Takeaways

  1. ShadowNode extends: EventDispatcher → Node → ShadowBaseNode
  2. Most relevant properties: depthLayer, isShadowNode, shadow, shadowMap.
  3. Key methods: dispose, getShadowFilterFn, renderShadow, setup.

Connects To