Light¶
Inherits: VisualInstance < CullInstance < Spatial < Node < Object
Inherited By: DirectionalLight, OmniLight, SpotLight
Provides a base class for different kinds of light nodes.
Description¶
Light is the abstract base class for light nodes. As it can't be instanced, it shouldn't be used directly. Other types of light nodes inherit from it. Light contains the common variables and parameters used for lighting.
Tutorials¶
Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods¶
void |
Enumerations¶
enum Param:
Param PARAM_ENERGY = 0
Constant for accessing light_energy.
Param PARAM_INDIRECT_ENERGY = 1
Constant for accessing light_indirect_energy.
Param PARAM_SIZE = 2
Constant for accessing light_size.
Param PARAM_SPECULAR = 3
Constant for accessing light_specular.
Param PARAM_RANGE = 4
Constant for accessing OmniLight.omni_range or SpotLight.spot_range.
Param PARAM_ATTENUATION = 5
Constant for accessing OmniLight.omni_attenuation or SpotLight.spot_attenuation.
Param PARAM_SPOT_ANGLE = 6
Constant for accessing SpotLight.spot_angle.
Param PARAM_SPOT_ATTENUATION = 7
Constant for accessing SpotLight.spot_angle_attenuation.
Param PARAM_CONTACT_SHADOW_SIZE = 8
Constant for accessing shadow_contact.
Param PARAM_SHADOW_MAX_DISTANCE = 9
Constant for accessing DirectionalLight.directional_shadow_max_distance.
Param PARAM_SHADOW_SPLIT_1_OFFSET = 10
Constant for accessing DirectionalLight.directional_shadow_split_1.
Param PARAM_SHADOW_SPLIT_2_OFFSET = 11
Constant for accessing DirectionalLight.directional_shadow_split_2.
Param PARAM_SHADOW_SPLIT_3_OFFSET = 12
Constant for accessing DirectionalLight.directional_shadow_split_3.
Param PARAM_SHADOW_NORMAL_BIAS = 13
Constant for accessing DirectionalLight.directional_shadow_normal_bias.
Param PARAM_SHADOW_BIAS = 14
Constant for accessing shadow_bias.
Param PARAM_SHADOW_BIAS_SPLIT_SCALE = 15
Constant for accessing DirectionalLight.directional_shadow_bias_split_scale.
Param PARAM_SHADOW_FADE_START = 16
Constant for accessing DirectionalLight.directional_shadow_fade_start.
Param PARAM_MAX = 17
Represents the size of the Param enum.
enum BakeMode:
BakeMode BAKE_DISABLED = 0
Light is ignored when baking.
Note: Hiding a light does not affect baking.
BakeMode BAKE_INDIRECT = 1
Only indirect lighting will be baked (default).
BakeMode BAKE_ALL = 2
Both direct and indirect light will be baked.
Note: You should hide the light if you don't want it to appear twice (dynamic and baked).
Property Descriptions¶
bool editor_only = false
If true
, the light only appears in the editor and will not be visible at runtime.
BakeMode light_bake_mode = 1
The light's bake mode. See BakeMode.
Color light_color = Color( 1, 1, 1, 1 )
The light's color. An overbright color can be used to achieve a result equivalent to increasing the light's light_energy.
int light_cull_mask = 4294967295
The light will affect objects in the selected layers.
float light_energy = 1.0
The light's strength multiplier (this is not a physical unit). For OmniLight and SpotLight, changing this value will only change the light color's intensity, not the light's radius.
float light_indirect_energy = 1.0
Secondary multiplier used with indirect light (light bounces). This works on both BakedLightmap and GIProbe.
bool light_negative = false
If true
, the light's effect is reversed, darkening areas and casting bright shadows.
float light_size = 0.0
The size of the light in Redot units. Only considered in baked lightmaps and only if light_bake_mode is set to BAKE_ALL. Increasing this value will make the shadows appear blurrier. This can be used to simulate area lights to an extent.
Note: light_size is not affected by Spatial.scale (the light's scale or its parent's scale).
float light_specular = 0.5
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.
float shadow_bias = 0.15
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.
Color shadow_color = Color( 0, 0, 0, 1 )
The color of shadows cast by this light.
float shadow_contact = 0.0
Attempts to reduce shadow_bias gap by rendering screen-space contact shadows. This has a performance impact, especially at higher values.
Note: Contact shadows can look broken, so leaving this property to 0.0
is recommended.
bool shadow_enabled = false
If true
, the light will cast shadows.
bool shadow_reverse_cull_face = false
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 GeometryInstance.SHADOW_CASTING_SETTING_DOUBLE_SIDED.
Method Descriptions¶
float get_param ( Param param ) const
Returns the value of the specified Param parameter.
void set_param ( Param param, float value )
Sets the value of the specified Param parameter.