- Category: Blueprints
- Update: 1.0 (10-09-2020)
- Unreal Engine: 4.23 - 4.25
- Platforms: PC, Console
Infinity Weather is a powerful and clean system designed for weather control in Unreal Engine.
The package is a combination of 7 systems that could be divided into separate packages: wind, displacement, landscape, precipitation, footsteps, fog, post-process now available as a configurable unified system.
- Efficient GPU based precipitation system ( snow, rain, dust ) implemented on single material and mesh. Supports up to 65000 particles per emitter with high performance.
- Render target based ground displacement ( snow, mud, sand, grass), with time-based accumulation. Supported displacement shapes box, cylinder, sphere, capsule, decal, skeletal mesh.
- Landscape material prepared for mixing displacement and dynamic weather.
- Dynamic weather controller
- Post-process effects: waterdrops, frozen, heat haze, glittering, sharpening
- Footsteps system and emitters for snow, rain, mud with audio
- Weather material layer (snow/wet layer)
- Precipitation occlusion map rendered on level for testing collision
- Additional effects rainbow, water puddles
- Wind reactive effects like precipitation, trees, ground dust, flag, bushes, grass
- Virtual texturing and layered landscape materials.
- Volumetric fog system
- Extra mesh creator tool and prototype material pack
- Powerful and easy to use.
The package requires a procedural mesh component to work so make sure that it’s enabled.
I’ve decided to make this project as downloadable content that can be added to the project. Unreal Engine does not support sending config files in downloadable content so users have to add footsteps configuration in the project that uses pack to make it work properly. The process is really simple:
- Open the project configuration Edit->Project Settings
- Select tab Engine->Physics and scroll down
- Add physical surface types: Snow, Sand, Mud, Rock
The package works perfectly with the TPP input config files. if you have used other template then probably you will have to add inputs into your project for package testing:
[/Script/Engine.InputSettings] +AxisMappings=(AxisName="MoveForward",Key=W,Scale=1.000000) +AxisMappings=(AxisName="MoveForward",Key=S,Scale=-1.000000) +AxisMappings=(AxisName="MoveForward",Key=Up,Scale=1.000000) +AxisMappings=(AxisName="MoveForward",Key=Down,Scale=-1.000000) +AxisMappings=(AxisName="MoveRight",Key=A,Scale=-1.000000) +AxisMappings=(AxisName="MoveRight",Key=D,Scale=1.000000) +AxisMappings=(AxisName="Turn",Key=MouseX,Scale=1.000000) +AxisMappings=(AxisName="LookUp",Key=MouseY,Scale=-1.000000)
The package is now ready!
Every user of this package should start by checking all examples delivered with the product. Example maps can be found in the InfinityWeather/Demo/Maps folder.
There are available multiple examples that preset different configurations:
- SnowMap – simple snow effects with lightweight landscape material.
- RainMap – simple rain and mud effects with lightweight landscape material.
- DesertMap – simple desert and sunny weather with lightweight landscape material.
- WorldMap – advanced multi-layered material with mixed landscape effects.
The example character interaction with the Infinity Weather world is implemented in Demo/Mannequin/BP_DemoCharacter by three basic components added to it:
- FootstepComponent – spawns footsteps effect from notifiers
- DisplacementSkeletalComponent – renders shapes for ground displacement
- InfinityWeatherComponent – controls post-process and controller communication.
The most important element of the pack is the InfinityWeather/BP_InfinityWeatherController blueprint that gives the users possibility to control the weather conditions like fog, wind direction, precipitation, and accumulation.
Just drag and drop BP_InfinityWeatherController on your level to start controlling the weather.
Atmosphere effects requires Exponential Height Fog plugged into the BP_InfinityWeatherControllers to work properly. Remembet to polace height fog actor on your map and set the attribute of weather controller.
A list of weather controller attributes looks really simple but its a really powerful tool. For testing try to set some rainy windy weather using parameters like before:
The system can be controlled dynamically with blending between parameters during the game using functions below.
The precipitation system is the most advanced part of this pack. The system is based on single material combined with a single mesh (no Niagara or Cascade). The effect of billboarding is computed in vertex shader in the local space of the camera. That means the system has almost no PCU cost and the system is ultra-fast.
There are few predefined effects in the system (/InfinityWeather/Precipitation/)
The precipitation effect can be used without a weather controller. Drag and drop blueprint of the chosen effect on the map.
A manually placed actor can be configured and limited by the area of precipitation. Users also can use multiple weather types visible locally in some areas of the map. All parameters are described in editor hints.
Users can create your own precipitation effect classes for specific rain/snow configuration by extending the base class and changing attributes. That newly created class will be available on the Precipitation Effect Class list in weather controller.
The /InfinityWeather/Precipitation/BP_InfinityPrecipitationOcclusion is a specific type of actor that contains render target texture used for calculating precipitation collision with the roofs and other meshes. After placing this actor on the scene you will notice that in the area of occlusion map the rain and snow are not rendered under the meshes.
Currently supported is only one occlusion map per level but its planned to implement switching between multiple occlusion maps dynamically.
The wind is based on the integration of multiple effects that react to a simple wind direction vector.
Currently, the wind effects can be controlled globally on the full scene using the Wind Direction vector in BP_InfinityWeatherController.
Most of the objects that react on wind use Environment/Functions/MF_InfinityWind material function that returns all important information about current wind status. Its the simplest way to get global wind data.
List of implemented effects and objects that reacts to the wind force.
- Precipitation direction – Attribute Wind Force in precipitation blueprint scales how much it affects
- Vegetation – MF_WindBush, MF_WindTreeLeafs, MF_WindTreeTrunk, MF_WindGrass nodes in the implements the effects of wind on vegetation.
- Flags – specific implementation of flag material M_Flag.
- Cascade particle emitters (Wind Affected Emitters attribute in Weather Controller is a list of emitters that should use Wind Direction and Wind Intensity parameters to react. (Example Environment/Dust/PS_SnowBlowingLarge)
- Dust – predefined planar dust effects that rotate and fade based on wind direction.
- Grass – MF_WindGrass material node.
- Landscape dust – MF_GroundDust effect on the sandy landscape.
- Clouds shadow – M_CloudsShadow
The BP_InfinityFog actor can be used for changing fog settings in some areas. Fog actor is divided into two parts
- Fog volume – The volumetric shape of fog rendered as overlay mesh.
- Fog atmospherics – Atmospherics settings. When the camera is inside the Fog volume the controller uses those settings to blend into new parameters based on the Weight attribute value.
Currently supported is the only the ellipsoidal shape of fog.
Accumulation is the group of parameters that controls coverage of snow and wetness of meshes that uses the MF_InfinityWeatherSurface node in the master material.
MF_InfinityWeatherSurface is an advanced node that adjusts base color, normal, and roughness values to current weather conditions set by the two basic parameters that are used in the material.
- Weather.Controller.WetSurface – Controls wetness of the surface
- Weather.Controller.SnowySurface – Controls the snow shell on the surface.
An example of use MF_InfinityWeatherSurface is presented in the rocks material M_RockSnowMaterial. Drag and drop rocks mesh(/InfinityWeather/Demo/Environment/Rock/SM_Rock ) on your map to check how weather conditions affect the material. Notice that the combination of wetness and snowy material can result in a nice-looking effect of icy snow.
Additionally, meshes can be painted by vertex color (red channel) to mask the effect on meshes that are hidden under the occluders.
A more detailed description of additional parameters can be found in the landscape and displacement section.
The Infinity Weather system introduces an advanced displacement material system based on render targets.
Basically, 3 elements are needed to make the system work:
- Displacement receiver landscape with the material that supports displacements. (MI_LandscapeSnow/MI_LandscapeMud/MI_LandscapeSand)
- Displacement capture actor placed on map (BP_InfinityDisplacementCapture)
- Displacement mesh actor or component that will affect the ground (BP_DisplacementStaticMeshActor)
The video below shows how to combine all these tools and make it work:
Landscape material is an advanced topic because requires basic knowledge about an unreal material system to inject them into the project.
Example content (Landscape/Materials) comes with a few examples of the landscape configurations to make this step easier. There are simple materials that cover the landscape fully by a single type of displacement:
- M_LandscapeSnow (uses MF_InfinitySnow)
- M_LandscapeMud (uses MF_InfinityMud)
- M_LandscapeSand (uses MF_InfinitySand)
There is also an advanced version of the material that is a combination of all three effects in one landscape. Additionally, the extended version supports the MF_InfnityWeather. Available in two versions virtual texturing and multilayered
Let’s take a look at example Sand (M_LandscapeSand) material used on DesertMap:
The material is a combination of four nodes:
MF_GroundDand – its the base material layer of sand that contains a color map, normal map roughness, etc. It can be replaced by any material for example created from GameTextures/Example Project/Any pack.
- MF_InfinityDisplacement – is a base node that reads displacement render target and returns data from it. As an input, it takes the displacement layer intensity. Its the layer that will be used to paint on the landscape.
- MF_InfinitySand – combines data from displacement and ground layer. Additionally, this node implements some additional effects like coloring displaced ground. There are another two nodes that could be used here to achieve another effect MF_InfinityMud, MF_InfinitySnow.
- MF_InfinityWeather – adding the overlay effect of a wet surface that can be controlled by the weather controller.
BP_InfinityDisplacementCapture actor renders all shapes that affect the displacement map.
- Drag and drop BP_InfinityDisplacementCapture on the map.
- Add the Landscape actor to BP_InfinityDisplacementCapture.GroundMeshes.
it’s an important step to notify the system about the receiver of the displacements.
Select landscape and use the material that supports displacements for example M_LandscapeSand.
- Edit the landscape and paint the layer of displacement on it.
For optimization, displacements are rendered only in the area of the focus point. The focus point is taken from BP_InfinityDisplacementCapture.CaptureActor. If the CaptureActor is null then it uses character Pawn as the focus. If Pawn is null then it uses camera location.
Two types of render targets are defined in the system. Both areas size can be changed in capture displacement actor.
- Capture Render Target – cache shapes around the focus point. Modify the CatureTextureSize attribute.
- World Render Target – combine all cached data and store for landscape. Modify the render target TR_Persistent.resolution.
BP_DisplacementSkeletalComponent is a component that allows building capsule approximation of skeletal mesh that will be interpreted by the displacement capture system.
Adding displacements to your character is really easy:
- Open character blueprint, add BP_DisplacementSkeletalComponent to your character.
- Select “Class Settings” on the top bar and add the BPI_DisplacementShape interface to the list of Implemented Interfaces. It should look as on the screen:
- Now implement the interface function called AddDisplacementShapeData. This function should result in the list of shapes from your BP_DisplacementSkeletalComponent. The simplest possible implementation presented below:
After those few steps character will be detected and ready to work.
The default configuration is prepared for example mannequin but it can be configurated for any character skeleton. If the naming convention of bones in character is not the same as in standard mannequin from ue4 examples then you will have to modify bone names in the displacement presets BP_DisplacementRagdollPreset and BP_DisplacementFootsPreset.
There are two methods of rendering skeletal mesh that should be used depends on the requirements:
- BodyCapsules (UseBodyCapsules) – components of the profile are used as capsules. It’s useful for ragdoll interaction but most of the time can be disabled as optimization.
- UseFastSpheres (UseFastSpheres) – components of the profile are used as fast-moving spheres located between two bones. It makes foot displacements working properly even in very low framerate.
The displacement map rendering is based on ray tracing shapes in the shader to get the best possible efficiency but its also limited to the number of shapes predefined in shaders. The shapes that can displace the ground are defined in the /InfinityWeather/Displacement/Blueprints/Shapes/ folder:
- BP_DisplacementDecal (heightmap mapping on the ground)
All of them can be placed on the map and scaled.
Weather System also supports the advanced footstep system integration based on notifiers placed in animation.
Working with footstep system:
- Add BP_FootstepComponent component to a character. The configuration of components contains default predefined templates of effects and attachments for the mannequin.
- Add BP_FootstepNotify to the animation of walking/running in place when the foot hits the ground. Chose the left or right foot in the properties.
- Add BP_FootstepVolume on your scene and select the preset of footstep that should be spawned inside of the volume.
The engine sometimes wrongly detects the footstep ground because of limited landscape layers blending during ground tracing. Footstep volumes BP_FootstepVolume can solve this problem easily. When the character is inside the volume then the system uses the footstep set in the volume definition so the incorrect footstep effect is overridden.
The priority and Required conditions are taken into account to choose the most relevant footstep effect. It can be even filtered. The example below shows how to config volume on second priority (higher priority more important) that spawns snow and will be visible only when there is at least 0.1% of the weather displacement active.
The BP_InfinityWeatherComponent placed into an actor that contains the camera component will add automatically the post process material and communicate with the weather controller to get info about the current conditions.
- Raindrops and circles show only when the precipitation actor has IneractWeather > 0.0. That means raindrop shows only inside the rain volume.
- Screen raindrops fading after some time. The duration of the fade can be controlled by BP_InfinityWeatherComponent.Rain parameters.
- When the camera is under the cover it’s not getting wet and raindrops are not appearing.
- Freezing and heat haze distortion is calculated locally from the weather controller and fog actor’s atmosphere. (temperature, distortion)
The screen effects are implemented using two post-process materials.
MI_InfinityPreTranslucent – a group of effects rendered before the translucency layer.
- Rain Circles – Enables automatically when rain precipitation is active.
- Distortion – Heat Haze effect that enables when
- Glittering – Experimental disabled effect of glittering rendered on snow and sand.
MI_InfinityPostProcess – a group of effects rendered after the tone-mapping.
- Sharpening – Additional sharpening effect that improves the quality of close objects (can be disabled) by UseSharpening.
- Drops – Animated raindrops on-screen visible only if the camera is exposed to rain.
- Frozen – Frozen screen edges.