This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
Setting Up Properties
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
Extending Editor Functionality
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
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 Optimization
Materials
Art Samples
Tutorials

环境设定

警告
本文介绍的功能在 Community SDK 版本中不可用。
您应该升级到 Sim SDK版本才能使用它。

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.气象模型,无论是在IG或由外部天气模拟供给,提供了云层覆盖,并与方向和强度的全球风概念,影响植被动画和环境。

See Also也可以看看#

  • The IG plugin API section for more details on managing IG via code (C++)IG插件API部分,了解有关通过代码管理IG的更多详细信息(C ++)
  • SkyMap class for more details on managing sky and celestial bodies via code (C++)SkyMap类,以获取有关通过代码管理天空和天体的更多详细信息(C ++)
  • Meteo class for more details on managing global weather settings via code (C++)Meteo类,以获取有关通过代码(C ++)管理全球天气设置的更多详细信息
  • Region class for more details on managing weather regions via code (C++)Region类,以获取有关通过代码管理天气区域的更多详细信息(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.IG使用全年星历模型,会根据日期,时间和地理位置自动更新太阳,月亮和星星的位置。

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:默认情况下,IG为配置为在格林威治时区工作。但是您可以通过更改时区代码通过将以下行添加到AppSystemLogic::init_ig()方法中:

源代码 (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暂时禁用编辑器中的sun节点
  • Open Environment Settings (Windows -> Settings -> Runtime/World/Render/Environment)打开环境设定Windows -> Settings -> Runtime/World/Render/Environment
  • Make sure the Environment Texture is set to star_c.hdr确保将Environment Texture设置为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).单击Environment Color并增加RGB颜色分量的值,直到达到所需的星场亮度(例如,达到100,100,100)。

    注意
    The Alpha channel is used by the system to control Star Intensity (e.g., via CIGI).系统使用Alpha通道来控制恒星强度(例如,通过CIGI)。
  • Enable the sun node back again and save your world.再次启用sun节点并保存您的世界。

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:IG具有内置的天体控件(celestial_control数据包)。为了使用它,您应该具有:

  • Two nodes, one for the Sun, and one for the Moon两个节点,一个用于太阳,一个用于月球
  • The Celestial property assigned to the sun node分配给sun节点的Celestial属性
  • Parameters of the Celestial property containing links to the corresponding nodes.Celestial属性的参数包含指向相应节点的链接。

Positions of the Sun and the Moon are adjusted automatically depending on the date/time and geographic location. 太阳和月亮的位置会根据日期/时间和地理位置自动调整。

SkyMap Change CallbacksSkyMap更改回调#

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:SkyMap更改回调实现:

源代码 (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:IG支持以下天气影响:

  • 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.全球-全球大气状况(atmosphere_control数据包):能见度范围,风速和方向。
  • 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.天气区域-代表某些地区的区域天气。它们具有与天气层相同的一组参数(可见性,覆盖范围,风),但对它们的大气影响仅限于其边界。
注意
  • 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:默认情况下,有5个全球天气图层:

  • Ground Fog — used for ground fog effect simulation.Ground Fog-用于模拟地面雾效果。

    注意
    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 layerCloud Layer 1 —用于模拟第一个云层
  • Cloud Layer 2 — used for simulation of the second cloud layerCloud Layer 2 —用于模拟第二个云层
  • Rain — used for rain simulationRain —用于降雨模拟
  • Snow — used for snow simulationSnow —用于雪地模拟

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.IG当前支持StratocumulusStratus云(根据CIGI规范,类型为910),但是您可以通过继承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:使用接收到的weather_control数据包中的Coverage值自动设置云覆盖,或者您可以通过以下代码手动更改它:

源代码 (C++)
// setting cloud coverage for weather region with a given id
ig_manager->getMeteo()->getRegion(region_id)->setCloudDensity(density_value);
注意
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.积雨云Cumulonimbus 1Cumulonimbus 2Cumulonimbus 3)由于其特定的功能而无法通过Coverage参数进行控制-这种类型的云始终具有有限的边界并且不能是全局的。

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).云的覆盖范围不会立即发生变化,它具有一定的过渡期,可提供平滑性。您可以通过更改以下位置的cloud_transition_time标记中的值来调整过渡时间:配置文件data/ig_config.xml)。

Lightning闪电#

Lightning parameters can be found in the LightingProperties property (data/ig/weather/properties/LightingProperties.prop).可以在LightingProperties属性(data/ig/weather/properties/LightingProperties.prop)中找到闪电参数。

The following ones are available for adjustment:以下内容可供调整:

  • Period — interval between the subsequent lightning flashes, in seconds.Period —后续闪电之间的间隔,以秒为单位。
  • 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).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.emission_period — defines the lifetime of a single flash, in seconds. This value should always be less than the interval between the subsequent flashes.
    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.
    Emission Params —定义雷电发射特性的一组参数:
    • 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_random_factor_minemission_random_factor_max-这些值定义了随机闪光强度的极限(与闪电材料的Emission Scale参数值的最小和最大偏差)。
    • emission_period — defines the lifetime of a single flash, in seconds. This value should always be less than the interval between the subsequent flashes.emission_period —定义单个闪光灯的寿命,以秒为单位。此值应始终小于后续闪烁之间的间隔。

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.要调整降雨或降雪的参数(强度,雨滴/雪花的大小等),请选择场景中的相应节点并调整分配给它的PrecipitationParams属性的参数。

The following parameters are available:可以使用以下参数:

  • Minimum Intensity and Maximum Intensity — these values define the limits of random intensity of rain or snow.Minimum Intensity Maximum Intensity-这些值定义了降雨或降雪的随机强度极限。
  • Minimum Particle Size and Particle Size — these values define size variation for raindrops or snowflakes.Minimum Particle SizeParticle Size-这些值定义雨滴或雪花的大小变化。
  • Source Node — node representing rain or snow on the scene.Source Node —表示场景中的雨或雪的节点。
  • Lut Base ImageBase scattering LUT to be used.Lut Base Image基本散射LUT要使用的。
  • Lut Mie ImageMie scattering LUT to be used.Lut Mie Image三重散射LUT要使用的。

Wind#

Particle Systems can be affected by the wind controlled by IG. This is implemented by assigning the ParticlesWind property.粒子系统可能会受到IG控制的风的影响。这是通过分配ParticlesWind属性来实现的。

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.Recursive —将所有子粒子系统与分配了此属性的父粒子系统同步。子粒子系统不需要分配此属性。
  • Gravity Vertical — the gravity value controlling how fast particles will drop.Gravity Vertical —控制粒子下落速度的重力值。

For your convenience, we have also added the windsock.node asset to the IG Template, it is available in data\ig\objects\windsock\.为了方便起见,我们还将windsock.node资产添加到IG模板中,该资产在data\ig\objects\windsock\中可用。

This asset is already preconfigured to be affected by the IG wind via the WindSock property.此资产已通过WindSock属性预先配置为受IG风影响。

The following parameters are available:可以使用以下参数:

  • Angle Wind — additional angle rotating the mesh to align it with the wind direction.Angle Wind —旋转网格以使其与风向对齐的附加角度。
  • Mesh Skinned — the windsock mesh.Mesh Skinned —风向袋网格。
  • Anim Power — animation of the windsock deformation depending on the wind speed variation.Anim Power —风向袋变形的动画,取决于风速变化。
  • Anim Standing — animation of the windsock rippling.Anim Standing —风向袋荡漾的动画。

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:有时,当天气条件发生变化时,可能有必要执行某些操作(例如,为风向袋或风向标设定方向)。可以使用与for相同的方法来使用回调改变天空状态。只需在回调函数中实现您的特定操作,然后进行如下设置即可:

Weather change callback implementation:天气变化回调实现:

源代码 (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 );
}
最新更新: 2021-04-29
Build: ()