| Package | alternativa.engine3d.shadows |
| Class | public class DirectionalLightShadow |
| Inheritance | DirectionalLightShadow Shadow Object |
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
| Property | Defined 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 | ||
![]() | debug : 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 | ||
| Method | Defined By | ||
|---|---|---|---|
DirectionalLightShadow(width:Number, height:Number, nearBoundPosition:Number, farBoundPosition:Number, mapSize:int = 512, pcfOffset:Number = 0)
Create an instance of DirectionalLightShadow. | DirectionalLightShadow | ||
Adds given object to list of objects, that cast shadow. | DirectionalLightShadow | ||
clearCasters():void
Clears the list of objects, which cast shadow. | DirectionalLightShadow | ||
| biasMultiplier | property |
public var biasMultiplier:Number = 0.97Degree of correcting offset of shadow map space. It need for getting rid of self-shadowing artifacts.
| calculateParametersByVolume | property |
public var calculateParametersByVolume:Boolean = falseEnable/disable automatic calculation of shadow zone parameters on specified bound-box at shadowBoundBox property.
| centerX | property |
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
| centerY | property |
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
| centerZ | property |
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
| farBoundPosition | property |
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
| height | property |
| mapSize | property |
mapSize:intSet resolution of shadow map. This property can get value of power of 2 (up to 2048).
public function get mapSize():int public function set mapSize(value:int):void| nearBoundPosition | property |
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
| pcfOffset | property |
pcfOffset:NumberOffset of Percentage Closer Filtering. This way of filtering is used for mitigation of shadow bounds.
public function get pcfOffset():Number public function set pcfOffset(value:Number):void| volume | property |
public var volume:BoundBox = null| width | property |
| DirectionalLightShadow | () | Constructor |
public function DirectionalLightShadow(width:Number, height:Number, nearBoundPosition:Number, farBoundPosition:Number, mapSize:int = 512, pcfOffset:Number = 0)Create an instance of DirectionalLightShadow.
Parameterswidth: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.
|
| addCaster | () | method |
public function addCaster(object:Object3D):voidAdds given object to list of objects, that cast shadow.
Parameters
object:Object3D — Added object.
|
| clearCasters | () | method |
public function clearCasters():voidClears the list of objects, which cast shadow.