Here you will find our inhouse modifications to the standard CryENGINE weather system, as well as some wishlist of future upgrades.
Contents
- 1 New Time of Day (ToD) curves
- 2 ToD blending
- 3 Clouds
- 4 Rain
- 4.1 Rain occluders
- 4.1.1 Rain occluder debug
- 4.2 Rain shelters
- 4.1 Rain occluders
- 5 Weather based particles
- 5.1 WeatherProfiles.xml
- 5.1.1 Remarks
- 5.1 WeatherProfiles.xml
- 6 Environmental Probes
New Time of Day (ToD) curves
- Temperature – could be eventually helpful for controlling particles and other weather phenomenons
- RainProbability – maximum intensity of rain
- WindVelocity – wind velocity
- WindDirection – possibility to determine, mohla by na tvrdo určit kterým směrem fouká vítr, případně by se kolem ní dalo v určitém úhlu dalo randomizovat
ToD blending
Every 4 hours, one of the ToD presets is randomly picked and weather system starts blending into it. Alternatively, this blending process could be triggered from the script (including the possibility to adjust transition speed):
#EnvironmentModule.BlendTimeOfDay("profilename", int(length of transition in seconds), 0)
Clouds
Defined in ToD.
Rain
Our modification to the Vanilla rain system:
- match rain to the clouds
- detect wheter there are clouds above the player
- need to know the denisty of the clouds
- from this, we will compute value LocalCloud <0,1>
- for the Rain entity, we have possibility to separately control rain amount and ground wetness amount, so the ground can dry out slowly after the rain stops etc.
- RainDropsAmount (LocalCloud x RainProbability x 10) – controls the amount of rain drops
- RainDropsSpeed (LocalCloud x RainProbability x 2 + 2) – speed of rain drops
- SplashesAmount (LocalCloud x RainProbability x 3) – simulates splash when the drops hit the ground
- PuddlesRippleAmount (LocalCloud x RainProbability x 8) – controls the power of animated normal map of circles on the puddles
- PuddlesAmount – controls the visibility of puddles
- PuddlesMaskAmount – controls the visibility of puddles
- Wind controls the direction of the rain
- Wet ground reflects probes ( FakeGlossiness a ndFakeReflectionsAmount?)
Rain occluders
We don't want rain to be visible in the interiors, under the shelters etc. To achieve this, you need to check whether the object should occlude rain. Here you can see barn roof with RainOccluder property checked on:
When the roof is very high (church for example), it could happen the occlusion won't work. One might then insert Designer objects witch RainOccluder property checked.
Rain occluder debug
- Set CVars as following:
- In ToD, change weather to foggy_storm and start the game so the rain starts too.
- Observe RainOcclusion debug in the viewport. In the upper left corner, you can see objects rendered as rain occluders; center of the frame is where you' standing. If there is a rain occluder renderend and there is still rain visible, call for help
Rain shelters
When the rain starts, NPCs look for shelter. To know where to look, artist or scripter has to place RainShelter prefabs in the level.
- Go to Prefabs/SmartObjects/RainShelter and select prefab with the number of slots closest to the desired amount (if you need 10 slots, you can place 4+4+2 or pick 20 and then delete the 10 you don't need)
- The more slots the better (idealy there should be slot for every single NPC?)
- Open the prefab you just inserted and move TagPoints (blue balls) one by one under the roofs, shelters, big trees etc.
- Orientation of TagPoints matter – NPC hiding here will face in the direction of the arrow:
- Prefabs are typicaly stored in layer Design/*sector_acronym*/RainShelters
Weather based particles
Particles could be bind to the weather – for example butterflies don't fly in the rain, so whenever the rain with intensity over certain value starts, we want to turn butterfly particles off. Other example: leaves starts to fall down off the trees in stronger wind etc.
How to achieve this:
- particles are placed into extra layers and these layers are then encapsulated in Layer Profiles.
- whether the particular layer is on or off is driven by WeatherProfiles.xml located in level\LevelData
In general, we could bind many other objects (whatever fits into the layer) to the weather. However given the mechanism via showing/hiding layer, abrupt showing/hiding brushes for example would be very disturbing. This is an advantage of particles - they can have slow fade in and fade out, which looks very natural.
WeatherProfiles.xml
The layer profile is automatically enabled when all the conditions set in the Param tags are true, and disabled when one or more Param is false. The Params are defined as intervals. Three Params are supported: Temperature (0–40 in degrees of Celsius), RainIntensity (0–1), WindVelocity (0–100 m/s) and TimeOfDay (0–24 h). You don't have to set all the Params.
<WeatherProfile>
<Name>weather_example</Name> (layer profile name)
<Temperature> (in Celsius)
<Min>0</Min>
<Max>40</Max>
</Temperature>
<RainIntensity> (0 = not raining, 1 = heavy rain)
<Min>0</Min>
<Max>1</Max>
</RainIntensity>
<WindVelocity> (in m/s)
<Min>0</Min>
<Max>100</Max>
</WindVelocity>
<TimeOfDay> (in hours)
<Min>0</Min>
<Max>24</Max>
</TimeOfDay>
</WeatherProfile>
Remarks
Layer deactivation is delayed to leave the particles enough time to disappear. This delay can be controlled by CVar: wh_env_WeatherLayerTimout (in seconds). Layer activation is instant.
Layer activation/deactivation will not work in the Editor until you enable:
- RollupBar -> Terrain -> Environment -> Use layers activation ☑
- CVar: e_ObjectLayersActivation 1
- Enable "Default Loaded" in Layer settings for all weather layers
Environmental Probes
To Do:
- Local miltuplier probes for different ToD
- Every probe will have some RGB value to be multiplied with for different ToD
- Could be set by hand from some prepared set
- Could ne calculated from baking in different ToDs (time consuming)