Here you will find our inhouse modifications to the standard CryENGINE weather system, as well as some wishlist of future upgrades.
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
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)
Defined in ToD.
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?)
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
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
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.
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.
<Name>weather_example</Name> (layer profile name)
<Temperature> (in Celsius)
<RainIntensity> (0 = not raining, 1 = heavy rain)
<WindVelocity> (in m/s)
<TimeOfDay> (in hours)
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
- 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)