DirectionalLight3D
Directional light from a distance, as from the Sun.
DirectionalLight3D.swift:17class DirectionalLight3D
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.
Superclasses
class Light3D
Provides a base class for different kinds of light nodes.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
Type members
Instance members
var directionalShadowBlendSplits: Bool
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 whendirectionalShadowMode
is .shadowOrthogonal.var directionalShadowFadeStart: Double
Proportion of
directionalShadowMaxDistance
at which point the shadow starts to fade. AtdirectionalShadowMaxDistance
, the shadow will disappear. The default value is a balance between smooth fading and distant shadow visibility. If the camera moves fast and thedirectionalShadowMaxDistance
is low, consider loweringdirectionalShadowFadeStart
below0.8
to make shadow transitions less noticeable. On the other hand, if you tuneddirectionalShadowMaxDistance
to cover the entire scene, you can setdirectionalShadowFadeStart
to1.0
to prevent the shadow from fading in the distance (it will suddenly cut off instead).var directionalShadowMaxDistance: Double
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).
var directionalShadowMode: DirectionalLight3D.ShadowMode
The light’s shadow rendering algorithm. See
ShadowMode
.var directionalShadowPancakeSize: Double
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.var directionalShadowSplit1: Double
The distance from camera to shadow split 1. Relative to
directionalShadowMaxDistance
. Only used whendirectionalShadowMode
is .shadowParallel2Splits or .shadowParallel4Splits.var directionalShadowSplit2: Double
The distance from shadow split 1 to split 2. Relative to
directionalShadowMaxDistance
. Only used whendirectionalShadowMode
is .shadowParallel4Splits.var directionalShadowSplit3: Double
The distance from shadow split 2 to split 3. Relative to
directionalShadowMaxDistance
. Only used whendirectionalShadowMode
is .shadowParallel4Splits.var skyMode: DirectionalLight3D.SkyMode
Set whether this
DirectionalLight3D
is visible in the sky, in the scene, or both in the sky and in the scene. SeeSkyMode
for options.