Table of Contents

Class DirectionalLight3D

Namespace
Godot
Assembly
GodotSharp.dll

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. The worldspace location of the DirectionalLight3D transform (origin) is ignored. Only the basis is used to determine light direction.

public class DirectionalLight3D : Light3D, IDisposable
Inheritance
DirectionalLight3D
Implements
Inherited Members

Constructors

DirectionalLight3D()

public DirectionalLight3D()

Properties

DirectionalShadowBlendSplits

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 DirectionalShadowMode is Orthogonal.

public bool DirectionalShadowBlendSplits { get; set; }

Property Value

bool

DirectionalShadowFadeStart

Proportion of DirectionalShadowMaxDistance at which point the shadow starts to fade. At 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 DirectionalShadowMaxDistance is low, consider lowering DirectionalShadowFadeStart below 0.8 to make shadow transitions less noticeable. On the other hand, if you tuned DirectionalShadowMaxDistance to cover the entire scene, you can set DirectionalShadowFadeStart to 1.0 to prevent the shadow from fading in the distance (it will suddenly cut off instead).

public float DirectionalShadowFadeStart { get; set; }

Property Value

float

DirectionalShadowMaxDistance

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).

public float DirectionalShadowMaxDistance { get; set; }

Property Value

float

DirectionalShadowMode

The light's shadow rendering algorithm. See DirectionalLight3D.ShadowMode.

public DirectionalLight3D.ShadowMode DirectionalShadowMode { get; set; }

Property Value

DirectionalLight3D.ShadowMode

DirectionalShadowPancakeSize

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.

public float DirectionalShadowPancakeSize { get; set; }

Property Value

float

DirectionalShadowSplit1

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

public float DirectionalShadowSplit1 { get; set; }

Property Value

float

DirectionalShadowSplit2

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

public float DirectionalShadowSplit2 { get; set; }

Property Value

float

DirectionalShadowSplit3

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

public float DirectionalShadowSplit3 { get; set; }

Property Value

float

SkyMode

Set whether this DirectionalLight3D is visible in the sky, in the scene, or both in the sky and in the scene. See DirectionalLight3D.SkyModeEnum for options.

public DirectionalLight3D.SkyModeEnum SkyMode { get; set; }

Property Value

DirectionalLight3D.SkyModeEnum

Methods

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool