reckfellENGINE

DirectionalLight3D

Directional light from a distance, as from the Sun.

On this page
class DirectionalLight3DReckfellSharpInherits Light3D

Directional light from a distance, as from the Sun.

A directional light is a type of Light3D node that models an infinite number of parallel rays covering the entire scene. It is used for lights with strong intensity that are located far away from the scene to model sunlight or moonlight. Light is emitted in the -Z direction of the node's global basis. For an unrotated light, this means that the light is emitted forwards, illuminating the front side of a 3D model (see Vector3.Forward and Vector3.ModelFront). The position of the node is ignored; only the basis is used to determine light direction.

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

Constructors1

DirectionalLight3DConstructor
# DirectionalLight3D
C#
public DirectionalLight3D();

Properties9

DirectionalShadowBlendSplitsProperty
# DirectionalShadowBlendSplits
C#
public bool DirectionalShadowBlendSplits { get; set; }

If true, shadow detail is sacrificed in exchange for smoother transitions between splits. Enabling shadow blend splitting also has a moderate performance cost. This is ignored when DirectionalLight3D.DirectionalShadowMode is DirectionalLight3D.ShadowMode.Orthogonal.

DirectionalShadowFadeStartProperty
# DirectionalShadowFadeStart
C#
public float DirectionalShadowFadeStart { get; set; }

Proportion of DirectionalLight3D.DirectionalShadowMaxDistance at which point the shadow starts to fade. At DirectionalLight3D.DirectionalShadowMaxDistance, the shadow will disappear. The default value is a balance between smooth fading and distant shadow visibility. If the camera moves fast and the DirectionalLight3D.DirectionalShadowMaxDistance is low, consider lowering DirectionalLight3D.DirectionalShadowFadeStart below 0.8 to make shadow transitions less noticeable. On the other hand, if you tuned DirectionalLight3D.DirectionalShadowMaxDistance to cover the entire scene, you can set DirectionalLight3D.DirectionalShadowFadeStart to 1.0 to prevent the shadow from fading in the distance (it will suddenly cut off instead).

DirectionalShadowMaxDistanceProperty
# DirectionalShadowMaxDistance
C#
public float DirectionalShadowMaxDistance { get; set; }

The maximum distance for shadow splits. Increasing this value will make directional shadows visible from further away, at the cost of lower overall shadow detail and performance (since more objects need to be included in the directional shadow rendering).

DirectionalShadowModeProperty
# DirectionalShadowMode
C#
public DirectionalLight3D.ShadowMode DirectionalShadowMode { get; set; }

The light's shadow rendering algorithm.

DirectionalShadowPancakeSizeProperty
# DirectionalShadowPancakeSize
C#
public float DirectionalShadowPancakeSize { get; set; }

Sets the size of the directional shadow pancake. The pancake offsets the start of the shadow's camera frustum to provide a higher effective depth resolution for the shadow. However, a high pancake size can cause artifacts in the shadows of large objects that are close to the edge of the frustum. Reducing the pancake size can help. Setting the size to 0 turns off the pancaking effect.

DirectionalShadowSplit1Property
# DirectionalShadowSplit1
C#
public float DirectionalShadowSplit1 { get; set; }

The distance from camera to shadow split 1. Relative to DirectionalLight3D.DirectionalShadowMaxDistance. Only used when DirectionalLight3D.DirectionalShadowMode is DirectionalLight3D.ShadowMode.Parallel2Splits or DirectionalLight3D.ShadowMode.Parallel4Splits.

DirectionalShadowSplit2Property
# DirectionalShadowSplit2
C#
public float DirectionalShadowSplit2 { get; set; }

The distance from shadow split 1 to split 2. Relative to DirectionalLight3D.DirectionalShadowMaxDistance. Only used when DirectionalLight3D.DirectionalShadowMode is DirectionalLight3D.ShadowMode.Parallel4Splits.

DirectionalShadowSplit3Property
# DirectionalShadowSplit3
C#
public float DirectionalShadowSplit3 { get; set; }

The distance from shadow split 2 to split 3. Relative to DirectionalLight3D.DirectionalShadowMaxDistance. Only used when DirectionalLight3D.DirectionalShadowMode is DirectionalLight3D.ShadowMode.Parallel4Splits.

SkyModeProperty
# SkyMode
C#
public DirectionalLight3D.SkyModeEnum SkyMode { get; set; }

Directional-light participation: LightAndSky, LightOnly or SkyOnly. LightOnly excludes it from sky shader slots LIGHT0 through LIGHT3. SkyOnly retains sky participation without ordinary direct geometry lighting. A slot number is not a persistent light ID.

Methods6

GetShadowModeDirectionalLight3D.ShadowMode
# GetShadowMode
C#
public DirectionalLight3D.ShadowMode GetShadowMode();
Returns DirectionalLight3D.ShadowMode
GetSkyModeDirectionalLight3D.SkyModeEnum
# GetSkyMode
C#
public DirectionalLight3D.SkyModeEnum GetSkyMode();

Directional-light participation: LightAndSky, LightOnly or SkyOnly. LightOnly excludes it from sky shader slots LIGHT0 through LIGHT3. SkyOnly retains sky participation without ordinary direct geometry lighting. A slot number is not a persistent light ID.

Returns DirectionalLight3D.SkyModeEnum

Assigned SkyModeEnum.

IsBlendSplitsEnabledbool
# IsBlendSplitsEnabled
C#
public bool IsBlendSplitsEnabled();
Returns bool
SetBlendSplitsvoid
# SetBlendSplits
C#
public void SetBlendSplits(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetShadowModevoid
# SetShadowMode
C#
public void SetShadowMode(DirectionalLight3D.ShadowMode mode);
Parameters
NameTypeDefault
modeDirectionalLight3D.ShadowMode—
SetSkyModevoid
# SetSkyMode
C#
public void SetSkyMode(DirectionalLight3D.SkyModeEnum mode);

Directional-light participation: LightAndSky, LightOnly or SkyOnly. LightOnly excludes it from sky shader slots LIGHT0 through LIGHT3. SkyOnly retains sky participation without ordinary direct geometry lighting. A slot number is not a persistent light ID.

Parameters
NameTypeDefault
modeDirectionalLight3D.SkyModeEnum—
mode

Light/sky participation mode.

DirectionalLight3D.ShadowMode

ValueDescription
Orthogonal = 0

Renders the entire scene's shadow map from an orthogonal point of view. This is the fastest directional shadow mode. May result in blurrier shadows on close objects.

Parallel2Splits = 1

Splits the view frustum in 2 areas, each with its own shadow map. This shadow mode is a compromise between DirectionalLight3D.ShadowMode.Orthogonal and DirectionalLight3D.ShadowMode.Parallel4Splits in terms of performance.

Parallel4Splits = 2

Splits the view frustum in 4 areas, each with its own shadow map. This is the slowest directional shadow mode.

DirectionalLight3D.SkyModeEnum

ValueDescription
LightAndSky = 0

Makes the light visible in both scene lighting and sky rendering.

LightOnly = 1

Makes the light visible in scene lighting only (including direct lighting and global illumination). When using this mode, the light will not be visible from sky shaders.

SkyOnly = 2

Makes the light visible to sky shaders only. When using this mode the light will not cast light into the scene (either through direct lighting or through global illumination), but can be accessed through sky shaders. This can be useful, for example, when you want to control sky effects without illuminating the scene (during a night cycle, for example).

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.