Light
Inherited By: , OmniLight,
Provides a base class for different kinds of light nodes.
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
Methods
float | ( Param param ) const |
void | ( Param param, value ) |
enum Param:
- PARAM_ENERGY = 0 —- Constant for accessing light_energy.
- PARAM_INDIRECT_ENERGY = 1 —- Constant for accessing .
- PARAM_SPECULAR = 2 —- Constant for accessing light_specular.
- PARAM_RANGE = 3 —- Constant for accessing or SpotLight.spot_range.
- PARAM_SPOT_ANGLE = 5 —- Constant for accessing .
- PARAM_SPOT_ATTENUATION = 6 —- Constant for accessing SpotLight.spot_angle_attenuation.
- PARAM_CONTACT_SHADOW_SIZE = 7 —- Constant for accessing .
- PARAM_SHADOW_MAX_DISTANCE = 8 —- Constant for accessing DirectionalLight.directional_shadow_max_distance.
- PARAM_SHADOW_SPLIT_1_OFFSET = 9 —- Constant for accessing .
- PARAM_SHADOW_SPLIT_2_OFFSET = 10 —- Constant for accessing DirectionalLight.directional_shadow_split_2.
- PARAM_SHADOW_SPLIT_3_OFFSET = 11 —- Constant for accessing .
- PARAM_SHADOW_NORMAL_BIAS = 12 —- Constant for accessing DirectionalLight.directional_shadow_normal_bias.
- PARAM_SHADOW_BIAS = 13 —- Constant for accessing .
- PARAM_SHADOW_BIAS_SPLIT_SCALE = 14 —- Constant for accessing DirectionalLight.directional_shadow_bias_split_scale.
- PARAM_MAX = 15 —- Represents the size of the enum.
enum BakeMode:
- BAKE_DISABLED = 0 —- Light is ignored when baking.
Note: Hiding a light does not affect baking.
- BAKE_INDIRECT = 1 —- Only indirect lighting will be baked (default).
Property Descriptions
- bool editor_only
Default | false |
Setter | set_editor_only(value) |
Getter | is_editor_only() |
If true
, the light only appears in the editor and will not be visible at runtime.
- light_bake_mode
Default | 1 |
Setter | set_bake_mode(value) |
Getter | get_bake_mode() |
The light’s bake mode. See BakeMode.
- light_color
Default | Color( 1, 1, 1, 1 ) |
Setter | set_color(value) |
Getter | get_color() |
The light’s color. An overbright color can be used to achieve a result equivalent to increasing the light’s light_energy.
- light_cull_mask
The light will affect objects in the selected layers.
- float light_energy
Default | 1.0 |
Setter | set_param(value) |
Getter | get_param() |
The light’s strength multiplier (this is not a physical unit). For and SpotLight, changing this value will only change the light color’s intensity, not the light’s radius.
- light_indirect_energy
Default | 1.0 |
Setter | set_param(value) |
Getter | get_param() |
Secondary multiplier used with indirect light (light bounces). This works on both BakedLightmap and .
- bool light_negative
Default | |
Setter | set_negative(value) |
Getter | is_negative() |
- light_specular
Default | 0.5 |
Setter | set_param(value) |
Getter | get_param() |
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
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.
- shadow_color
Default | Color( 0, 0, 0, 1 ) |
Setter | set_shadow_color(value) |
Getter | get_shadow_color() |
The color of shadows cast by this light.
- float shadow_contact
Default | 0.0 |
Setter | set_param(value) |
Getter | get_param() |
Attempts to reduce gap.
- bool shadow_enabled
Default | false |
Setter | set_shadow(value) |
Getter | has_shadow() |
If true
, the light will cast shadows.
- shadow_reverse_cull_face
Default | false |
Setter | set_shadow_reverse_cull_face(value) |
Getter | get_shadow_reverse_cull_face() |
If , 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.
- void set_param ( param, float value )
Sets the value of the specified parameter.