Enumerationmigueldeicaza.swiftgodot 0.45.0SwiftGodot
BakeMode
Light3D.swift:89enum BakeMode
Cases
case disabled
Light is ignored when baking. This is the fastest mode, but the light will be taken into account when baking global illumination. This mode should generally be used for dynamic lights that change quickly, as the effect of global illumination is less noticeable on those lights.
case `static`
Light is taken into account in static baking (
VoxelGI
,LightmapGI
, SDFGI (sdfgiEnabled
)). The light can be moved around or modified, but its global illumination will not update in real-time. This is suitable for subtle changes (such as flickering torches), but generally not large changes such as toggling a light on and off.case dynamic
Light is taken into account in dynamic baking (
VoxelGI
and SDFGI (sdfgiEnabled
) only). The light can be moved around or modified with global illumination updating in real-time. The light’s global illumination appearance will be slightly different compared to .bakeStatic. This has a greater performance cost compared to .bakeStatic. When using SDFGI, the update speed of dynamic lights is affected byProjectSettings/rendering/globalIllumination/sdfgi/framesToUpdateLights
.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (29) members.
Types
Type members
Instance members
var distanceFadeBegin: Double
The distance from the camera at which the light begins to fade away (in 3D units).
var distanceFadeEnabled: Bool
If
true
, the light will smoothly fade away when far from the activeCamera3D
starting atdistanceFadeBegin
. This acts as a form of level of detail (LOD). The light will fade out overdistanceFadeBegin
+distanceFadeLength
, after which it will be culled and not sent to the shader at all. Use this to reduce the number of active lights in a scene and thus improve performance.var distanceFadeLength: Double
Distance over which the light and its shadow fades. The light’s energy and shadow’s opacity is progressively reduced over this distance and is completely invisible at the end.
var distanceFadeShadow: Double
The distance from the camera at which the light’s shadow cuts off (in 3D units). Set this to a value lower than
distanceFadeBegin
+distanceFadeLength
to further improve performance, as shadow rendering is often more expensive than light rendering itself.var editorOnly: Bool
If
true
, the light only appears in the editor and will not be visible at runtime. Iftrue
, the light will never be baked inLightmapGI
regardless of itslightBakeMode
.var lightAngularDistance: Double
The light’s angular size in degrees. Increasing this will make shadows softer at greater distances (also called percentage-closer soft shadows, or PCSS). Only available for
DirectionalLight3D
s. For reference, the Sun from the Earth is approximately0.5
. Increasing this value above0.0
for lights with shadows enabled will have a noticeable performance cost due to PCSS.var lightBakeMode: Light3D.BakeMode
The light’s bake mode. This will affect the global illumination techniques that have an effect on the light’s rendering. See
BakeMode
.var lightColor: Color
The light’s color. An overbright color can be used to achieve a result equivalent to increasing the light’s
lightEnergy
.var lightCullMask: UInt32
The light will affect objects in the selected layers.
var lightEnergy: Double
The light’s strength multiplier (this is not a physical unit). For
OmniLight3D
andSpotLight3D
, changing this value will only change the light color’s intensity, not the light’s radius.var lightIndirectEnergy: Double
Secondary multiplier used with indirect light (light bounces). Used with
VoxelGI
and SDFGI (seesdfgiEnabled
).var lightIntensityLumens: Double
Used by positional lights (
OmniLight3D
andSpotLight3D
) whenProjectSettings/rendering/lightsAndShadows/usePhysicalLightUnits
istrue
. Sets the intensity of the light source measured in Lumens. Lumens are a measure of luminous flux, which is the total amount of visible light emitted by a light source per unit of time.var lightIntensityLux: Double
Used by
DirectionalLight3D
s whenProjectSettings/rendering/lightsAndShadows/usePhysicalLightUnits
istrue
. Sets the intensity of the light source measured in Lux. Lux is a measure of luminous flux per unit area, it is equal to one lumen per square meter. Lux is the measure of how much light hits a surface at a given time.var lightNegative: Bool
If
true
, the light’s effect is reversed, darkening areas and casting bright shadows.var lightProjector: Texture2D?
Texture2D
projected by light.shadowEnabled
must be on for the projector to work. Light projectors make the light appear as if it is shining through a colored but transparent object, almost like light shining through stained-glass.var lightSize: Double
The size of the light in Godot units. Only available for
OmniLight3D
s andSpotLight3D
s. Increasing this value will make the light fade out slower and shadows appear blurrier (also called percentage-closer soft shadows, or PCSS). This can be used to simulate area lights to an extent. Increasing this value above0.0
for lights with shadows enabled will have a noticeable performance cost due to PCSS.var lightSpecular: Double
The intensity of the specular blob in objects affected by the light. At
0
, the light becomes a pure diffuse light. When not baking emission, this can be used to avoid unrealistic reflections when placing lights above an emissive surface.var lightTemperature: Double
Sets the color temperature of the light source, measured in Kelvin. This is used to calculate a correlated color temperature which tints the
lightColor
.var lightVolumetricFogEnergy: Double
Secondary multiplier multiplied with
lightEnergy
then used with theEnvironment
’s volumetric fog (if enabled). If set to0.0
, computing volumetric fog will be skipped for this light, which can improve performance for large amounts of lights when volumetric fog is enabled.var shadowBias: Double
Used to adjust shadow appearance. Too small a value results in self-shadowing (“shadow acne”), while too large a value causes shadows to separate from casters (“peter-panning”). Adjust as needed.
var shadowBlur: Double
Blurs the edges of the shadow. Can be used to hide pixel artifacts in low-resolution shadow maps. A high value can impact performance, make shadows appear grainy and can cause other unwanted artifacts. Try to keep as near default as possible.
var shadowEnabled: Bool
If
true
, the light will cast real-time shadows. This has a significant performance cost. Only enable shadow rendering when it makes a noticeable difference in the scene’s appearance, and consider usingdistanceFadeEnabled
to hide the light when far away from theCamera3D
.var shadowNormalBias: Double
Offsets the lookup into the shadow map by the object’s normal. This can be used to reduce self-shadowing artifacts without using
shadowBias
. In practice, this value should be tweaked along withshadowBias
to reduce artifacts as much as possible.var shadowOpacity: Double
The opacity to use when rendering the light’s shadow map. Values lower than
1.0
make the light appear through shadows. This can be used to fake global illumination at a low performance cost.var shadowReverseCullFace: Bool
If
true
, reverses the backface culling of the mesh. This can be useful when you have a flat mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the mesh to use double-sided shadows withdoubleSided
.var shadowTransmittanceBias: Double
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
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 RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.