Documentation
¶
Overview ¶
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.
Index ¶
- type Advanced
- type Any
- type BakeMode
- type Extension
- type ID
- type Instance
- func (self Instance) AsLight3D() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
- func (self Instance) DistanceFadeBegin() Float.X
- func (self Instance) DistanceFadeEnabled() bool
- func (self Instance) DistanceFadeLength() Float.X
- func (self Instance) DistanceFadeShadow() Float.X
- func (self Instance) EditorOnly() bool
- func (self Instance) GetCorrelatedColor() Color.RGBA
- func (self Instance) ID() ID
- func (self Instance) LightAngularDistance() Float.X
- func (self Instance) LightBakeMode() BakeMode
- func (self Instance) LightColor() Color.RGBA
- func (self Instance) LightCullMask() int
- func (self Instance) LightEnergy() Float.X
- func (self Instance) LightIndirectEnergy() Float.X
- func (self Instance) LightIntensityLumens() Float.X
- func (self Instance) LightIntensityLux() Float.X
- func (self Instance) LightNegative() bool
- func (self Instance) LightProjector() Texture2D.Instance
- func (self Instance) LightSize() Float.X
- func (self Instance) LightSpecular() Float.X
- func (self Instance) LightTemperature() Float.X
- func (self Instance) LightVolumetricFogEnergy() Float.X
- func (self Instance) SetDistanceFadeBegin(value Float.X)
- func (self Instance) SetDistanceFadeEnabled(value bool)
- func (self Instance) SetDistanceFadeLength(value Float.X)
- func (self Instance) SetDistanceFadeShadow(value Float.X)
- func (self Instance) SetEditorOnly(value bool)
- func (self Instance) SetLightAngularDistance(value Float.X)
- func (self Instance) SetLightBakeMode(value BakeMode)
- func (self Instance) SetLightColor(value Color.RGBA)
- func (self Instance) SetLightCullMask(value int)
- func (self Instance) SetLightEnergy(value Float.X)
- func (self Instance) SetLightIndirectEnergy(value Float.X)
- func (self Instance) SetLightIntensityLumens(value Float.X)
- func (self Instance) SetLightIntensityLux(value Float.X)
- func (self Instance) SetLightNegative(value bool)
- func (self Instance) SetLightProjector(value Texture2D.Instance)
- func (self Instance) SetLightSize(value Float.X)
- func (self Instance) SetLightSpecular(value Float.X)
- func (self Instance) SetLightTemperature(value Float.X)
- func (self Instance) SetLightVolumetricFogEnergy(value Float.X)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetShadowBias(value Float.X)
- func (self Instance) SetShadowBlur(value Float.X)
- func (self Instance) SetShadowCasterMask(value int)
- func (self Instance) SetShadowEnabled(value bool)
- func (self Instance) SetShadowNormalBias(value Float.X)
- func (self Instance) SetShadowOpacity(value Float.X)
- func (self Instance) SetShadowReverseCullFace(value bool)
- func (self Instance) SetShadowTransmittanceBias(value Float.X)
- func (self Instance) ShadowBias() Float.X
- func (self Instance) ShadowBlur() Float.X
- func (self Instance) ShadowCasterMask() int
- func (self Instance) ShadowEnabled() bool
- func (self Instance) ShadowNormalBias() Float.X
- func (self Instance) ShadowOpacity() Float.X
- func (self Instance) ShadowReverseCullFace() bool
- func (self Instance) ShadowTransmittanceBias() Float.X
- func (self Instance) Virtual(name string) reflect.Value
- type Param
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type BakeMode ¶
type BakeMode int //gd:Light3D.BakeMode
const ( // Light is ignored when baking. This is the fastest mode, but the light will not 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. // // Note: Hiding a light does not affect baking [LightmapGI]. Hiding a light will still affect baking [VoxelGI] and SDFGI (see [Environment.SdfgiEnabled]). // // [Environment.SdfgiEnabled]: https://pkg.go.dev/graphics.gd/classdb/Environment#Instance.SdfgiEnabled // [LightmapGI]: https://pkg.go.dev/graphics.gd/classdb/LightmapGI // [VoxelGI]: https://pkg.go.dev/graphics.gd/classdb/VoxelGI BakeDisabled BakeMode = 0 // Light is taken into account in static baking ([VoxelGI], [LightmapGI], SDFGI ([Environment.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. // // Note: The light is not baked in [LightmapGI] if [EditorOnly] is true. // // [EditorOnly]: https://pkg.go.dev/graphics.gd/classdb/#Instance.EditorOnly // [Environment.SdfgiEnabled]: https://pkg.go.dev/graphics.gd/classdb/Environment#Instance.SdfgiEnabled // [LightmapGI]: https://pkg.go.dev/graphics.gd/classdb/LightmapGI // [VoxelGI]: https://pkg.go.dev/graphics.gd/classdb/VoxelGI BakeStatic BakeMode = 1 // Light is taken into account in dynamic baking ([VoxelGI] and SDFGI ([Environment.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 by [ProjectSettings] "rendering/global_illumination/sdfgi/frames_to_update_lights". // // [Environment.SdfgiEnabled]: https://pkg.go.dev/graphics.gd/classdb/Environment#Instance.SdfgiEnabled // [ProjectSettings]: https://pkg.go.dev/graphics.gd/classdb/ProjectSettings // [VoxelGI]: https://pkg.go.dev/graphics.gd/classdb/VoxelGI BakeDynamic BakeMode = 2 )
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsVisualInstance3D ¶
func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsVisualInstance3D ¶
func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
func (Instance) DistanceFadeBegin ¶
The distance from the camera at which the light begins to fade away (in 3D units).
Note: Only effective for OmniLight3D and SpotLight3D.
func (Instance) DistanceFadeEnabled ¶
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.
Note: Only effective for OmniLight3D and SpotLight3D.
func (Instance) DistanceFadeLength ¶
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.
Note: Only effective for OmniLight3D and SpotLight3D.
func (Instance) DistanceFadeShadow ¶
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.
Note: Only effective for OmniLight3D and SpotLight3D, and only when ShadowEnabled is true.
func (Instance) EditorOnly ¶
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.
func (Instance) GetCorrelatedColor ¶
Returns the Color.RGBA of an idealized blackbody at the given LightTemperature. This value is calculated internally based on the LightTemperature. This Color.RGBA is multiplied by LightColor before being sent to the RenderingServer.
func (Instance) LightAngularDistance ¶
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.
Note: LightAngularDistance is not affected by Node3D.Scale (the light's scale or its parent's scale).
Note: PCSS for directional lights is only supported in the Forward+ rendering method, not Mobile or Compatibility.
func (Instance) LightBakeMode ¶
The light's bake mode. This will affect the global illumination techniques that have an effect on the light's rendering.
Note: Meshes' global illumination mode will also affect the global illumination rendering. See GeometryInstance3D.GiMode.
func (Instance) LightColor ¶
The light's color in the nonlinear sRGB color space. An overbright color can be used to achieve a result equivalent to increasing the light's LightEnergy.
func (Instance) LightCullMask ¶
The light will affect objects in the selected layers.
func (Instance) LightEnergy ¶
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.
func (Instance) LightIndirectEnergy ¶
Secondary multiplier used with indirect light (light bounces). Used with VoxelGI and SDFGI (see Environment.SdfgiEnabled).
Note: This property is ignored if LightEnergy is equal to 0.0, as the light won't be present at all in the GI shader.
func (Instance) LightIntensityLumens ¶
Used by positional lights (OmniLight3D and SpotLight3D) when ProjectSettings "rendering/lights_and_shadows/use_physical_light_units" 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.
For SpotLight3Ds, we assume that the area outside the visible cone is surrounded by a perfect light absorbing material. Accordingly, the apparent brightness of the cone area does not change as the cone increases and decreases in size.
A typical household lightbulb can range from around 600 lumens to 1,200 lumens, a candle is about 13 lumens, while a streetlight can be approximately 60,000 lumens.
func (Instance) LightIntensityLux ¶
Used by DirectionalLight3Ds when ProjectSettings "rendering/lights_and_shadows/use_physical_light_units" 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.
On a clear sunny day a surface in direct sunlight may be approximately 100,000 lux, a typical room in a home may be approximately 50 lux, while the moonlit ground may be approximately 0.1 lux.
func (Instance) LightNegative ¶
If true, the light's effect is reversed, darkening areas and casting bright shadows.
func (Instance) LightProjector ¶
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.
Note: Unlike BaseMaterial3D whose filter mode can be adjusted on a per-material basis, the filter mode for light projector textures is set globally with ProjectSettings "rendering/textures/light_projectors/filter".
Note: Light projector textures are only supported in the Forward+ and Mobile rendering methods, not Compatibility.
func (Instance) LightSize ¶
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.
Note: LightSize is not affected by Node3D.Scale (the light's scale or its parent's scale).
Note: PCSS for positional lights is only supported in the Forward+ and Mobile rendering methods, not Compatibility.
func (Instance) LightSpecular ¶
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.
func (Instance) LightTemperature ¶
Sets the color temperature of the light source, measured in Kelvin. This is used to calculate a correlated color temperature which tints the LightColor.
The sun on a cloudy day is approximately 6500 Kelvin, on a clear day it is between 5500 to 6000 Kelvin, and on a clear day at sunrise or sunset it ranges to around 1850 Kelvin.
func (Instance) LightVolumetricFogEnergy ¶
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.
Note: To prevent short-lived dynamic light effects from poorly interacting with volumetric fog, lights used in those effects should have LightVolumetricFogEnergy set to 0.0 unless Environment.VolumetricFogTemporalReprojectionEnabled is disabled (or unless the reprojection amount is significantly lowered).
func (Instance) SetDistanceFadeBegin ¶
SetDistanceFadeBegin sets the property returned by [GetDistanceFadeBegin].
func (Instance) SetDistanceFadeEnabled ¶
SetDistanceFadeEnabled sets the property returned by [IsDistanceFadeEnabled].
func (Instance) SetDistanceFadeLength ¶
SetDistanceFadeLength sets the property returned by [GetDistanceFadeLength].
func (Instance) SetDistanceFadeShadow ¶
SetDistanceFadeShadow sets the property returned by [GetDistanceFadeShadow].
func (Instance) SetEditorOnly ¶
SetEditorOnly sets the property returned by [IsEditorOnly].
func (Instance) SetLightAngularDistance ¶
SetLightAngularDistance sets the property returned by [GetParam].
func (Instance) SetLightBakeMode ¶
SetLightBakeMode sets the property returned by [GetBakeMode].
func (Instance) SetLightColor ¶
SetLightColor sets the property returned by [GetColor].
func (Instance) SetLightCullMask ¶
SetLightCullMask sets the property returned by [GetCullMask].
func (Instance) SetLightEnergy ¶
SetLightEnergy sets the property returned by [GetParam].
func (Instance) SetLightIndirectEnergy ¶
SetLightIndirectEnergy sets the property returned by [GetParam].
func (Instance) SetLightIntensityLumens ¶
SetLightIntensityLumens sets the property returned by [GetParam].
func (Instance) SetLightIntensityLux ¶
SetLightIntensityLux sets the property returned by [GetParam].
func (Instance) SetLightNegative ¶
SetLightNegative sets the property returned by [IsNegative].
func (Instance) SetLightProjector ¶
SetLightProjector sets the property returned by [GetProjector].
func (Instance) SetLightSize ¶
SetLightSize sets the property returned by [GetParam].
func (Instance) SetLightSpecular ¶
SetLightSpecular sets the property returned by [GetParam].
func (Instance) SetLightTemperature ¶
SetLightTemperature sets the property returned by [GetTemperature].
func (Instance) SetLightVolumetricFogEnergy ¶
SetLightVolumetricFogEnergy sets the property returned by [GetParam].
func (Instance) SetShadowBias ¶
SetShadowBias sets the property returned by [GetParam].
func (Instance) SetShadowBlur ¶
SetShadowBlur sets the property returned by [GetParam].
func (Instance) SetShadowCasterMask ¶
SetShadowCasterMask sets the property returned by [GetShadowCasterMask].
func (Instance) SetShadowEnabled ¶
SetShadowEnabled sets the property returned by [HasShadow].
func (Instance) SetShadowNormalBias ¶
SetShadowNormalBias sets the property returned by [GetParam].
func (Instance) SetShadowOpacity ¶
SetShadowOpacity sets the property returned by [GetParam].
func (Instance) SetShadowReverseCullFace ¶
SetShadowReverseCullFace sets the property returned by [GetShadowReverseCullFace].
func (Instance) SetShadowTransmittanceBias ¶
SetShadowTransmittanceBias sets the property returned by [GetParam].
func (Instance) ShadowBias ¶
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.
func (Instance) ShadowBlur ¶
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.
func (Instance) ShadowCasterMask ¶
The light will only cast shadows using objects in the selected layers.
func (Instance) ShadowEnabled ¶
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.
func (Instance) ShadowNormalBias ¶
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.
func (Instance) ShadowOpacity ¶
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.
func (Instance) ShadowReverseCullFace ¶
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 [Geometryinstance3d.ShadowCastingSettingDoubleSided].
func (Instance) ShadowTransmittanceBias ¶
type Param ¶
type Param int //gd:Light3D.Param
const ( // Constant for accessing [LightEnergy]. // // [LightEnergy]: https://pkg.go.dev/graphics.gd/classdb/#Instance.LightEnergy ParamEnergy Param = 0 // Constant for accessing [LightIndirectEnergy]. // // [LightIndirectEnergy]: https://pkg.go.dev/graphics.gd/classdb/#Instance.LightIndirectEnergy ParamIndirectEnergy Param = 1 // Constant for accessing [LightVolumetricFogEnergy]. // // [LightVolumetricFogEnergy]: https://pkg.go.dev/graphics.gd/classdb/#Instance.LightVolumetricFogEnergy ParamVolumetricFogEnergy Param = 2 // Constant for accessing [LightSpecular]. // // [LightSpecular]: https://pkg.go.dev/graphics.gd/classdb/#Instance.LightSpecular ParamSpecular Param = 3 // Constant for accessing [OmniLight3D.OmniRange] or [SpotLight3D.SpotRange]. // // [OmniLight3D.OmniRange]: https://pkg.go.dev/graphics.gd/classdb/OmniLight3D#Instance.OmniRange // [SpotLight3D.SpotRange]: https://pkg.go.dev/graphics.gd/classdb/SpotLight3D#Instance.SpotRange ParamRange Param = 4 // Constant for accessing [LightSize]. // // [LightSize]: https://pkg.go.dev/graphics.gd/classdb/#Instance.LightSize ParamSize Param = 5 // Constant for accessing [OmniLight3D.OmniAttenuation] or [SpotLight3D.SpotAttenuation]. // // [OmniLight3D.OmniAttenuation]: https://pkg.go.dev/graphics.gd/classdb/OmniLight3D#Instance.OmniAttenuation // [SpotLight3D.SpotAttenuation]: https://pkg.go.dev/graphics.gd/classdb/SpotLight3D#Instance.SpotAttenuation ParamAttenuation Param = 6 // Constant for accessing [SpotLight3D.SpotAngle]. // // [SpotLight3D.SpotAngle]: https://pkg.go.dev/graphics.gd/classdb/SpotLight3D#Instance.SpotAngle ParamSpotAngle Param = 7 // Constant for accessing [SpotLight3D.SpotAngleAttenuation]. // // [SpotLight3D.SpotAngleAttenuation]: https://pkg.go.dev/graphics.gd/classdb/SpotLight3D#Instance.SpotAngleAttenuation ParamSpotAttenuation Param = 8 // Constant for accessing [DirectionalLight3D.DirectionalShadowMaxDistance]. // // [DirectionalLight3D.DirectionalShadowMaxDistance]: https://pkg.go.dev/graphics.gd/classdb/DirectionalLight3D#Instance.DirectionalShadowMaxDistance ParamShadowMaxDistance Param = 9 // Constant for accessing [DirectionalLight3D.DirectionalShadowSplit1]. // // [DirectionalLight3D.DirectionalShadowSplit1]: https://pkg.go.dev/graphics.gd/classdb/DirectionalLight3D#Instance.DirectionalShadowSplit1 ParamShadowSplit1Offset Param = 10 // Constant for accessing [DirectionalLight3D.DirectionalShadowSplit2]. // // [DirectionalLight3D.DirectionalShadowSplit2]: https://pkg.go.dev/graphics.gd/classdb/DirectionalLight3D#Instance.DirectionalShadowSplit2 ParamShadowSplit2Offset Param = 11 // Constant for accessing [DirectionalLight3D.DirectionalShadowSplit3]. // // [DirectionalLight3D.DirectionalShadowSplit3]: https://pkg.go.dev/graphics.gd/classdb/DirectionalLight3D#Instance.DirectionalShadowSplit3 ParamShadowSplit3Offset Param = 12 // Constant for accessing [DirectionalLight3D.DirectionalShadowFadeStart]. // // [DirectionalLight3D.DirectionalShadowFadeStart]: https://pkg.go.dev/graphics.gd/classdb/DirectionalLight3D#Instance.DirectionalShadowFadeStart ParamShadowFadeStart Param = 13 // Constant for accessing [ShadowNormalBias]. // // [ShadowNormalBias]: https://pkg.go.dev/graphics.gd/classdb/#Instance.ShadowNormalBias ParamShadowNormalBias Param = 14 // Constant for accessing [ShadowBias]. // // [ShadowBias]: https://pkg.go.dev/graphics.gd/classdb/#Instance.ShadowBias ParamShadowBias Param = 15 // Constant for accessing [DirectionalLight3D.DirectionalShadowPancakeSize]. // // [DirectionalLight3D.DirectionalShadowPancakeSize]: https://pkg.go.dev/graphics.gd/classdb/DirectionalLight3D#Instance.DirectionalShadowPancakeSize ParamShadowPancakeSize Param = 16 // Constant for accessing [ShadowOpacity]. // // [ShadowOpacity]: https://pkg.go.dev/graphics.gd/classdb/#Instance.ShadowOpacity ParamShadowOpacity Param = 17 // Constant for accessing [ShadowBlur]. // // [ShadowBlur]: https://pkg.go.dev/graphics.gd/classdb/#Instance.ShadowBlur ParamShadowBlur Param = 18 // Constant for accessing [ShadowTransmittanceBias]. // // [ShadowTransmittanceBias]: https://pkg.go.dev/graphics.gd/classdb/#Instance.ShadowTransmittanceBias ParamTransmittanceBias Param = 19 // Constant for accessing [LightIntensityLumens] and [LightIntensityLux]. Only used when [ProjectSettings] "rendering/lights_and_shadows/use_physical_light_units" is true. // // [LightIntensityLumens]: https://pkg.go.dev/graphics.gd/classdb/#Instance.LightIntensityLumens // [LightIntensityLux]: https://pkg.go.dev/graphics.gd/classdb/#Instance.LightIntensityLux // [ProjectSettings]: https://pkg.go.dev/graphics.gd/classdb/ProjectSettings ParamIntensity Param = 20 // Represents the size of the [Param] enum. ParamMax Param = 21 )