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
Art Samples
Tutorials

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++)
  • Weather Layer class for more details on managing weather layers 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);

Or by using the IG:DateTime window provided by IG Editor Plugin.

Configuring the Star Field#

Star field intensity might seem too 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 set up the stars and make them look brighter do the following:

  1. Temporarily disable the sun node in the IG:DateTime window of the IG Editor Plugin and make sure the Stars intensity is set to high value.
  2. Open Environment Settings (Windows -> Settings -> Runtime/World/Render/Environment).
  3. Set the Environment Texture to stars_c.hdr.
  4. Click Environment Color and increase values of RGB color components until you reach the desired color and brightness of the star field (e.g., to 100,100,100).

    Notice
    The Alpha channel is used by the system to control Star Intensity (e.g., via CIGI).
  5. 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.

Enable the Continuous Time option to make the star field move simulating the Earth rotation.

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. Set the date/time and the Sun and Moon intensity in the IG:DateTime of the IG Editor Plugin.

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
  • Sun angle-dependent haze color and density
  • Procedurally generated volumetric clouds
  • Lightning, rain, snow

Weather simulation is achieved with the set up of:

Weather Regions#

Weather regions represent the shape of weather in certain areas from the top-down view (cyclone, turbulence zone, thunderstorm front). Various custom weather layers can be added to a region on demand.

Weather region


The type of region specify its shape:

  • Global - covers the whole world, has a default global layer
  • Rectangle - rectangular shape
  • Polygon - custom shape

There is always a Global region present in the world. The number of possible regions is unlimited.

Adding and Setting Up Regions in the Editor#

To set up a custom weather region, use the IG:Meteo window of the IG Editor Plugin.

  1. Go to Tools->Image Generator Plugin->Meteo.
  2. Click Add Region and then press the Edit Region button to start editing the newly created region in the world.
  3. Select and use handle nodes in the world to specify the region shape (you can add a cloud layer to see the region boundaries more clearly).
    • The rectangle shape type supports translation and scale of the rectangle regional area.
    • For the polygon shape type the handles can be moved, reordered, added, and deleted. This way you can make a region of any custom shape you require.

Weather Layers#

Weather layers represent atmospheric layers inside a region. Layers comprise a vertical profile of the weather region. Atmospheric effects are observed anywhere within the vertical range of a layer. Each region can have an unlimited number of layers.

Type of layer specify its effect:

  • Base layer - contains only numerical values: temperature, pressure. It also contains parameters for wind and visibility range (haze) which can be seen visually.
  • Cloud layer - contains clouds which can be of various types.
  • Precipitation layer - contains precipitation effects which can be of various types (rain, snow).

When different regions with layers intersect each other, all their parameters are blended together according to CIGI recommendations:

Atmospheric Parameter Blend Type
Temperature Average
Pressure Maximum
Humidity Maximum
Visibility Maximum
Wind Sum of velocity vectors

By default every region has an almost infinite Global layer. You can add more layers if necessary.

Adding and Setting Up Layers in the Editor#

To add a new layer to a region, use the IG:Meteo window of the IG Editor Plugin.

  1. Select the region in the left Regions list and click the required Add Layer button.
  2. Depending on the type of the layer you must specify its properties (see below).

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 supports all types of clouds:

  1. altocumulus
  2. altostratus
  3. cirrocumulus
  4. cirrostratus
  5. cirrus
  6. cumulonimbus
  7. cumulus
  8. nimbostratus
  9. stratocumulus
  10. stratus


You also can extend the default cloud 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 IG Editor Plugin or IG Host.

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

Adjusting Clouds#

To start adjusting clouds in the corresponding layer, select it in the Layers list and specify the required Cloud Type.

Use the Coverage parameter to make clouds appear and stand out in the sky.

Precipitations#

Precipitations start playing via particles when the active camera gets inside the region with the corresponding precipitation layer enabled.

Adjusting Precipitations#

To start adjusting rain or snow precipitations in the corresponding layer, select it in the Layers list and specify the required Precipitation Type.

Don’t forget to adjust the Coverage parameter to make precipitation appear and stand out in the viewport.

To adjust specific parameters for rain or snow (spawn rate, size of raindrops/snowflakes, etc.) select the IG precipitation node in the World Nodes window and tweak the parameters of the PrecipitationEffect property assigned to it.

The following parameters are available:

  • Precipitation Type — type of precipitation (rain or snow).
  • Emitter Node — particles node that simulates the effect.
  • Minimum and Maximum Particles Size — limits for random particles size.
  • Minimum and Maximum Spawn Rate — limits for spawn rate value.
  • Rotation — rotation parameters for particles based on the camera movement.
    • Enabled — enables the particles rotation.
    • Curve — sets the interpolation curve for rotation (linear interpolation when the curve is not specified).
    • Curve Angle Scale — maximum deflection angle.
    • Curve Speed Scale — maximum speed when the maximum deflection angle is achieved.
  • Spawn Increase — spawn increase parameters for particles based on the camera movement speed.
    • Enabled — enables the spawn increase.
    • Curve — sets the interpolation curve for spawn increase (linear interpolation when the curve is not specified).
    • Curve Angle Scale — maximum spawn rate.
    • Curve Speed Scale — maximum speed when the maximum spawn rate is achieved.
  • Velocity Increase — velocity increase parameters for particles based on the camera movement speed.
    • Enabled — enables the velocity increase.
    • Curve — sets the interpolation curve for velocity increase (linear interpolation when the curve is not specified).
    • Curve Angle Scale — maximum velocity.
    • Curve Speed Scale — maximum speed when the maximum velocity is achieved.
  • IGEditor — editable parameters for preview in Editor.
    • Density - particles density.
    • Size - particles size.
    • Reload Track - reloads the track file.

Wind#

Particle Systems (rain, snow, and so on) can be affected by the wind controlled by IG when they get inside a region with wind enabled. Wind also affects the cloud movement in cloud layers.

To adjust the wind, go to IG:Meteo window, select a region and a layer inside of it. Use manipulators to specify the direction and force of the wind inside the layer.

For your convenience, we have also added the windsock.node asset to the IG Template, it is available in ig_data\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.
Last update: 2021-09-29
Build: ()