reckfellENGINE

Light2D

Casts light in a 2D environment.

On this page
class Light2DReckfellSharpInherits Entity2D

Casts light in a 2D environment.

Casts light in a 2D environment. A light is defined as a color, an energy value, a mode (see constants), and various other parameters (range and shadows-related).

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Properties15

BlendModeProperty
# BlendMode
C#
public Light2D.BlendModeEnum BlendMode { get; set; }

The Light2D's blend mode.

ColorProperty
# Color
C#
public Color Color { get; set; }

The Light2D's Color.

EditorOnlyProperty
# EditorOnly
C#
public bool EditorOnly { get; set; }

If true, Light2D will only appear when editing the scene.

EnabledProperty
# Enabled
C#
public bool Enabled { get; set; }

If true, Light2D will emit light.

EnergyProperty
# Energy
C#
public float Energy { get; set; }

The Light2D's energy value. The larger the value, the stronger the light.

RangeItemCullMaskProperty
# RangeItemCullMask
C#
public int RangeItemCullMask { get; set; }

The layer mask. Only objects with a matching CanvasItem.LightMask will be affected by the Light2D. See also Light2D.ShadowItemCullMask, which affects which objects can cast shadows. Note: Light2D.RangeItemCullMask is ignored by DirectionalLight2D, which will always light a 2D node regardless of the 2D node's CanvasItem.LightMask.

RangeLayerMaxProperty
# RangeLayerMax
C#
public int RangeLayerMax { get; set; }

Maximum layer value of objects that are affected by the Light2D.

RangeLayerMinProperty
# RangeLayerMin
C#
public int RangeLayerMin { get; set; }

Minimum layer value of objects that are affected by the Light2D.

RangeZMaxProperty
# RangeZMax
C#
public int RangeZMax { get; set; }

Maximum z value of objects that are affected by the Light2D.

RangeZMinProperty
# RangeZMin
C#
public int RangeZMin { get; set; }

Minimum z value of objects that are affected by the Light2D.

ShadowColorProperty
# ShadowColor
C#
public Color ShadowColor { get; set; }

Color of shadows cast by the Light2D.

ShadowEnabledProperty
# ShadowEnabled
C#
public bool ShadowEnabled { get; set; }

If true, the Light2D will cast shadows.

ShadowFilterProperty
# ShadowFilter
C#
public Light2D.ShadowFilterEnum ShadowFilter { get; set; }

Shadow filter type.

ShadowFilterSmoothProperty
# ShadowFilterSmooth
C#
public float ShadowFilterSmooth { get; set; }

Smoothing value for shadows. Higher values will result in softer shadows, at the cost of visible streaks that can appear in shadow rendering. Light2D.ShadowFilterSmooth only has an effect if Light2D.ShadowFilter is Light2D.ShadowFilterEnum.Pcf5 or Light2D.ShadowFilterEnum.Pcf13.

ShadowItemCullMaskProperty
# ShadowItemCullMask
C#
public int ShadowItemCullMask { get; set; }

Shadow bitmask. For PointLight2D, occluder selection intersects it with LightOccluder2D.OccluderLightMask; applying shadows to receivers also checks CanvasItem.LightMask. This is separate from RangeItemCullMask, which selects illuminated items. Start with all these masks set to 1, then separate groups deliberately.

Verified mask example.

Methods32

GetBlendModeLight2D.BlendModeEnum
# GetBlendMode
C#
public Light2D.BlendModeEnum GetBlendMode();
Returns Light2D.BlendModeEnum
GetColorColor
# GetColor
C#
public Color GetColor();
Returns Color
GetEnergyfloat
# GetEnergy
C#
public float GetEnergy();
Returns float
GetHeightfloat
# GetHeight
C#
public float GetHeight();

Returns the light's height, which is used in 2D normal mapping. See PointLight2D.Height and DirectionalLight2D.Height.

Returns float
GetItemCullMaskint
# GetItemCullMask
C#
public int GetItemCullMask();
Returns int
GetItemShadowCullMaskint
# GetItemShadowCullMask
C#
public int GetItemShadowCullMask();
Returns int
GetLayerRangeMaxint
# GetLayerRangeMax
C#
public int GetLayerRangeMax();
Returns int
GetLayerRangeMinint
# GetLayerRangeMin
C#
public int GetLayerRangeMin();
Returns int
GetShadowColorColor
# GetShadowColor
C#
public Color GetShadowColor();
Returns Color
GetShadowFilterLight2D.ShadowFilterEnum
# GetShadowFilter
C#
public Light2D.ShadowFilterEnum GetShadowFilter();
Returns Light2D.ShadowFilterEnum
GetShadowSmoothfloat
# GetShadowSmooth
C#
public float GetShadowSmooth();
Returns float
GetZRangeMaxint
# GetZRangeMax
C#
public int GetZRangeMax();
Returns int
GetZRangeMinint
# GetZRangeMin
C#
public int GetZRangeMin();
Returns int
IsEditorOnlybool
# IsEditorOnly
C#
public bool IsEditorOnly();
Returns bool
IsEnabledbool
# IsEnabled
C#
public bool IsEnabled();
Returns bool
IsShadowEnabledbool
# IsShadowEnabled
C#
public bool IsShadowEnabled();
Returns bool
SetBlendModevoid
# SetBlendMode
C#
public void SetBlendMode(Light2D.BlendModeEnum mode);
Parameters
NameTypeDefault
modeLight2D.BlendModeEnum—
SetColorvoid
# SetColor
C#
public void SetColor(Color color);
Parameters
NameTypeDefault
colorColor—
SetEditorOnlyvoid
# SetEditorOnly
C#
public void SetEditorOnly(bool editorOnly);
Parameters
NameTypeDefault
editorOnlybool—
SetEnabledvoid
# SetEnabled
C#
public void SetEnabled(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetEnergyvoid
# SetEnergy
C#
public void SetEnergy(float energy);
Parameters
NameTypeDefault
energyfloat—
SetHeightvoid
# SetHeight
C#
public void SetHeight(float height);

Sets the light's height, which is used in 2D normal mapping. See PointLight2D.Height and DirectionalLight2D.Height.

Parameters
NameTypeDefault
heightfloat—
SetItemCullMaskvoid
# SetItemCullMask
C#
public void SetItemCullMask(int itemCullMask);
Parameters
NameTypeDefault
itemCullMaskint—
SetItemShadowCullMaskvoid
# SetItemShadowCullMask
C#
public void SetItemShadowCullMask(int itemShadowCullMask);
Parameters
NameTypeDefault
itemShadowCullMaskint—
SetLayerRangeMaxvoid
# SetLayerRangeMax
C#
public void SetLayerRangeMax(int layer);
Parameters
NameTypeDefault
layerint—
SetLayerRangeMinvoid
# SetLayerRangeMin
C#
public void SetLayerRangeMin(int layer);
Parameters
NameTypeDefault
layerint—
SetShadowColorvoid
# SetShadowColor
C#
public void SetShadowColor(Color shadowColor);
Parameters
NameTypeDefault
shadowColorColor—
SetShadowEnabledvoid
# SetShadowEnabled
C#
public void SetShadowEnabled(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetShadowFiltervoid
# SetShadowFilter
C#
public void SetShadowFilter(Light2D.ShadowFilterEnum filter);
Parameters
NameTypeDefault
filterLight2D.ShadowFilterEnum—
SetShadowSmoothvoid
# SetShadowSmooth
C#
public void SetShadowSmooth(float smooth);
Parameters
NameTypeDefault
smoothfloat—
SetZRangeMaxvoid
# SetZRangeMax
C#
public void SetZRangeMax(int z);
Parameters
NameTypeDefault
zint—
SetZRangeMinvoid
# SetZRangeMin
C#
public void SetZRangeMin(int z);
Parameters
NameTypeDefault
zint—

Light2D.BlendModeEnum

ValueDescription
Add = 0

Adds the value of pixels corresponding to the Light2D to the values of pixels under it. This is the common behavior of a light.

Mix = 2

Mix the value of pixels corresponding to the Light2D to the values of pixels under it by linear interpolation.

Sub = 1

Subtracts the value of pixels corresponding to the Light2D to the values of pixels under it, resulting in inversed light effect.

Light2D.ShadowFilterEnum

ValueDescription
None = 0

No filter applies to the shadow map. This provides hard shadow edges and is the fastest to render. See Light2D.ShadowFilter.

Pcf13 = 2

Percentage closer filtering (13 samples) applies to the shadow map. This is the slowest shadow filtering mode, and should be used sparingly. See Light2D.ShadowFilter.

Pcf5 = 1

Percentage closer filtering (5 samples) applies to the shadow map. This is slower compared to hard shadow rendering. See Light2D.ShadowFilter.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.