Light3D

    Provides a base class for different kinds of light nodes.

    Light3D.swift:11
    class Light3D

    Light3D is the abstract base class for light nodes. As it can’t be instantiated, it shouldn’t be used directly. Other types of light nodes inherit from it. Light3D contains the common variables and parameters used for lighting.

    Superclasses

    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 example GString, 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 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 active Camera3D starting at distanceFadeBegin. This acts as a form of level of detail (LOD). The light will fade out over distanceFadeBegin + 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. If true, the light will never be baked in LightmapGI regardless of its lightBakeMode.

    • 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 DirectionalLight3Ds. For reference, the Sun from the Earth is approximately 0.5. Increasing this value above 0.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 and SpotLight3D, 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 (see sdfgiEnabled).

    • var lightIntensityLumens: Double

      Used by positional lights (OmniLight3D and SpotLight3D) when ProjectSettings/rendering/lightsAndShadows/usePhysicalLightUnits is true. 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 DirectionalLight3Ds when ProjectSettings/rendering/lightsAndShadows/usePhysicalLightUnits is true. 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 OmniLight3Ds and SpotLight3Ds. 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 above 0.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 the Environment’s volumetric fog (if enabled). If set to 0.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 using distanceFadeEnabled to hide the light when far away from the Camera3D.

    • 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 with shadowBias 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 with doubleSided.

    • var shadowTransmittanceBias: Double
    • func getCorrelatedColor() -> Color

      Returns the Color of an idealized blackbody at the given lightTemperature. This value is calculated internally based on the lightTemperature. This Color is multiplied by lightColor before being sent to the RenderingServer.

    Subclasses