Effective talk: Weather simulation in games
Year of Talk: 2022
Video Link: Simulating Tropical Weather in 'Far Cry 6'
Note: There were two presenters for this hour-long talk. This blog contains the first 20 minutes or so which has the first presenter. I will be uploading the second part in the coming weeks. There was a lot of extra information in the second half which required extra information so I may need to create a separate blog containing a lot of context information needed for the second half of the presentation.
When work started on Far Cry 6 they planned on working on some new features not seen previously in previous games.
Inspiration, Core controls, Material wetness, Rendering features, Conclusion
Inspiration:
Drew inspiration from different tropical islands and how weather changes throughout the day and year. From super sunny to thunderstorm.
Wanted to use the sunny picture-perfect scener to contrast the gloomy scenery of thunderstorms and rain.
The ocean is a big factor in weather conditions.
Goals for the weather system:
Convincing weather states
Dynamic weather
Natural transitions
Keep it as efficient as possible in CPU and memory budget
Core Controls:
Weather manager
Contains useful variables and information that control and define the weather.
The back end is the main weather manager while the front end is a collection of exposed settings and variables for artists to affect as a way to change how the weather changes.
Some in-game weather presets: Few Clouds
Broken Clouds
Mist (Light fog)
Fog (Heavy fog)
Light Rain
Moderate Rain
Heavy Rain
Thunderstorm
Weather forecast:
Initially acquired hourly data from real-world cities.
However, the team wanted more design control over the weather.
Set up a looping forecast of weather that lasts up to 5 days.
Depending on the time of day in a region would allow the engine to choose the best weather for that time of day.
Regional weather:
The game has been divided into 3 main sections:
West; Having more dry features
Central; Swampy features
East: Jungle features
This allowed for more versatility for the weather in different areas.
Indoor areas would not allow for fog to spawn as part of the presets.
The weather manager also allows for overriding the weather in case of situations that require specific types of weather. Like missions or some cutscenes.
Weather State flow:
Material Wetness:
Big risk as there are a lot of assets that will need to have wetness applied.
Different groups may have different workflows so it wouldn't be easy to add extra assets to the pipeline.
The solution considered the following things:
A unified solution that is simple to implement.
Principally tech artist driven instead of other artists.
And should work out of the box.
The game consists of two wetness types seen below:
Use cases | Wetness Level | When it's applied | Pros | Cons | |
Static assets | Props and non-movable objects | A wetness map is included as part of the textures | A lighting pass | No unique textures. Simplified to use | No flexibility |
Dynamic assets | Gameplay assets Characters | Local wetness. Raycast | Individual shaders | Wetness can be more dynamically implemented. Customizable visuals with more texture data | More textures and shaders to render at run time. |
Static Wetness:
Calculate static wetness as the wetness factor * wetness shadow factor (What is covering it from getting wet).
The use of porosity helped determine wet areas and how they would be affected when wet. Higher values meant the color/material would darken when it was wet. Like dirt or concrete.
To calculate porosity the following equation is needed: Porosity = PorosityFactors.x * smoothness + PorosityFactors.y
Example materials and how much they would darken if wet:
Examples: | Wood MattePF: (-0.2, 1.0) | Wood GlossyPF: (-0.6, 0.9) | Ceramic GlossyPF: (-0.2, 0.3) | Wood MattePF: (0.0, 0.0) |
Smoothness = 0.0 | 1.0 Fully darkens | 0.9 | 0.3 | 0.0 |
Smoothness = 0.5 | 0.9 | 0.6 | 0.2 | 0.0 |
Smoothness = 1.0 | 0.8 | 0.3 | 0.1 | 0.0 Never darkens |
The main goal was to make the whole scene look pretty good instead of individual assets as this could lead to a lot of excess time spent tweaking assets.
Dynamic Wetness:
A ray cast is performed every so often (Usually just some frames) to check if wet. Vehicles require multiple raycasts instead of one.
The wetness level is meant to increase and decrease gradually.
All the clothing had specific drop-down menus for wetness and included a max smoothness to help show how wet something might look.
Meanwhile, hair only had one set of porosity factors to determine its wetness.
Skin included a wetness mask to help with making it seem more realistic.
Cars and guns had animated rain/wet effects.
Water streaks implemented three (3) different maps. A normal map, a height map, and a scroll map. Allowing for more realistic raindrops. It was only applied to the sides of objects to give the appearance of rain falling.
Water droplets also required three (3) different maps. A normal map, ID map, and height map. Multiple samples are calculated to allow for fading in and out of the water over time.
A problem that would occur is that dynamic water would appear inside cars if there was a common texture both inside and outside of the car.
The solution was to vertex paint the interior to ensure that it wouldn't look wet. Removed when convertibles had top parts active.
A consideration they didn't initially take into account was windshield wipers and this would mean rain would stay on no matter what. Needed to create a gradient mask for the windshield.
Plants and vegetation were initially under static wetness but too high shadowness would occur at times and cause many plants to not get wet. Moved to dynamic wetness and included droplet textures.
For terrain, multiple textures were included to help improve the look of wetness.
Principally textures used include: Albedo, Normal, Smoothness, Porosity
2018 GDC talk: “Terrain Rendering in Far Cry 5” goes more in-depth.
The improved rate at which the floor and terrain would get wet over time. Instead of linearly a more splatter transition was done which included adding droplets to the floor as it would get wetter.
Puddles were created with terrain decals that work in conjunction with porosity.
Two main types of ripples occur in puddles:
Rain and wind.
The rain effect would create circular ripples throughout the puddle to simulate water falling on it.
Meanwhile, the wind effect created small waves as if the wind was pushing the ponds around.
It helps add more movement and effects to the puddle.
Two (2) textures were created to create the effects, one for each effect. Then combines into one texture in RGBA8 256X256. Allowing for more accurate effects that can be animated.
Comments