UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1

LightWorld Class

This class is used to create world light sources. This type of lite sources imitates sunlight and uses parallel-split shadow mapping.

LightWorld Class

This class inherits from Light

Members


LightWorld (vec4 color)

Constructor. Creates a new world light source with a given color.

Arguments

  • vec4 color - Color of the new light source.

float getDisableAngle ()

Returns an angle at which the light source is disabled (shadows and the diffuse component is disabled). However, the light source still affects scattering.

Return value

Angle at at which the light source is disabled.

int getNumShadowSplits ()

Returns the number of shadow splits.

Return value

The number of shadow splits.

int getScattering ()

Returns a value indicating if scattering is associated with the world light.

Return value

Positive number if scattering is associated with the light; otherwise, 0.

float getShadowDistribute ()

Returns a coefficient indicating how distance between split planes should change (Unigine uses PSSM to render shadows).

Return value

Coefficient indicating how distance between split planes should change. 0 means that the distances between planes increase logarithmically. 1 means that linear splits are used. Values in between specify interpolation between the above two strategies.

float getShadowRange ()

Returns a range, in which objects cast shadows created by the light. This range is measured along the light direction, not the camera direction, however, the center of the range lies on the camera direction line.

Return value

Shadow map depth.

void setDisableAngle (float angle)

Sets an angle at which the light source is disabled (shadows and the diffuse component is disabled). However, the light source still affects scattering.

Arguments

  • float angle - Angle at which the light source is disabled.

void setNumShadowSplits (int num)

Sets a number of shadow map splits. Take into the account that excessive number of splits heavily increase polygon count in the scene.

Arguments

  • int num - Number of shadow splits, accepted values are from 1 to 4 (4 by default).

void setScattering (int mode)

Sets a value indicating if scattering should be associated with the world light.

Arguments

  • int mode - Positive number to associate scattering with the light, 0 to not associate.

void setShadowDistribute (float coefficient)

Sets a coefficient indicating how distance between split planes should change (Unigine uses PSSM to render shadows).

Arguments

  • float coefficient - Coefficient indicating how distance between split planes should change. 0 means that the distances between planes increase logarithmically. 1 means that linear splits are used. Values in between specify interpolation between the above two strategies. The provided value will be saturated in range [0; 1].

void setShadowRange (float distance)

Sets a range, in which objects cast shadows created by the light. This range is measured along the light direction, not the camera direction, however, the center of the range lies on the camera direction line.

Arguments

  • float distance - Shadow map depth. If a negative value is provided, 0 will be used instead.

int LIGHT_WORLD_SCATTERING_MOON

Description

Render the atmosphere in accordance with the Moon's lighting.

int LIGHT_WORLD_SCATTERING_NONE

Description

Render the atmosphere with no influence of the global lights (sun and moon), i.e. the light gradient won't be changed in any direction.

int LIGHT_WORLD_SCATTERING_SUN

Description

Render the atmosphere in accordance with the Sun's lighting.
Last update: 2017-07-03