This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Light Class

Warning
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScript (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
Inherits from: 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

Members


void setMode ( int mode ) #

Sets rendering mode for the light source. This option determines whether the light is to be rendered as a dynamic or static one.

Arguments

int getMode ( ) #

Returns the current rendering mode for the light source. This option determines whether the light is to be rendered as a dynamic or static one.

Return value

Light mode, one of the LIGHT_MODE_* variables.

void setAttenuationPower ( float power ) #

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.

Arguments

  • float power - Light attenuation power.

float getAttenuationPower ( ) #

Returns 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.

Return value

Light attenuation power.

void setColor ( vec4 color ) #

Updates the color of the light source. The method takes effect only when the Classic color mode is set.

Arguments

  • vec4 color - New color in the RGBA format.

vec4 getColor ( ) #

Returns 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.

Return value

Color of the light source in the RGBA format.

Texture getDepthTexture ( ) #

Returns the current depth texture (shadow map) of the light source.

Return value

Current depth texture (shadow map) of the light source.

Texture getShadowColorTexture ( ) #

Returns the current shadow texture of the light source used to render translucent shadows: G-channel stores depth values, R-channel - transparency values.

Return value

Current shadow texture of the light source.

void setFadeDistance ( float distance ) #

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.

Arguments

  • float distance - Distance in units.

float getFadeDistance ( ) #

Returns 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.

Return value

Distance in units.

void setIntensity ( float intensity ) #

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.

Arguments

  • float intensity - New color multiplier.

float getIntensity ( ) #

Returns the multiplier of the light color used to control color intensity. The higher the value, the brighter the light is.

Return value

Light color multiplier.

void setShadowMask ( int mask ) #

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):

Arguments

  • int mask - Integer, each bit of which is used to set a mask.

int getShadowMask ( ) #

Returns 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):

Return value

Integer, each bit of which is used to set a mask.

void setRenderTransparent ( int transparent ) #

Enables or disables rendering of the light from the source on transparent objects.

Arguments

  • int transparent - 1 to render the light from the source on transparent objects, 0 not to render.

int getRenderTransparent ( ) #

Returns a value indicating if the light from the source is rendered on transparent objects.

Return value

1 if the light from the source is rendered on transparent objects; otherwise, 0.

void setRenderWater ( int water ) #

Enables or disables rendering of the light from the source on water objects.

Arguments

  • int water - 1 to render the light from the source on water objects, 0 not to render.

int getRenderWater ( ) #

Returns a value indicating if the light from the source is rendered on water objects.

Return value

1 if the light from the source is rendered on water objects; otherwise, 0.

void setShadow ( int shadow ) #

Updates a value indicating if the light casts shadows from surfaces with the Cast Shadow material.

Arguments

  • int shadow - 1 to cast shadows, 0 not to cast.

int getShadow ( ) #

Returns a value indicating if the light source casts shadows from surfaces with the Cast Shadow material.

Return value

1 if the light source casts shadows; otherwise, 0.

void setShadowBias ( float bias ) #

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).

Arguments

  • float bias - New constant depth offset. If a negative value is provided, 0 will be used instead.

float getShadowBias ( ) #

Returns 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).

Return value

Constant depth offset.

void setShadowDistance ( float distance ) #

Updates a distance, at which shadow from the light source starts fading out to nonexistence.

Arguments

  • float distance - Distance in units.

float getShadowDistance ( ) #

Returns the current distance, at which shadow from the light source starts fading out to nonexistence.

Return value

Distance in units.

void setShadowNormalBias ( float bias ) #

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.

Arguments

  • float bias - New normal bias. If a negative value is provided, 0 will be used instead.

float getShadowNormalBias ( ) #

Returns 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.

Return value

The normal bias.

void setShadowResolution ( int resolution ) #

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.

Arguments

int getShadowResolution ( ) #

Returns the size of the shadow map created for the light source.

Return value

Shadow map size, one of the LIGHT_SHADOW_RESOLUTION_VALUE_ variables

void setShadowScreenSpace ( int space ) #

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.

Arguments

  • int space - 1 to enable screen-space shadows for the light source, 0 to disable. The default value is 0.

int getShadowScreenSpace ( ) #

Returns 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.

Return value

1 if screen-space shadows for the light source are enabled; otherwise, 0.

void setShadowScreenSpaceNoiseRay ( float ray ) #

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.

Arguments

  • float ray - 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.
    Notice
    Screen-space shadows must be enabled, see the setShadowScreenSpace() method.

float getShadowScreenSpaceNoiseRay ( ) #

Returns the current intensity of the ray noise used to calculate screen-space shadows for the light source.

Return value

Ray noise intensity.

void setShadowScreenSpaceNoiseStep ( float step ) #

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.

Arguments

  • float step - 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.
    Notice
    Screen-space shadows must be enabled, see the setShadowScreenSpace() method.

float getShadowScreenSpaceNoiseStep ( ) #

Returns the current intensity of the step noise used to calculate screen-space shadows for the light source.

Return value

Step noise intensity.

void setShadowScreenSpaceNoiseTranslucent ( float translucent ) #

Sets the intensity of noise to be used for smoothing of translucent screen-space shadows.
Notice
This option affects performance, so use it only in case it noticeably improves the result.

Arguments

  • float translucent - Intensity of noise to be used for smoothing of translucent screen-space shadows. Higher values result in more intense and noticeable noise.

float getShadowScreenSpaceNoiseTranslucent ( ) #

Returns the current intensity of noise used for smoothing of translucent screen-space shadows.

Return value

Current intensity of noise used for smoothing of translucent screen-space shadows.

void setShadowScreenSpaceNumRays ( int rays ) #

Sets the number of rays used to calculate screen-space shadows for the light source.

Arguments

  • int rays - 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.
    Notice
    Screen-space shadows must be enabled, see the setShadowScreenSpace() method.

int getShadowScreenSpaceNumRays ( ) #

Returns the current number of rays used to calculate screen-space shadows for the light source.

Return value

Number of rays.

void setShadowScreenSpaceNumSteps ( int steps ) #

Sets the number of steps used to calculate screen-space shadows for the light source.

Arguments

  • int steps - 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.
    Notice
    Screen-space shadows must be enabled, see the setShadowScreenSpace() method.

int getShadowScreenSpaceNumSteps ( ) #

Returns the current number of steps used to calculate screen-space shadows for the light source.

Return value

Number of steps.

void setShadowScreenSpaceSoftness ( float softness ) #

Returns the softness value of the screen-space shadows for the light source.

Arguments

  • float softness - Screen-space shadows softness. The default value is 0.4. The higher is the value, the softer are the shadows.
    Notice
    Screen-space shadows must be enabled, see the setShadowScreenSpace() method.

float getShadowScreenSpaceSoftness ( ) #

Returns the current softness value of the screen-space shadows for the light source.

Return value

Screen-space shadows softness.

void setShadowScreenSpaceStepSizeNear ( float val ) #

Sets the size of the step used to calculate screen-space shadows for the light source (close distance range). This parameter can be used to adjust calculation of shadows for specific sizes of objects. You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Arguments

float getShadowScreenSpaceStepSizeNear ( ) #

Returns the current size of the step used to calculate screen-space shadows for the light source (close distance range). This parameter can be used to adjust calculation of shadows for specific sizes of objects. You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Return value

Screen-space step size for close distance range. The default value is 0.5.
Notice
Screen-space shadows must be enabled, see the setShadowScreenSpace() method.

void setShadowScreenSpaceStepSizeFar ( float val ) #

Sets the current size of the step used to calculate screen-space shadows for the light source (long distance range). This parameter can be used to adjust calculation of shadows for specific sizes of objects. You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Arguments

float getShadowScreenSpaceStepSizeFar ( ) #

Returns the current size of the step used to calculate screen-space shadows for the light source (long distance range). This parameter can be used to adjust calculation of shadows for specific sizes of objects. You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Return value

Screen-space step size for long distance range. The default value is 0.5.
Notice
Screen-space shadows must be enabled, see the setShadowScreenSpace() method.

void setShadowScreenSpaceThresholdNear ( float val ) #

Sets the threshold value used to calculate screen-space shadows for the light source (close distance range). This parameter is used to adjust the look of screen-space shadows. You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Arguments

float getShadowScreenSpaceThresholdNear ( ) #

Returns the current threshold value used to calculate screen-space shadows for the light source (close distance range). You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Return value

Screen-space shadows threshold for close distance range.

void setShadowScreenSpaceThresholdFar ( float val ) #

Sets the threshold value used to calculate screen-space shadows for the light source (long distance range). This parameter is used to adjust the look of screen-space shadows.You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Arguments

float getShadowScreenSpaceThresholdFar ( ) #

Returns the current threshold value used to calculate screen-space shadows for the light source (long distance range). You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Return value

Screen-space shadows threshold for long distance range.

void setShadowScreenSpaceViewBias ( float bias ) #

Sets the bias value for screen-space shadows. This parameter is used to simulate multiple shadows on the tree crown.

Arguments

  • float bias - Bias value in the range[0.0f; 1.0f].

float getShadowScreenSpaceViewBias ( ) #

Returns the current bias value for screen-space shadows. This parameter is used to simulate multiple shadows on the tree crown.

Return value

Bias value in the range[0.0f; 1.0f].

void setViewportMask ( int mask ) #

Updates a bit mask for rendering into the viewport. The light is rendered, if its mask matches the player's one.

Arguments

  • int mask - Integer, each bit of which is used to set a mask.

int getViewportMask ( ) #

Returns the current bit mask for rendering into the viewport. The light is rendered, if its mask matches the player's one.

Return value

Integer, each bit of which is used to set a mask.

void setVisibleDistance ( float distance ) #

Updates a distance, at which the light source starts fading. If the distance is set to infinity, the source is always rendered.

Arguments

  • float distance - Distance in units.

float getVisibleDistance ( ) #

Returns the current distance, at which the light source starts fading. If the distance is set to infinity, the source is always rendered.

Return value

Distance in units.

void setLensFlaresEnabled ( int enabled ) #

Enables or disables the per-light lens flare effect for the light source.
Notice

Arguments

  • int enabled - 1 to enable the per-light lens flare effect for the light source, 0 to disable. The default value is 0.

int isLensFlaresEnabled ( ) #

Returns a value indicating if the per-light lens flare effect is enabled for the light source.
Notice
This feature is available only for: Omni Lights, Projected Lights and World Lights.

Return value

1 if the per-light lens flare effect for the light source is enabled; otherwise, 0.

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.
Notice
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.
Notice
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.
Notice
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.
Notice
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.
Notice
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.

int getNumLensFlares ( ) #

Returns the total number of lens flares used for the per-light lens flare effect.
Notice
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.

Return value

Number of lens flares used for the per-light lens flare effect.

void clearLensFlares ( ) #

Clears the list of lens flares used for the per-light lens flare effect.
Notice
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.

void setLensFlaresIntensity ( float intensity ) #

Sets the intensity of per-light lens flares.
Notice
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

  • float intensity - Intensity of per-light lens flares.Higher values make the effect more pronounced.

float getLensFlaresIntensity ( ) #

Returns the current intensity of per-light lens flares.
Notice
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.

Return value

Intensity of per-light lens flares.Higher values make the effect more pronounced.

void setLensFlaresUseLightColor ( int color ) #

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.
Notice
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 color - 1 to enable light color modulation for the per-light lens flare effect, 0 to disable. The default value is 0.

int isLensFlaresUseLightColor ( ) #

Returns 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.
Notice
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.

Return value

1 if light color modulation for per-light lens flares is enabled; otherwise, 0.

void setLensFlaresOcclusionFade ( float fade ) #

Sets the lens flare occlusion fade value for the cases when the light source becomes occluded by an object.
Notice
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

  • float fade - 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 getLensFlaresOcclusionFade ( ) #

Returns the current lens flare occlusion fade value for the cases when the light source becomes occluded by an object.
Notice
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.

Return value

Current 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.

void setLensFlaresOcclusionFadeBorder ( float border ) #

Sets the lens flare occlusion fade value for the cases when the light source becomes occluded by the edges of the screen.
Notice
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

  • float border - 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 getLensFlaresOcclusionFadeBorder ( ) #

Returns the current lens flare occlusion fade value for the cases when the light source becomes occluded by the edges of the screen.
Notice
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.

Return value

Current 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 the edges of the screen. If 1.0f is set, lens flares will fade out gradually.

void setLensFlaresWorldPositionOffset ( vec3 offset ) #

Sets the offset from the world position of the light source for the per-light lens flares. Offset is not available for World Lights.
Notice
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

  • vec3 offset - Vector representing the offset of lens flares from the light source world position.

vec3 getLensFlaresWorldPositionOffset ( ) #

Returns the current offset from the world position of the light source for the per-light lens flares. Offset is not available for World Lights.
Notice
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.

Return value

Vector representing the current offset of lens flares from the light source world position.

void setLensFlaresTextureName ( string name ) #

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.
Notice
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

  • string name - Texture name.

string getLensFlaresTextureName ( ) #

Returns 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.
Notice
The lens flare effect must be enabled for the light source. This feature is available only for: Omni Lights, Projected Lights and World Lights.

Return value

Texture name.

void setLux ( float lux ) #

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.

Arguments

  • float lux - Light color intensity, lux.

float getLux ( ) #

Returns 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.

Return value

Light color intensity, lux.

void setColorTemperature ( float temperature ) #

Sets a light source temperature used for light color calculation.

Arguments

  • float temperature - Light source temperature in range [0;40000].

float getColorTemperature ( ) #

Returns the light source temperature used for light color calculation.

Return value

Light source temperature [0;40000].

void setColorFilter ( vec4 filter ) #

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.

Arguments

  • vec4 filter - Color.

vec4 getColorFilter ( ) #

Returns 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.

Return value

Color.

void setColorMode ( int mode ) #

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).

Arguments

int getColorMode ( ) #

Returns 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).

Return value

Current color calculation mode, one of the following values:

vec4 calculateFinalColor ( ) #

Calculates the final color of the light source depending on the calculation mode used.

Return value

Resulting color of the light source.

int saveStateLight ( Stream stream ) #

Saves the state of the light source to the specified stream.

Example using SaveStateLight() and restoreStateLight() methods:

Source code (UnigineScript)
// set the light state
light.setColorTemperature(15000.0f);

// save state
Blob blob_state = new Blob();
light.saveStateLight(blob_state);

// change state
light.setColorTemperature(27000.0f);

// restore state
blob_state.seekSet(0); // returning the carriage to the start of the blob
light.restoreStateLight(blob_state);

Arguments

  • Stream stream - Stream instance.

Return value

1 if the state of the light source is saved successfully; otherwise, 0.

int restoreStateLight ( Stream stream ) #

Restores the state of the light source from the specified stream.

Example using saveStateLight() and restoreStateLight() methods:

Source code (UnigineScript)
// set the light state
light.setColorTemperature(15000.0f);

// save state
Blob blob_state = new Blob();
light.saveStateLight(blob_state);

// change state
light.setColorTemperature(27000.0f);

// restore state
blob_state.seekSet(0); // returning the carriage to the start of the blob
light.restoreStateLight(blob_state);

Arguments

  • Stream stream - Stream instance.

Return value

1 if the state of the light source is restored successfully; otherwise, 0.

int saveStateLensFlares ( Stream stream ) #

Saves the state of the per-light lens flare effect to the specified stream.

Example using saveStateLensFlares() and restoreStateLensFlares() methods:

Source code (UnigineScript)
// set the lens flare state
lens_flare.setLensFlaresIntensity(0.75f);

// save state
Blob blob_state = new Blob();
lens_flare.saveStateLensFlares(blob_state);

// change state
lens_flare.setLensFlaresIntensity(0.25f);

// restore state
blob_state.seekSet(0); // returning the carriage to the start of the blob
lens_flare.restoreStateLensFlares(blob_state);

Arguments

  • Stream stream - Stream instance.

Return value

1 if the state of the per-light lens flare effect is saved successfully; otherwise, 0.

int restoreStateLensFlares ( Stream stream ) #

Restores the state of the per-light lens flare effect from the specified stream.

Example using saveStateLensFlares() and restoreStateLensFlares() methods:

Source code (UnigineScript)
// set the lens flare state
lens_flare.setLensFlaresIntensity(0.75f);

// save state
Blob blob_state = new Blob();
lens_flare.saveStateLensFlares(blob_state);

// change state
lens_flare.setLensFlaresIntensity(0.25f);

// restore state
blob_state.seekSet(0); // returning the carriage to the start of the blob
lens_flare.restoreStateLensFlares(blob_state);

Arguments

  • Stream stream - Stream instance.

Return value

1 if the state of the per-light lens flare effect is restored successfully; otherwise, 0.

void setBakedDepthTexturePath ( string path ) #

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.

Arguments

  • string path - Path to a baked depth texture to be used.

string getBakedDepthTexturePath ( ) #

Returns 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.

Return value

Path to a baked depth texture to be used.

void setShadowMode ( int mode ) #

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.

Arguments

int getShadowMode ( ) #

Returns 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.

Return value

Shadow mode of the light source in static mode, one of the LIGHT_SHADOW_MODE_* variables.

void setShadowColorTextureMode ( int mode ) #

Sets the type of texture used to define light distribution.
Notice
This feature is available only for Omni Lights and Projected Lights. See description of the modes in the corresponding articles for Omni Lights and Projected Lights.

Arguments

  • int mode - One of the following modes:
    • 0 - IES (Light distibution is defined by the IES profile).
    • 1 - SIMPLE (An arbitrary 2D texture is projected onto the scene).

int getShadowColorTextureMode ( ) #

Returns the current type of texture used to define light distribution.
Notice
This feature is available only for Omni Lights and Projected Lights. See description of the modes in the corresponding articles for Omni Lights and Projected Lights.

Return value

void setDynamicDepthTexture ( Texture texture ) #

Sets the dynamic depth texture for the light source. This texture is available for the following types of light sources:

Arguments

  • Texture texture - Depth texture to be used for the light source.

Texture getDynamicDepthTexture ( ) #

Returns the current dynamic depth texture for the light source. This texture is available for the following types of light sources:

Return value

Current dynamic depth texture of the light source.

Texture getBakedDepthTexture ( ) #

Returns the depth texture baked for the light source. This texture is available for Static light sources only.
Notice
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.

void setShadowFilterMode ( int mode ) #

Sets the filtering mode to be used to reduce the stair-step effect for soft shadows making the edges smoother.

Arguments

int getShadowFilterMode ( ) #

Returns the current filtering mode used to reduce the stair-step effect for soft shadows making the edges smoother.

Return value

Current filtering mode used, one of the LIGHT_SHADOW_FILTER_* variables.

void setShadowFilter ( float filter ) #

Sets filtering intensity for the selected mode.
Notice
This value is ignored when filtering mode is set to disabled.

Arguments

  • float filter - 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.

float getShadowFilter ( ) #

Returns the current filtering intensity for the selected mode.

Return 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.

void setShadowPenumbraMode ( int mode ) #

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.

Arguments

int getShadowPenumbraMode ( ) #

Returns 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. The default value is SHADOW_PENUMBRA_GLOBAL.

Return value

Current quality mode used for penumbra rendering, one of the LIGHT_SHADOW_PENUMBRA_* variables.

void setShadowPenumbra ( float penumbra ) #

Sets intensity of penumbra for the selected mode.
Notice
This value is ignored when penumbra rendering mode is set to disabled.

Arguments

  • float penumbra - Intensity of penumbra for the selected mode:
    • Low values correspond to sharper shadow edges.
    • Higher values increase penumbra size.
    The default value is 0.0f.

float getShadowPenumbra ( ) #

Returns the current intensity of penumbra for the selected mode.

Return value

Current intensity of penumbra for the selected mode:
  • Low values correspond to sharper shadow edges.
  • Higher values increase penumbra size.
The default value is 0.0f.

void setShadowScreenSpaceStepSizeFarDistance ( float distance ) #

Sets the distance from the camera after which the Far Step Size shall be used for screen-space shadows calculation. You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Arguments

float getShadowScreenSpaceStepSizeFarDistance ( ) #

Returns the current distance from the camera after which the Far Step Size is used for screen-space shadows calculation. You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Return value

Distance from the camera (in units) after which the Far Step Size shall be used for screen-space shadows calculation. For the space between Near Step Size Distance and Far Step Size Distance, the step size value is interpolated from Near Step Size to Far Step Size.

void setShadowScreenSpaceStepSizeNearDistance ( float distance ) #

Sets the distance from the camera up to which the Near Step Size shall be used for screen-space shadows calculation. You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Arguments

  • float distance - Distance from the camera (in units) up to which the Near Step Size shall be used for screen-space shadows calculation.

float getShadowScreenSpaceStepSizeNearDistance ( ) #

Returns the current distance from the camera up to which the Near Step Size is used for screen-space shadows calculation. You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Return value

Distance from the camera (in units) up to which the Near Step Size is used for screen-space shadows calculation.

void setShadowScreenSpaceThresholdNearDistance ( float distance ) #

Sets the current distance from the camera up to which the Near Threshold shall be used for screen-space shadows calculation. You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Arguments

  • float distance - Distance from the camera (in units) up to which the Near Threshold shall be used for screen-space shadows calculation.

float getShadowScreenSpaceThresholdNearDistance ( ) #

Returns the current distance from the camera up to which the Near Threshold is used for screen-space shadows calculation. You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Return value

Distance from the camera (in units) up to which the Near Threshold is used for screen-space shadows calculation.

void setShadowScreenSpaceThresholdFarDistance ( float distance ) #

Sets the distance from the camera after which the Far Threshold shall be used for screen-space shadows calculation. You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Arguments

float getShadowScreenSpaceThresholdFarDistance ( ) #

Sets the distance from the camera after which the Far Threshold is used for screen-space shadows calculation. You can set different Step Size and Threshold values for objects located near the camera and far away from it. Thus, full-scale shadows will be rendered for large objects located far away, while within the close distance range only shadows cast by small objects will be rendered. This feature is especially useful for locations where details are required for both short and long-distance ranges.

Return value

Distance from the camera (in units) after which the Far Threshold is used for screen-space shadows calculation. For the space between Near Threshold Distance and Far Threshold Distance, the threshold value is interpolated from Near Threshold to Far Threshold.
Last update: 2021-12-13
Build: ()