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
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
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
DirectionalShadowMode
The light's shadow rendering algorithm. See DirectionalLight3D.ShadowMode.
public DirectionalLight3D.ShadowMode DirectionalShadowMode { get; set; }
Property Value
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
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
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
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
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
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_nameName of the method to check for.
Returns
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_nameName of the signal to check for.
Returns
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_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.