This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
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
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

环境设定

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

源代码 (C++)
ig_manager->getSkyMap()->setTimezone(8);

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: 要使星星看起来更明亮,请执行以下操作:

  • 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. 暂时禁用编辑器中的sun节点
  • Open Environment Settings (Windows -> Settings -> Runtime/World/Render/Environment).打开环境设定Windows -> Settings -> Runtime/World/Render/Environment
  • Set the Environment Texture to stars_c.hdr.确保将Environment Texture设置为star_c.hdr
  • 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).单击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 Callbacks
SkyMap更改回调#

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多个大气层和雾度
  • Sun angle-dependent haze color and density与太阳角度有关的雾度颜色和密度
  • Procedurally generated volumetric clouds程序生成体积云
  • Lightning, rain, snow闪电,雨,雪

Weather simulation is achieved with the set up of the following entities.天气模拟包括三个部分:

  • 全球-全球大气状况(atmosphere_control数据包):能见度范围,风速和方向。
  • 天气层-代表大气层,没有明显的水平边界。在层的垂直范围内的任何位置都可以观察到大气效应。
  • 天气区域-代表某些地区的区域天气。它们具有与天气层相同的一组参数(可见性,覆盖范围,风),但对它们的大气影响仅限于其边界。
注意
  • 天气层天气区域始终优先于全球大气条件(即,全球大气变化不会影响图层或区域内的天气)。
  • 当几个图层和区域重叠时,它们的参数会合并在一起。

天气层风会根据玩家在天气层中的位置来更改全局“动画比例”和“植被动画风”。

默认情况下,有5个全球天气图层:

  • Ground Fog-用于模拟地面雾效果。

    注意
    当前使用环境雾度模拟此效果,该效果取决于天气图层的可见距离。
  • Cloud Layer 1 —用于模拟第一个云层
  • Cloud Layer 2 —用于模拟第二个云层
  • Rain —用于降雨模拟
  • Snow —用于雪地模拟

如果需要,可以添加更多的图层和区域。

乌云#

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.体积云是模拟光吸收的粒子团,在流经时会导致可见度的实际降低。云会在地形上蒙上阴影。


The type of region specify its shape:
IG当前支持StratocumulusStratus云(根据CIGI规范,类型为910),但是您可以通过继承clouds_base的新材质来扩展此集合。

There is always a Global region present in the world. The number of possible regions is unlimited.使用接收到的weather_control数据包中的Coverage值自动设置云覆盖,或者您可以通过以下代码手动更改它:

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

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

闪电#

可以在LightingProperties属性(data/ig/weather/properties/LightingProperties.prop)中找到闪电参数。

以下内容可供调整:

  • Period —后续闪电之间的间隔,以秒为单位。
  • Emission Params —定义雷电发射特性的一组参数:
    • 前两个是emission_random_factor_minemission_random_factor_max-这些值定义了随机闪光强度的极限(与闪电材质的Emission Scale参数值的最小和最大偏差)。
    • emission_period —定义单个闪光灯的寿命,以秒为单位。此值应始终小于后续闪烁之间的间隔。

Precipitations
降水#

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

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

  • Precipitation Type — type of precipitation (rain or snow).Minimum Intensity Maximum Intensity-这些值定义了降雨或降雪的随机强度极限。
  • Emitter Node — particles node that simulates the effect.Minimum Particle SizeParticle Size-这些值定义雨滴或雪花的大小变化。
  • Minimum and Maximum Particles Size — limits for random particles size.Source Node —表示场景中的雨或雪的节点。
  • Minimum and Maximum Spawn Rate — limits for spawn rate value.Lut Base Image基本散射LUT要使用的。
  • 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.
    Lut Mie Image三重散射LUT要使用的。

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.粒子系统可能会受到IG控制的风的影响。这是通过分配ParticlesWind属性来实现的。

可以使用以下参数:

  • Recursive —将所有子粒子系统与分配了此属性的父粒子系统同步。子粒子系统不需要分配此属性。
  • Gravity Vertical —控制粒子下落速度的重力值。

For your convenience, we have also added the windsock.node asset to the IG Template, it is available in ig_data\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 —风向袋荡漾的动画。

天气变化回调#

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

天气变化回调实现:

源代码 (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 );
}
最新更新: 2024-12-13
Build: ()