Packagealternativa.engine3d.shadows
Classpublic class DirectionalLightShadow
InheritanceDirectionalLightShadow Inheritance Shadow Inheritance Object

Class of the shadow, that is created by one source of light(DirectionalLight). Shadow is rendered in fixed volume. For binding of shadow to light source you need: 1) to set instance of the DirectionalLightShadow as a value of property shadow of light source; 2) to add Object3D to corresponding list, using the method addCaster().

See also

addCaster()
alternativa.engine3d.lights.DirectionalLight.shadow
farBoundPosition


Public Properties
 PropertyDefined By
  biasMultiplier : Number = 0.97
Degree of correcting offset of shadow map space.
DirectionalLightShadow
  calculateParametersByVolume : Boolean = false
Enable/disable automatic calculation of shadow zone parameters on specified bound-box at shadowBoundBox property.
DirectionalLightShadow
  centerX : Number = 0
Coordinate X of center of shadow rendering area.
DirectionalLightShadow
  centerY : Number = 0
Coordinate Y of center of shadow rendering area.
DirectionalLightShadow
  centerZ : Number = 0
Coordinate Z of center of shadow rendering area.
DirectionalLightShadow
 Inheriteddebug : Boolean = false
Debug mode.
Shadow
  farBoundPosition : Number = 0
Far clipping bound of calculation of shadow area.
DirectionalLightShadow
  height : Number
Length of shadow area (basics of bounbox).
DirectionalLightShadow
  mapSize : int
Set resolution of shadow map.
DirectionalLightShadow
  nearBoundPosition : Number = 0
Near clipping bound of calculation of shadow area.
DirectionalLightShadow
  pcfOffset : Number
Offset of Percentage Closer Filtering.
DirectionalLightShadow
  volume : BoundBox = null
DirectionalLightShadow
  width : Number
Width of shadow area (basics of bounbox).
DirectionalLightShadow
Public Methods
 MethodDefined By
  
DirectionalLightShadow(width:Number, height:Number, nearBoundPosition:Number, farBoundPosition:Number, mapSize:int = 512, pcfOffset:Number = 0)
Create an instance of DirectionalLightShadow.
DirectionalLightShadow
  
addCaster(object:Object3D):void
Adds given object to list of objects, that cast shadow.
DirectionalLightShadow
  
Clears the list of objects, which cast shadow.
DirectionalLightShadow
Property Detail
biasMultiplierproperty
public var biasMultiplier:Number = 0.97

Degree of correcting offset of shadow map space. It need for getting rid of self-shadowing artifacts.

calculateParametersByVolumeproperty 
public var calculateParametersByVolume:Boolean = false

Enable/disable automatic calculation of shadow zone parameters on specified bound-box at shadowBoundBox property.

centerXproperty 
public var centerX:Number = 0

Coordinate X of center of shadow rendering area. Relative to the center are specified such properties as: width, height, nearBoundPosition, farBoundPosition.

See also

centerYproperty 
public var centerY:Number = 0

Coordinate Y of center of shadow rendering area. Relative to the center are specified such properties as: width, height, nearBoundPosition, farBoundPosition.

See also

centerZproperty 
public var centerZ:Number = 0

Coordinate Z of center of shadow rendering area. Relative to the center are specified such properties as: width, height, nearBoundPosition, farBoundPosition.

See also

farBoundPositionproperty 
public var farBoundPosition:Number = 0

Far clipping bound of calculation of shadow area. Shadow map essentially similar to z-buffer: distance from light source to shadow casting place is coded by pixel color. So, properties nearBoundPosition and farBoundPosition in some ways are analogues of Camera3D.farClipping and Camera3D.nearclipping. The greater the range between nearBoundPosition and farBoundPosition , the rougher the coordinates of the pixel shader will be determined. Shadow area, that is not included into this range would not be drawn. Value is measured from center of shadow, that is set by properties centerX, centerY, centerZ.

See also

heightproperty 
public var height:Number

Length of shadow area (basics of bounbox).

See also

mapSizeproperty 
mapSize:int

Set resolution of shadow map. This property can get value of power of 2 (up to 2048).


Implementation
    public function get mapSize():int
    public function set mapSize(value:int):void
nearBoundPositionproperty 
public var nearBoundPosition:Number = 0

Near clipping bound of calculation of shadow area. Shadow map essentially similar to z-buffer: distance from light source to shadow casting place is coded by pixel color. So, properties nearBoundPosition and farBoundPosition in some ways are analogues of Camera3D.farClipping and Camera3D.nearclipping. The greater the range between nearBoundPosition and farBoundPosition , the rougher the coordinates of the pixel shader will be determined. Shadow area, that is not included into this range would not be drawn. Value is measured from center of shadow, that is set by properties: centerX, centerY, centerZ.

See also

pcfOffsetproperty 
pcfOffset:Number

Offset of Percentage Closer Filtering. This way of filtering is used for mitigation of shadow bounds.


Implementation
    public function get pcfOffset():Number
    public function set pcfOffset(value:Number):void
volumeproperty 
public var volume:BoundBox = null

widthproperty 
public var width:Number

Width of shadow area (basics of bounbox).

See also

Constructor Detail
DirectionalLightShadow()Constructor
public function DirectionalLightShadow(width:Number, height:Number, nearBoundPosition:Number, farBoundPosition:Number, mapSize:int = 512, pcfOffset:Number = 0)

Create an instance of DirectionalLightShadow.

Parameters
width:Number — Width of area, that will dispay shadow.
 
height:Number — Lenght of area, that will display shadow.
 
nearBoundPosition:Number — Near bound of cut of shadow calculation area.
 
farBoundPosition:Number — Far bound of cut of shadow calculation area.
 
mapSize:int (default = 512) — Size of shadow map. Must be a power of two.
 
pcfOffset:Number (default = 0) — Mitigation of shadow bounds.
Method Detail
addCaster()method
public function addCaster(object:Object3D):void

Adds given object to list of objects, that cast shadow.

Parameters

object:Object3D — Added object.

clearCasters()method 
public function clearCasters():void

Clears the list of objects, which cast shadow.