Marketplace: Wind System Tumbleweed















This Unreal Marketplace item is a blueprint wind system that 
  • works with physics
  • works with Apex cloth and Speedtree
  • works with particle effects
  • works with simple grass vertex shader
The Unreal Engine's native wind object "Wind directional source" will only affect apex cloth and speedtree objects.
This wind system affects all possible kinds of actors and objects.

Also, the wind affected physical actors are audible when moving or active. It is possible to trigger rolling or swinging movement sounds as also "OnHit" sounds.
The windgusts are also audible.

Contents of this project are:
  • wind actor blueprint logic
  • wind component to hook up to other actors and make them react to wind.
  • 7 different example actor blueprints that make use of the wind
  • 26 sounds used in 8 sound cues
  • 1 skeletal mesh for the apex cloth object
  • 16 textured meshes used for the example wind actors
  • 1 textured landscape with a road, all scene dressed as an example level
  • 56 textures in 16 material instances that derive from 7 base shaders
also it contains
  • 1 modified particle effect from the starter content to show how to use the wind with PFX. This is only meant to be an example and can be changed quickly.

The Windsystem works with a wind actor blueprint that is placed into the level and actors that have a wind component hooked up.
The wind zone is the class that creates the wind force.
To actually have an object react, it needs its wind component and has to set some settings on construct. Below you see the implementation for a tincan.
Since the possible affected wind objects/systems (physical/pfx/cloth/grass) are all different object classes, a few different approaches are needed to project the wind.
For the physical actors, the wind is driven by add force, whilst the windload on each wind affected actor is calculated by the objects projected surface area and the objects material density.

Cloth is driven by a spawned "Wind Directional Source" that is synchronized to the generated blueprint wind.
PFX and the Grass shader take their wind strength directly from the wind curves and go through multipliers.
Where the PFX wind result drives an emitter parameter and the foliage wind goes into a material parameter collection value that drives additional World Position Offsets in the foliage shader.

Explanation videos on how to setup the different object types can be found below






Setting up the wind zone



I forgot to implement a switch to determine a fixed wind direction.
The standard setting is a permanent wind direction change.
To set a fixed direction follow this guide.






Setting up the physical wind actor





Setting up materials to receive wind




Setting up PFX to receive wind




Setting up cloth and speedtree objects to receive wind


No video needed..just throw them into the scene







The Wind Zone

Content\WindSystem\Blueprints\BaseClasses\BP_WindZoneBase


The properties of the wind zone blueprint

The basic features of the wind zone are:

  • set global wind intensities for physical objects, cloth, PFX and grass/vertex shader
  • toggle random wind direction changes
  • modulated wind sound by wind intensity
  • add user created windcurves that define the wind intensities over a timeline. Those windcurves are randomly played one after another.
Additional features of the windzone:
  • Randomly spawn wind affected actors inside the windzone. This is useful for ambient actors like the tumbleweeds.
  • Define the spawned actor amount and set up wind direction changes
  • Spawn from an array of selected actor classes
  • Mask out spawning areas by defining classes where actors are allowed to spawn on. Default is "landscape".





The Wind Component

Content\WindSystem\Blueprints\Components




The wind component has a small feature set.
  • Its meshes angular and linear damping are editable
  • An estimated surface area can be defined. This is used for wind load calculations. A larger value will apply more windforce to the object.
  • A wind movement sound can be set.
  • It has a switch "Is using sound loop" 
    • Looped sounds are used for continuous moving objects, like the tumbleweeds, swinging signs.
      These need to be special sound cues and will be modulated in volume by the objects velocity.
    • "One shot" sounds will typically be used for objects that only collide on impact and do not roll or sway.
      Like lightweight objects that fall over when the wind hits them.


To actually implement the wind into your blueprints, you need at least one physical mesh. And one audio component and the wind component.

Then you'll feed the wind component with those at construct.


The physical mesh should at generate hit event, when you want it to play "one shot" sounds at collision.
Looped sounds don't need this.






The Windcurves

Content\WindSystem\Curves\Weather\Wind

A typical wind curve


A windcurve defines the wind intensity over the length of the curve timeline. The value will be multiplied within the wind zone blueprint.

It should be in a range from 0-1 to not offset the windspeed too much by the final wind multiplier.





Windcurves will be assigned to the windcurve array in the wind zone blueprint and they will be selected randomly one after another. 

You can place as many windcurves as you wish into the array.

The lenght of the timeline is in seconds.




 
The Physical Materials

Content\WindSystem\Materials\_Physical
Properties of a physical material

Each material that is applied to a static mesh inside of a BP_WindActorBase, needs a physical material applied.
It will define the objects density and raise mass to power. These are needed to calculate the windload that projects onto the object.


Important! When your static mesh hosts more than one material, then it is important, that the same physical material is applied to all of the different materials.
Mainly this would be the material that covers most of your object.

An example mesh would be SM_Obj_Sign_Plate_1. It has 2 materials but also the rust material has the PhysMat_WoodHeavy_1 applied.

The reason is, that the surface area of the object would not only apply to the wooden material, but also to the metal. This would lead to a very heavy object that wouldn't react that good to the wind.






try this page for some common densities.
 http://www.psyclops.com/tools/technotes/materials/density.html






The Windload

The windload defines the force
In order to tweak the impact of the wind on an object, you will set values in 2 places.
  • "Estimated Surface Area" in the wind component of the actor.
    • Bigger "surface area" = more wind impact
    • surface area is m² and internally converted to cm²
    • you need to estimate the affected surface area and not use the real sizes
  • "Density" and "Raise mass to power (0-1)" in the physical material that is assigned to the objects material
    • Higher "Density" = less wind impact.
    • Densities are in g/cm³
    • Higher "Raise mass to power" = less wind impact
    • Raise mass to power, when set to 1 it will scale the objects mass linearily with the object scale.
    • Smaller numbers are for objects that are more hollow and will not linearily increase mass when scaled up.

Wind System Scheme
under the hood, the calculation of the wind load is done by the formula:

Fw = 1/2p * v² * A

It is simplified and lacks drag. We only use damping.
The "add force" node are calculated in kg/cm²
Fw = wind force, p = airdensity, v = windvelocity, A = surface area






The SoundCues


Content\WindSystem\Audio\SFX\Collisions\Cues


Looped sounds

A sound cue for a looping sound


https://soundcloud.com/aphexx/movingtumbleweed
This is an example sound of  the sound loop for the tumbleweed

Sound cues are used to play the sounds of your windactors.

If your actor is rolling around or swings in the wind, you want to play a looping sound on it. This sound will play permanently but the objects velocity will modulate its volume. slow movement will produce very low sound volumes.
The wind actor will modulate a parameter inside the soundcue that is called RollSpeed.


The projects examples for looped sound cues are:
  • S_SFX_Chains_Loop_1_Cue
  • S_SFX_CreakChains_Loop_1_Cue
  • S_SFX_Grass_Dry_Loop_1_Cue
  • S_SFX_WoodCreak_Loop_1Cue

"Single Shot" sounds




 Objects that will only fall over and will not roll or be pushed over the ground by the wind should only play so called "single shot" sounds. They are triggered on object impact. 
when an object is fast enough to play a sound on impact, the sound cue will be triggered.
In the best case you have a couple of different sounds to choose from randomly in the soundcue.

The projects example for a single shot sound cue is:
SC_SFX_Tincans_Small_Collide_1_Cue