The camera that owns this filter.
Optionalx: number
The horizontal offset of the shadow effect. Default 0.
Optionaly: number
The vertical offset of the shadow effect. Default 0.
Optionaldecay: number
The amount of decay for the shadow effect. Default 0.1.
Optionalpower: number
The power of the shadow effect. Default 1.
Optionalcolor: number
The color of the shadow, as a hex value. Default 0x000000.
Optionalsamples: number
The number of samples that the shadow effect will run for. Default 6.
Optionalintensity: number
The intensity of the shadow effect. Default 1.
Toggle this boolean to enable or disable this filter, without removing it from and re-adding it to the Camera's filter list.
ReadonlyallowIf true, this filter will be permitted to draw to the base texture.
This can be unwanted if, for example, the filter doesn't actually
draw anything.
This is an internal flag used by the renderer. You should not modify this value directly.
A reference to the Camera that owns this filter.
The color of the shadow, expressed as a hex RGB value (e.g. 0xff0000 for red,
0x000000 for black). Setting this property updates the internal glcolor array
used by the WebGL shader.
The padding currently being used by this filter.
This is read during rendering via getPadding, and may be updated by subclass implementations.
It is necessary for filters being used in an external list.
You should not modify this value directly.
Controls how quickly the shadow fades over distance. Lower values produce longer, more gradual shadows; higher values produce shorter, more concentrated shadows.
The internal WebGL color array used by the shader. Stores the shadow color
as normalized RGBA float values in the range 0 to 1. This array is updated
automatically when the color property is set.
Whether this filter controller will be destroyed when the FilterList that owns it is destroyed. If you enable this, you must ensure that you clean up the filter controller at an appropriate time. This allows you to reuse a controller for multiple objects; this is not recommended unless you know what you're doing. It tends to work best with external filters.
A multiplier for the overall shadow visibility. Higher values produce darker, more prominent shadows.
Padding override. This is on by default. If this is set,
the filter will use this padding instead of calculating it.
Prefer using setPaddingOverride instead of modifying this directly.
An exponent applied to the shadow falloff curve. Higher values create sharper shadow edges; lower values create softer, more diffuse shadows.
The ID of the RenderNode that this filter uses.
The number of samples that the shadow effect will run for.
This should be an integer with a minimum value of 1 and a maximum of 12.
The horizontal offset of the shadow effect.
The vertical offset of the shadow effect.
Destroys this Controller and nulls any references it holds.
Returns the amount of extra padding, in pixels, that this filter requires when rendering. The padding accounts for the shadow effect extending beyond the original bounds of the filtered Game Object.undefined
The padding Rectangle.
Returns the rounded padding required for this filter.
Most filters don't need extra padding, but some may sample beyond the texture boundaries, such as a blur or glow effect.
The bounds are encoded as a Rectangle. To enlarge the bounds, the top and left values should be negative, and the bottom and right values should be positive.
This method calls getPadding() to get the raw padding values,
and uses Math.ceil() to set the values of paddingOverride
and currentPadding.undefined
The rounded padding required by this filter.
Sets the active state of this filter.
A disabled filter will not be used.
true to enable this filter, or false to disable it.
This filter instance.
Sets the padding override.
If this is set, the filter will use this padding instead of calculating it.
Call setPaddingOverride(null) to clear the override.
Call setPaddingOverride() to set the padding to 0.
Optionalleft: number | null
The left padding. Default 0.
Optionaltop: number
The top padding. Default 0.
Optionalright: number
The right padding. Default 0.
Optionalbottom: number
The bottom padding. Default 0.
The Shadow Filter.
This filter controller manages the shadow effect for a Camera.
The shadow effect is a visual technique used to create the illusion of depth and realism by adding darker, offset silhouettes or shapes beneath game objects, characters, or environments. These simulated shadows help to enhance the visual appeal and immersion, making the 2D game world appear more dynamic and three-dimensional.
This effect samples across an area. To avoid missing data at the edges, use
controller.setPaddingOverride(null)to automatically pad game objects, orcamera.getPaddingWrapper(x)to enlarge a camera.A Shadow effect is added to a Camera via the FilterList component: