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 Objects
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
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
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.

Environment Settings

Warning
The functionality described in this article is not available in the Community SDK edition.
You should upgrade to Sim SDK edition to use it.

One of the key factors making visualization of the terrain database, with all entities moving around, immersive, and giving a perception of being physically present in the simulation is environment. It includes sky with celestial bodies and atmospheric effects that dramatically change the look of your virtual world depending on the weather and the time of day. The following models are used:

  • An ephemeris model determines the position of the sun and moon, which both cast light into the scene, depending on given coordinates and date/time.
  • A weather model, either in the IG or supplied by an external weather simulation, provides the cloud coverage, and a global wind concept with direction and strength, affecting vegetation animation and the environment.

See Also#

  • The IG plugin API section for more details on managing IG via code (C++).
  • SkyMap Class for more details on managing sky and celestial bodies via code (C++).
  • Meteo Class for more details on managing global weather settings via code (C++).
  • Region Class for more details on managing weather regions via code (C++).

Celestial Bodies#

Using a full-year ephemeris model IG automatically updates positions of the Sun, Moon, and stars based on the date, time, and geographic location.

By default IG is configured to work in the Greenwich time zone. But you can change time zone via code by adding the following line to the AppSystemLogic::init_ig() method:

Source code (C++)
ig_manager->getSkyMap()->setTimezone(8);

Configuring the Star Field#

Star field intensity is very low by default. You may need to adjust brightness level of your displays or increase maximum brightness of the star field for your area.

To make the stars look brighter do the following:

  • Temporarily disable the sun node in the Editor
  • Open Environment Settings (Windows -> Settings -> Runtime/World/Render/Environment)
  • Make sure the Environment Texture is set to star_c.hdr
  • Click Environment Color and increase values of RGB color components until you reach the desired brightness of the star field (e.g., to 100,100,100)
    Notice
    Alpha channel is used by the system to control Star Intensity (e.g., via CIGI).
  • Enable the sun node back again and save your world.

Stars are positioned on the sky automatically, depending on the date/time and geographic location.

Configuring Sun and Moon#

IG has a built-in celestial body control (celestial_control packet). In order to use it, you should have:

  • Two nodes, one for the Sun, and one for the Moon
  • The Celestial property assigned to the sun node
  • Parameters of the Celestial property containing links to the corresponding nodes.

Positions of the Sun and the Moon are adjusted automatically depending on the date/time and geographic location.

SkyMap Change Callbacks#

Sometimes it may be necessary to perform certain actions when the state of the sky changes (e.g. enable lighting at nignt time). Callbacks can be used for this purpose. Just implement your specific actions in a callback function and set it as follows:

SkyMap change callback implementation:

Source code (C++)
/// callback function to be called when sky state changes
void SomeClass::my_callback()
{
	// pointer to your sun node (don't forget to initialize it)
	NodePtr sun;
	
	// calculating zenith angle to determine if it is night time or not
	float zenith = getAngle(vec3_up, sun->getDirection(AXIS_Z));
	bool night = zenith > sun_zenit_threshold;
	
	// switching lights
	for (auto & it : lights)
	{
		it.data.setEnable(night);
	}
	
	// switching the emission state for emissive materials
	for (auto & it : emissive_materials)
	{
		it->setState("emission",night);
	}			
}

// ...
// somewhere in code
void SomeClass::init()
{
	// adding "my_callback" to be called on changing sky state
	ig_manager->getSkyMap()->addCallbackRefresh(this, Unigine::MakeCallback(this, &SomeClass::my_callback ) );
}

Atmospheric and Weather Effects#

IG supports the following weather effects:

  • Multiple atmospheric layers and haze
  • Sun angle-dependent haze color and density
  • Procedurally generated volumetric clouds
  • Lightning, rain, snow

Weather simulation includes three components:

  • Global — global atmospheric conditions (atmosphere_control packet): visibility range, wind speed and direction.
  • Weather layers — representing atmospheric layers, which have no distinct horizontal boundaries. Atmospheric effects are observed anywhere within the vertical range of a layer.
  • Weather regions — representing regional weather in certain areas. They have the same set of parameters (visibility, coverage, wind) as weather layers but atmospheric effects for them are limited to their boundaries.
Notice
  • Weather layers and weather regions always take precedence over global atmospheric conditions (i.e. global atmospheric changes will not affect the weather inside a layer or region).
  • When several layers and regions overlap their parameters are combined.

Weather layer wind changes global Animation Scale and Animation Wind for Vegetation depending on player's position inside weather layers.

By default there are 5 global weather layers:

  • Ground Fog — used for ground fog effect simulation.
    Notice
    This effect is currently simulated using Environment Haze, that depends on Visibility Distance of a Weather Layer.
  • Cloud Layer 1 — used for simulation of the first cloud layer
  • Cloud Layer 2 — used for simulation of the second cloud layer
  • Rain — used for rain simulation
  • Snow — used for snow simulation

You can add more layers and regions if necessary.

Clouds#

Volumetric clouds are particle masses that simulate light absorption, creating a realistic reduction in visibility when flown through. Clouds can cast shadows on the terrain.

IG currently supports Stratocumulus and Stratus clouds (types 9 and 10 according to CIGI specification), but you can extend this set by inheriting new materials from the clouds_base.

Cloud coverage is set automatically using the Coverage value from a weather_control packet received, or you can change it manually via the following code:

Source code (C++)
// setting cloud coverage for weather region with a given id
ig_manager->getMeteo()->getRegion(region_id)->setCloudDensity(density_value);
Notice
Cumulonimbus clouds (Cumulonimbus 1, Cumulonimbus 2, Cumulonimbus 3) cannot be controlled by the Coverage parameter due to their specific features — this type of clouds always has finite bounds and cannot be global.

Cloud coverage does not change immediately, it has some transition period providing smoothness. You can adjust transition time by changing value in the cloud_transition_time tag in configuration file (data/ig_config.xml).

Lightning#

Lightning parameters can be found in the LightingProperties property (data/ig/weather/properties/LightingProperties.prop).

The following ones are available for adjustment:

  • Period — interval between the subsequent lightning flashes, in seconds.
  • Emission Params — a set of parameters defining emission properties of the lightning flash:
    • the first two are emission_random_factor_min and emission_random_factor_max — these values define the limits of random flash intensity (min and max deviation from the value of the Emission Scale parameter of the lightning material).
    • emission_period — defines the lifetime of a single flash, in seconds. This value should always be less than the interval between the subsequent flashes.

Precipitations#

To adjust parameters for rain or snow (intensity, size of raindrops/snowflakes, etc.) select the corresponding node on the scene and tweak the parameters of the PrecipitationParams property assigned to it.

The following parameters are available:

  • Minimum Intensity and Maximum Intensity — these values define the limits of random intensity of rain or snow.
  • Minimum Particle Size and Particle Size — these values define size variation for raindrops or snowflakes.
  • Source Node — node representing rain or snow on the scene.
  • Lut Base ImageBase scattering LUT to be used.
  • Lut Mie ImageMie scattering LUT to be used.

Wind#

Particle Systems can be affected by the wind controlled by IG. This is implemented by assigning the ParticlesWind property.

The following parameters are available:

  • Recursive — synchronizes all child particle systems with the parent one, which has this property assigned. Child particle systems don't require this property to be assigned.
  • Gravity Vertical — the gravity value controlling how fast particles will drop.

For your convenience, we have also added the windsock.node asset to the IG Template, it is available in data\ig\objects\windsock\.

This asset is already preconfigured to be affected by the IG wind via the WindSock property.

The following parameters are available:

  • Angle Wind — additional angle rotating the mesh to align it with the wind direction.
  • Mesh Skinned — the windsock mesh.
  • Anim Power — animation of the windsock deformation depending on the wind speed variation.
  • Anim Standing — animation of the windsock rippling.

Weather Change Callbacks#

Sometimes it may be necessary to perform certain actions when weather conditions change (e.g. to set orientation for a windsock or a vane). This can be done using callbacks the same way as for changing sky state. Just implement your specific actions in a callback function and set it as follows:

Weather change callback implementation:

Source code (C++)
/// callback function to be called when weather conditions change
void SomeClass::my_weather_callback()
{
	// setting orientation of the vane downwind
	vec3 wind_direction = ig_manager->getMeteo()->getMeanWindSpeed(vane_node->getWorldPosition());
	vane_node->setWorldDirection(wind_direction, vec3_up);
}

// ...
// somewhere in code
void SomeClass::init()
{
	// adding "my_weather_callback" to be called on changing weather conditions
	ig_manager->getMeteo()->addCallbackMeteoChanged(this, Unigine::MakeCallback(this, &SomeClass::my_weather_callback );
}
Last update: 2021-04-17
Build: ()