Unigine.Light Class
Inherits: | Node |
This base class is used to create light sources and shadows from them. The lights can be rendered as a simplified deferred lighting.
Light Class
Enums
SHADOW_RESOLUTION#
SHADOW_PENUMBRA#
Name | Description |
---|---|
GLOBAL = -1 | Quality mode of shadow penumbra that is set globally for all light sources is applied. |
DISABLED = GLOBAL + 1 | Shadow penumbra is disabled. |
LOW = DISABLED + 1 | Low quality of shadow penumbra. |
MEDIUM = LOW + 1 | Medium quality of shadow penumbra. |
HIGH = MEDIUM + 1 | High quality of shadow penumbra. |
ULTRA = HIGH + 1 | Ultra quality of shadow penumbra. |
SHADOW_FILTER#
Name | Description |
---|---|
GLOBAL = -1 | Quality mode of shadow filtering that is set globally is applied. |
DISABLED = GLOBAL + 1 | Shadow filtering is disabled. |
LOW = DISABLED + 1 | Low quality of shadow filtering. |
MEDIUM = LOW + 1 | Medium quality of shadow filtering. |
HIGH = MEDIUM + 1 | High quality of shadow filtering. |
ULTRA = HIGH + 1 | Ultra quality of shadow filtering. |
COLOR_MODE#
Name | Description |
---|---|
CLASSIC = 0 | Classic color calculation mode, resulting color is defined by Color. |
TEMPERATURE = 1 | Physically based color calculation mode, resulting color is calculated as: ColorFilter * (color obtained using the ColorTemperature value). |
SHADOW_MODE#
MODE#
SHAPE#
Properties
float ShadowScreenSpaceViewBias#
The current bias value for screen-space shadows. this parameter is used to simulate multiple shadows on the tree crown.
set
Sets the bias value for screen-space shadows. This parameter is used to simulate multiple shadows on the tree crown.
set value -
Bias value in the range[0.0f; 1.0f].
float ShadowScreenSpaceNoiseTranslucent#
The current intensity of noise used for smoothing of translucent screen-space shadows.
set
Sets the intensity of noise to be used for smoothing of translucent screen-space shadows.
This option affects performance, so use it only in case it noticeably improves the result.
set value -
Intensity of noise to be used for smoothing of translucent screen-space shadows. Higher values result in more intense and noticeable noise.
float ShadowScreenSpaceSoftness#
The current softness value of the screen-space shadows for the light source.
set
Returns the softness value of the screen-space shadows for the light source.
set value -
Screen-space shadows softness. The default value is 0.4. The higher is the value, the softer are the shadows.
Screen-space shadows must be enabled, see the setShadowScreenSpace() method.
float ShadowScreenSpaceThreshold#
The current threshold value used to calculate screen-space shadows for the light source.
set
Sets the threshold value used to calculate screen-space shadows for the light source. This parameter is used to adjust the look of screen-space shadows.
set value -
Screen-space shadows threshold. The default value is 1.0.
Screen-space shadows must be enabled, see the setShadowScreenSpace() method.
float ShadowScreenSpaceStepSize#
The current size of the step used to calculate screen-space shadows for the light source.
set
Sets the size of the step used to calculate screen-space shadows for the light source. This parameter can be used to adjust calculation of shadows for specific sizes of objects.
set value -
Step size. The default value is 0.5.
Screen-space shadows must be enabled, see the setShadowScreenSpace() method.
float ShadowScreenSpaceNoiseStep#
The current intensity of the step noise used to calculate screen-space shadows for the light source.
set
Sets the intensity of the step noise used to calculate screen-space shadows for the light source. This parameter is used to reduce the banding effect.
set value -
Step noise intensity. The default value is 0.5. The higher is the value, the less pronounced is the banding effect. However, this option significantly affects performance.
Screen-space shadows must be enabled, see the setShadowScreenSpace() method.
float ShadowScreenSpaceNoiseRay#
The current intensity of the ray noise used to calculate screen-space shadows for the light source.
set
Sets the intensity of the ray noise used to calculate screen-space shadows for the light source. This parameter is used to reduce the banding effect.
set value -
Ray noise intensity. The default value is 0.5. The higher is the value, the less pronounced is the banding effect. However, this option significantly affects performance.
Screen-space shadows must be enabled, see the setShadowScreenSpace() method.
int ShadowScreenSpaceNumSteps#
The current number of steps used to calculate screen-space shadows for the light source.
set
Sets the number of steps used to calculate screen-space shadows for the light source.
set value -
Number of steps. The default value is 8. The higher is the value, the better is the quality of shadows. However, this option significantly affects performance.
Screen-space shadows must be enabled, see the setShadowScreenSpace() method.
int ShadowScreenSpaceNumRays#
The current number of rays used to calculate screen-space shadows for the light source.
set
Sets the number of rays used to calculate screen-space shadows for the light source.
set value -
Number of rays. The default value is 8. The higher is the value, the better is the quality of shadows. However, this option significantly affects performance.
Screen-space shadows must be enabled, see the setShadowScreenSpace() method.
int ShadowScreenSpace#
A value indicating if screen-space shadows for the light source are enabled. when this option is enabled, penumbras from the light source are calculated using the ray tracing algorithm.
set
Enables or disables screen-space shadows for the light source. When this option is enabled, penumbras from the light source are calculated using the ray tracing algorithm.
set value -
1 to enable screen-space shadows for the light source, 0 to disable. The default value is 0.
string BakedDepthTexturePath#
A path to a baked depth texture, which is used for storing the shadow map created from the light source set to the static light mode. this texture is baked automatically via the editor or using bake() or bakeAll() methods.
set
Sets a path to a baked depth texture, which stores a shadow map generated for the light source, when its mode is set to MODE_STATIC. EnvironmentProbes use this texture for cutting out reflections for occluded areas, where they should not be visible.
set value -
Path to a baked depth texture to be used.
Texture DynamicDepthTexture#
The current dynamic depth texture for the light source. this texture is available for the following types of light sources:
- Dynamic lights.
- Static lights with mixed shadow mode enabled, that use a mixture of dynamic and baked depth textures.
set
Sets the dynamic depth texture for the light source. This texture is available for the following types of light sources:
- Dynamic lights.
- Static lights with mixed shadow mode enabled, that use a mixture of dynamic and baked depth textures.
set value -
Depth texture to be used for the light source.
float ShadowPenumbra#
The current intensity of penumbra for the selected mode.
set
Sets intensity of penumbra for the selected mode.
This value is ignored when penumbra rendering mode is set to disabled.
set value -
Intensity of penumbra for the selected mode:
- Low values correspond to sharper shadow edges.
- Higher values increase penumbra size.
Light.SHADOW_PENUMBRA ShadowPenumbraMode#
The current global quality mode used for rendering penumbra from the light source. this mode enables simulation of real-world shadows by keeping sharp contact shadows closer to the base and softening the farther the shadow stretches away. Higher values produce softer shadows.
set
Sets the global quality mode to be used for rendering penumbra from the light source. This mode enables simulation of real-world shadows by keeping sharp contact shadows closer to the base and softening the farther the shadow stretches away. Higher values produce softer shadows. The default value is SHADOW_PENUMBRA_GLOBAL.
set value -
Quality mode used for penumbra rendering, one of the SHADOW_PENUMBRA values.
float ShadowFilter#
The current filtering intensity for the selected mode.
set
Sets filtering intensity for the selected mode.
This value is ignored when filtering mode is set to disabled.
set value -
Filtering intensity for the selected mode. The higher the value the less noticeable the stair-step effect at the edges of shadows will be. The default value is 1.0f.
Light.SHADOW_FILTER ShadowFilterMode#
The current filtering mode used to reduce the stair-step effect for soft shadows making the edges smoother.
set
Sets the filtering mode to be used to reduce the stair-step effect for soft shadows making the edges smoother.
set value -
Filtering mode to be used for shadows rendering, one of the SHADOW_FILTER values.
Light.SHADOW_MODE ShadowMode#
Shadow mode for the light source in static mode. this shadow mode should be aligned with the shadow mode of the object surface in order to make this surface cast a shadow from the light source.
set
Sets shadow mode for the light source in static mode. This shadow mode should be aligned with the shadow mode of the object surface in order to make this surface cast a shadow from the light source.
set value -
Shadow mode of the light in static mode, one of the SHADOW_MODE_* variables.
Light.MODE Mode#
The current rendering mode for the light source. this option determines whether the light is to be rendered as a dynamic or static one.
set
Sets rendering mode for the light source. This option determines whether the light is to be rendered as a dynamic or static one.
set value -
Light mode, one of the MODE_* variables.
float ShadowNormalBias#
The shadow bias that is achieved by shifting the surface on which the shadow falls. the surface is shifted along normals stored in the normal map. depending on the normal map of the surface, the shadow may differ for the same values of the normal bias.
set
Updates the shadow bias that is achieved by shifting the surface on which the shadow falls. The surface is shifted along normals stored in the normal map. Depending on the normal map of the surface, the shadow may differ for the same values of the normal bias.
set value -
New normal bias. If a negative value is provided, 0 will be used instead.
float ShadowBias#
The constant offset of depth values in a shadow map.
- If the shadow acne appears, the bias value should be increased. This procedure eliminates the self-shadowing effect, as the points will appear closer to light source when compared to the map depth value.
- If the bias value is set too high, the shadow will look detached from the object casting it (see the 3rd picture below).
set
Updates the constant offset of depth values in a shadow map.
- If the shadow acne appears, the bias value should be increased. This procedure eliminates the self-shadowing effect, as the points will appear closer to light source when compared to the map depth value.
- If the bias value is set too high, the shadow will look detached from the object casting it (see the 3rd picture below).
set value -
New constant depth offset. If a negative value is provided, 0 will be used instead.
Light.SHADOW_RESOLUTION ShadowResolution#
The size of the shadow map created for the light source.
set
Updates the size of the shadow map created for the light source.
- The higher the resolution, the smoother and true to life the result is.
- The lower the resolution, the more blocky and jagged the shadows outline appears.
set value -
The required SHADOW_RESOLUTION value.
bool Shadow#
A value indicating if the light source casts shadows from surfaces with the Cast Shadow material.
set
Updates a value indicating if the light casts shadows from surfaces with the Cast Shadow material.
set value -
1 to cast shadows, 0 not to cast.
float AttenuationPower#
The attenuation power of the light. this parameter determines how fast the intensity decreases up to the attenuation distance set for the light source. if the attenuation equals to zero or is close to it, the edge between illuminated and non-illuminated areas will be sharp. the default is 1.
set
Updates the attenuation power of the light. This parameter determines how fast the intensity decreases up to the attenuation distance set for the light source. If the attenuation equals to zero or is close to it, the edge between illuminated and non-illuminated areas will be sharp.
set value -
Light attenuation power.
vec4 ColorFilter#
The color multiplier for the light source color (calculated using the color temperature value). This is used to imitate colored glass. The method takes effect only when the Temperature color mode is set.
set
Sets a color multiplier for the light source color (calculated using the color temperature value). This can be used to imitate colored glass. The method takes effect only when the Temperature color mode is set.
set value -
Color.
float ColorTemperature#
The light source temperature used for light color calculation.
set
Sets a light source temperature used for light color calculation.
set value -
Light source temperature in range [0;40000].
float Lux#
The intensity of the light color (as perceived by the human eye) in lux. in unigine, all light sources have the intensity of 1 by default, which is equal to 100000 lux.
set
Sets an intensity of a light color (as perceived by the human eye) in lux. In UNIGINE, all light sources have the intensity of 1 by default, which is equal to 100000 lux.
set value -
Light color intensity, lux.
float Intensity#
The multiplier of the light color used to control color intensity. the higher the value, the brighter the light is.
set
Updates the multiplier for the light color used to control color intensity. The higher the value, the brighter the light is.
- The minimum value of 1 corresponds to the least saturated light color.
- The maximum value of 100 equals the most bright and intense color.
set value -
New color multiplier.
vec4 Color#
The color of the light source. the default is opaque white, (1, 1, 1, 1). The method takes effect only when the Classic color mode is set.
set
Updates the color of the light source. The method takes effect only when the Classic color mode is set.
set value -
New color in the RGBA format.
Light.COLOR_MODE ColorMode#
The current color calculation mode of the light source. light source color can be defined by the color value (classic mode) or by the color temperature and color filter values (physically based mode).
set
Sets color calculation mode for the light source. Light source color can be defined by the color value (classic mode) or by the color temperature and color filter values (physically based mode).
set value -
Color calculation mode, one of the following values:
- COLOR_MODE_CLASSIC - classic mode
- COLOR_MODE_TEMPERATURE - physically based mode
int ViewportMask#
The current bit mask for rendering into the viewport. the light is rendered, if its mask matches the player's one.
set
Updates a bit mask for rendering into the viewport. The light is rendered, if its mask matches the player's one.
set value -
Integer, each bit of which is used to set a mask.
int ShadowMask#
The current light mask for the light source.
For the shadow from an object's surface to be rendered for the light source, this mask must match the following ones (one bit, at least):
- Shadow mask of the surface of the object
- Shadow mask of the material assigned to this surface
set
Updates the light mask for the light source.
For the shadow from an object's surface to be rendered for the light source, this mask must match the following ones (one bit, at least):
- Shadow mask of the surface of the object
- Shadow mask of the material assigned to this surface
set value -
Integer, each bit of which is used to set a mask.
bool RenderTransparent#
A value indicating if the light from the source is rendered on transparent objects.
set
Enables or disables rendering of the light from the source on transparent objects.
set value -
1 to render the light from the source on transparent objects, 0 not to render.
bool RenderWater#
A value indicating if the light from the source is rendered on water objects.
set
Enables or disables rendering of the light from the source on water objects.
set value -
1 to render the light from the source on water objects, 0 not to render.
float FadeDistance#
The current distance, at which the light source gradually disappears. this parameter enables to render the light with decreasing radiance after the Visible distance is past.
set
Updates a distance, at which the light gradually disappears. This parameter enables to render the light with decreasing radiance after the Visible distance is past.
set value -
Distance in units.
float ShadowDistance#
The current distance, at which shadow from the light source starts fading out to nonexistence.
set
Updates a distance, at which shadow from the light source starts fading out to nonexistence.
set value -
Distance in units.
float VisibleDistance#
The current distance, at which the light source starts fading. if the distance is set to infinity, the source is always rendered.
set
Updates a distance, at which the light source starts fading. If the distance is set to infinity, the source is always rendered.
set value -
Distance in units.
int NumLensFlares#
The total number of lens flares used for the per-light lens flare effect.
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
bool IsLensFlaresUseLightColor#
A value indicating if light color modulation is enabled for per-light lens flares. when enabled, the lens flares will have the same color as the light source.
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
set
Enables or disables light color modulation for per-light lens flares. When enabled, the lens flares will have the same color as the light source.
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
set value -
1 to enable light color modulation for the per-light lens flare effect, 0 to disable. The default value is 0.
vec3 LensFlaresWorldPositionOffset#
The current offset from the world position of the light source for the per-light lens flares. offset is not available for World Lights.
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
set
Sets the offset from the world position of the light source for the per-light lens flares. Offset is not available for World Lights.
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
set value -
Vector representing the offset of lens flares from the light source world position.
float LensFlaresOcclusionFadeBorder#
The current lens flare occlusion fade value for the cases when the light source becomes occluded by the edges of the screen.
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
set
Sets the lens flare occlusion fade value for the cases when the light source becomes occluded by the edges of the screen.
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
set value -
Lens flare occlusion fade value in the range [0.0f; 1.0f]. By the value of 0.0f, lens flares disappear abruptly, as the light source becomes occluded by an object. If 1.0f is set, lens flares will fade out gradually.
float LensFlaresOcclusionFade#
The current lens flare occlusion fade value for the cases when the light source becomes occluded by an object.
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
set
Sets the lens flare occlusion fade value for the cases when the light source becomes occluded by an object.
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
set value -
Lens flare occlusion fade value in the range [0.0f; 1.0f]. By the value of 0.0f, lens flares disappear abruptly, as the light source becomes occluded by an object. If 1.0f is set, lens flares will fade out gradually.
float LensFlaresIntensity#
The current intensity of per-light lens flares.
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
set
Sets the intensity of per-light lens flares.
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
set value -
Intensity of per-light lens flares.Higher values make the effect more pronounced.
string LensFlaresTextureName#
The name of the texture currently used for the per-light lens flare effect. this texture stores images for all lens flares used to render lens flares.
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
set
Sets the name of the texture to be used for the per-light lens flare effect. This texture stores images for all lens flares used to render lens flares.
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
set value -
Texture name.
bool IsLensFlaresEnabled#
A value indicating if the per-light lens flare effect is enabled for the light source.
set
Enables or disables the per-light lens flare effect for the light source.
- This feature is available only for: Omni Lights, Projected Lights and World Lights.
- The maximum number of per-light lens flares that can be rendered is 32.
set value -
1 to enable the per-light lens flare effect for the light source, 0 to disable. The default value is 0.
Members
void AllocateLensFlares ( int num ) #
Allocate a buffer for a given number of lens flares to be created. With this function, memory can be allocated once rather than in chunks, making the creation faster.The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
Arguments
- int num - Number of lens flares to be created in the allocated buffer.
void AddLensFlare ( ) #
Add a new lens flare for the per-light lens flare effect.The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
LightLensFlare GetLensFlare ( int num ) #
Returns the given lens flare from the list of the ones used for the per-light lens flare effect.The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
Arguments
- int num - Lens flare number.
Return value
Light lens flare instance.void CloneLensFlare ( int num ) #
Creates a clone of the lens flare with a given number in the list of lens flares used for the per-light lens flare effect.The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
Arguments
- int num - Number of lens flare to be cloned.
void RemoveLensFlare ( int num ) #
Removes the lens flare with a given number from the list of lens flares used for the per-light lens flare effect.The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
Arguments
- int num - Number of lens flare to be removed.
void ClearLensFlares ( ) #
Clears the list of lens flares used for the per-light lens flare effect.The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.
vec4 CalculateFinalColor ( ) #
Calculates the final color of the light source depending on the calculation mode used.Return value
Resulting color of the light source.bool SaveStateLight ( Stream stream ) #
Saves the state of the light source to the specified stream.Arguments
- Stream stream - Stream instance.
bool RestoreStateLight ( Stream stream ) #
Restores the state of the light source from the specified stream.Arguments
- Stream stream - Stream instance.
bool SaveStateLensFlares ( Stream stream ) #
Saves the state of the per-light lens flare effect to the specified stream.Arguments
- Stream stream - Stream instance.
bool RestoreStateLensFlares ( Stream stream ) #
Restores the state of the per-light lens flare effect from the specified stream.Arguments
- Stream stream - Stream instance.
Texture GetBakedDepthTexture ( ) #
Returns the depth texture baked for the light source. This texture is available for Static light sources only.Static lights with mixed shadow mode enabled use a mixture of dynamic and baked depth textures.
Return value
Baked depth texture for the light source.Last update:
2020-04-10
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)