Light3D
Provides a base class for different kinds of light nodes.
Provides a base class for different kinds of light nodes.
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.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Properties30
DistanceFadeBeginProperty
public float DistanceFadeBegin { get; set; }The distance from the camera at which the light begins to fade away (in 3D units).
Note: Only effective for OmniLight3D and SpotLight3D.
DistanceFadeEnabledProperty
public bool DistanceFadeEnabled { get; set; }If true, the light will smoothly fade away when far from the active Camera3D starting at Light3D.DistanceFadeBegin. This acts as a form of level of detail (LOD). The light will fade out over Light3D.DistanceFadeBegin + Light3D.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.
DistanceFadeLengthProperty
public float DistanceFadeLength { get; set; }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.
DistanceFadeShadowProperty
public float DistanceFadeShadow { get; set; }The distance from the camera at which the light's shadow cuts off (in 3D units). Set this to a value lower than Light3D.DistanceFadeBegin + Light3D.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 Light3D.ShadowEnabled is true.
EditorOnlyProperty
public bool EditorOnly { get; set; }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 Light3D.LightBakeMode.
LightAngularDistanceProperty
public float LightAngularDistance { get; set; }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: Light3D.LightAngularDistance is not affected by Entity3D.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.
LightBakeModeProperty
public Light3D.BakeMode LightBakeMode { get; set; }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.
LightColorProperty
public Color LightColor { get; set; }The light's color in nonlinear sRGB encoding. An overbright color can be used to achieve a result equivalent to increasing the light's Light3D.LightEnergy.
LightCullMaskProperty
public uint LightCullMask { get; set; }Mask of GeometryInstance3D visual layers affected by the light, not a physics CollisionMask. Switching 1 to 2 excluded geometry left on visual layer 1 in the native check.
LightEnergyProperty
public float LightEnergy { get; set; }Light energy multiplier. Output also depends on material, distance/attenuation, environment, exposure and physical-unit settings. One value is not a universal brightness level across projects.
LightIndirectEnergyProperty
public float LightIndirectEnergy { get; set; }Secondary multiplier used with indirect light (light bounces). Used with VoxelGI and SDFGI (see Environment.SdfgiEnabled).
Note: This property is ignored if Light3D.LightEnergy is equal to 0.0, as the light won't be present at all in the GI shader.
LightIntensityLumensProperty
public float LightIntensityLumens { get; set; }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.
LightIntensityLuxProperty
public float LightIntensityLux { get; set; }Directional-source illuminance in lux. Use for DirectionalLight3D with physical units enabled; LightEnergy is an additional multiplier. Not a lamp luminous-flux rating in lumens. Does not affect light rendering when physical mode is disabled.
LightNegativeProperty
public bool LightNegative { get; set; }If true, the light's effect is reversed, darkening areas and casting bright shadows.
LightProjectorProperty
public Texture2D LightProjector { get; set; }Texture2D projected by light. Light3D.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.
LightSizeProperty
public float LightSize { get; set; }The simulated size of the light in Reckfell units, affecting shading and shadows. For OmniLight3Ds and SpotLight3Ds, increasing this value simulates a spherical area light, expanding the size of specular highlights. If shadows are enabled, a penumbra is rendered, making shadows appear blurrier. For AreaLight3Ds, only the shadows are affected. Penumbras are simulated with percentage-closer soft shadows, or PCSS, which has a noticeable performance cost for values above 0.0.
Note: Light3D.LightSize is not affected by Entity3D.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.
LightSpecularProperty
public float LightSpecular { get; set; }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.
LightTemperatureProperty
public float LightTemperature { get; set; }Color temperature in Kelvin, active with physical light units enabled. Around 6500 K is approximately neutral; lower values are warmer. Temperature color combines with LightColor in linear space; it does not replace a tinted LightColor with neutral white.
LightVolumetricFogEnergyProperty
public float LightVolumetricFogEnergy { get; set; }Secondary multiplier multiplied with Light3D.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 Light3D.LightVolumetricFogEnergy set to 0.0 unless Environment.VolumetricFogTemporalReprojectionEnabled is disabled (or unless the reprojection amount is significantly lowered).
ShadowBiasProperty
public float ShadowBias { get; set; }Shadow depth-comparison offset to reduce self-shadowing. Excess can detach shadows from objects. Does not replace appropriate shadow coverage or map resolution; tune with ShadowNormalBias.
ShadowBlurProperty
public float ShadowBlur { get; set; }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.
ShadowCasterMaskProperty
public uint ShadowCasterMask { get; set; }The light will only cast shadows using objects in the selected layers.
ShadowContactShadowsAllowProperty
public bool ShadowContactShadowsAllow { get; set; }Enables screen-space contact shadows for this light. Only used when ProjectSettings.rendering/lights_and_shadows/contact_shadow/enabled is enabled.
ShadowContactShadowsBlurProperty
public float ShadowContactShadowsBlur { get; set; }Blurs the edges of the contact shadow. 0.0 produces sharp shadows; higher values increase the noise magnitude. Only used when Light3D.ShadowContactShadowsAllow is enabled.
ShadowContactShadowsOpacityProperty
public float ShadowContactShadowsOpacity { get; set; }Changes the opacity of this light's screen-space contact shadows. A value of 1.0 uses the same opacity as Light3D.ShadowOpacity, a value of 0.5 would be 50% of the opacity of Light3D.ShadowOpacity. Only used when Light3D.ShadowContactShadowsAllow is enabled.
ShadowEnabledProperty
public bool ShadowEnabled { get; set; }Enables this light’s shadows when supported for its type and renderer. Casters need appropriate CastShadow settings and coverage. DirectionalLight3D shadows are verified in Compatibility; source configuration does not support AreaLight3D shadows there.
ShadowNormalBiasProperty
public float ShadowNormalBias { get; set; }Shadow-building offset along surface normals. Helps with artifacts, but excessive values distort contact and thin details. Does not modify mesh or physics geometry.
ShadowOpacityProperty
public float ShadowOpacity { get; set; }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.
ShadowReverseCullFaceProperty
public bool ShadowReverseCullFace { get; set; }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.ShadowCastingSetting.DoubleSided.
ShadowTransmittanceBiasProperty
public float ShadowTransmittanceBias { get; set; }Methods33
GetAllowContactShadowsbool
public bool GetAllowContactShadows();boolGetBakeModeLight3D.BakeMode
public Light3D.BakeMode GetBakeMode();Light3D.BakeModeGetColorColor
public Color GetColor();ColorGetCorrelatedColorColor
public Color GetCorrelatedColor();Returns the Color of an idealized blackbody at the given Light3D.LightTemperature. This value is calculated internally based on the Light3D.LightTemperature. This Color is multiplied by Light3D.LightColor before being sent to the RenderingServer.
ColorGetCullMaskuint
public uint GetCullMask();uintGetDistanceFadeBeginfloat
public float GetDistanceFadeBegin();floatGetDistanceFadeLengthfloat
public float GetDistanceFadeLength();floatGetDistanceFadeShadowfloat
public float GetDistanceFadeShadow();floatGetParamfloat
public float GetParam(Light3D.Param param);Returns the value of the specified Light3D.Param parameter.
| Name | Type | Default |
|---|---|---|
param | Light3D.Param | — |
floatGetProjectorTexture2D
public Texture2D GetProjector();Texture2DGetShadowCasterMaskuint
public uint GetShadowCasterMask();uintGetShadowReverseCullFacebool
public bool GetShadowReverseCullFace();boolGetTemperaturefloat
public float GetTemperature();Returns the current LightTemperature value. Color temperature in Kelvin, active with physical light units enabled. Around 6500 K is approximately neutral; lower values are warmer. Temperature color combines with LightColor in linear space; it does not replace a tinted LightColor with neutral white.
floatCurrent LightTemperature value in the units described for that property.
HasShadowbool
public bool HasShadow();boolIsDistanceFadeEnabledbool
public bool IsDistanceFadeEnabled();boolIsEditorOnlybool
public bool IsEditorOnly();boolIsNegativebool
public bool IsNegative();boolSetAllowContactShadowsvoid
public void SetAllowContactShadows(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetBakeModevoid
public void SetBakeMode(Light3D.BakeMode bakeMode);| Name | Type | Default |
|---|---|---|
bakeMode | Light3D.BakeMode | — |
SetColorvoid
public void SetColor(Color color);| Name | Type | Default |
|---|---|---|
color | Color | — |
SetCullMaskvoid
public void SetCullMask(uint cullMask);| Name | Type | Default |
|---|---|---|
cullMask | uint | — |
SetDistanceFadeBeginvoid
public void SetDistanceFadeBegin(float distance);| Name | Type | Default |
|---|---|---|
distance | float | — |
SetDistanceFadeLengthvoid
public void SetDistanceFadeLength(float distance);| Name | Type | Default |
|---|---|---|
distance | float | — |
SetDistanceFadeShadowvoid
public void SetDistanceFadeShadow(float distance);| Name | Type | Default |
|---|---|---|
distance | float | — |
SetEditorOnlyvoid
public void SetEditorOnly(bool editorOnly);| Name | Type | Default |
|---|---|---|
editorOnly | bool | — |
SetEnableDistanceFadevoid
public void SetEnableDistanceFade(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetNegativevoid
public void SetNegative(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetParamvoid
public void SetParam(Light3D.Param param, float value);Sets the value of the specified Light3D.Param parameter.
| Name | Type | Default |
|---|---|---|
param | Light3D.Param | — |
value | float | — |
SetProjectorvoid
public void SetProjector(Texture2D projector);| Name | Type | Default |
|---|---|---|
projector | Texture2D | — |
SetShadowvoid
public void SetShadow(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetShadowCasterMaskvoid
public void SetShadowCasterMask(uint casterMask);| Name | Type | Default |
|---|---|---|
casterMask | uint | — |
SetShadowReverseCullFacevoid
public void SetShadowReverseCullFace(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetTemperaturevoid
public void SetTemperature(float temperature);Sets LightTemperature. Color temperature in Kelvin, active with physical light units enabled. Around 6500 K is approximately neutral; lower values are warmer. Temperature color combines with LightColor in linear space; it does not replace a tinted LightColor with neutral white.
| Name | Type | Default |
|---|---|---|
temperature | float | — |
temperatureColor temperature in Kelvin, active with physical light units enabled. Around 6500 K is approximately neutral; lower values are warmer. Temperature color combines with LightColor in linear space; it does not replace a tinted LightColor with neutral white.
Light3D.BakeMode
| Value | Description |
|---|---|
Disabled = 0 | 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 |
Dynamic = 2 | Light is taken into account in dynamic baking ( |
Static = 1 | Light is taken into account in static baking ( |