Global Wind - Affecting physics actors, foliage, wave direction, etc.

I’m working on a project which is largely effected by wind direction and strength. As an example, wind would effect:

  • Water wave direction, wave strength, wave crest foam amount, etc.
  • Foliage
  • Cloth (ship sails, flags)
  • Physics actors (tumble weed, for example)
  • Character (gale force winds should restrict movement against the wind)

I’m struggling to know which approach to take. I’ve built a fairly simple system whereby I can increase and decrease the wind speed (in Knots, and converting to Km/h where needed). I’m later planning to implement this into my ocean blueprint to affect wave intensity based on the Beaufort scale (which I’m already cycling up/down through based on wind speed at the moment).

The biggest issue is that there doesn’t seem to be an easy way to apply force to physics objects in the way wind truly works. The SpeedTree (WindDirectionSource) approach works for SpeedTree foliage. I can output direction and speed into Material Parameter Collections for use in my ocean material(s), but I’m finding it difficult to influence physics actors and the character based on this system as well.

A Radial Force component in my blueprint can apply a constant force to everything, but working with that is confusing, it requires massive values (100,000+) to even show an effect. What unit of measurement is that using? Is there a better way to approach this?

Another thing I’d absolutely love to look into is painting a vector flow map for wind for my world. Basically allowing me to have different wind directions based on the location in the world. I’m not sure how I might approach this. Would it be a case of spawning in thousands of force components in a grid and effecting each based on a texture?

I suppose most of what I’m asking here is help in the theory behind a system like this. Any help or guidance would be greatly appreciated.

Hi there. I am currently thinking about this particular topic too.
My approach would be implementing an interface (Apply Wind Force with an float and Vector as input).
I then create a volume Actor “Wind Area” which calls this Interface function on all overlapping actors (Foliage etc. needs to be catched on BeginPlay with a separate Overlap!) in intervals or on tick

Yeah, that could work! So I would need to divide my level up into “wind area” volumes, and I could set the speed and direction for each wind area volume differently based on a texture representing wind direction at that location in the world, similar to a height-map but with vector information. Could use that same texture in materials as well to change the wave direction of water, for example.

Quite a lot of hoops to jump through here, but perhaps something to experiment with :slight_smile:

Okay, so I’ve looked into the volumes approach. Mostly just setting up that system within the world space. I’ve got the volume grid, and I’m hoping that each box component can sample the direction vector from a flow map like this:

Here is the grid, I’m using arrows to visualise direction:

Is there a function that can sample a vector direction at a position in a texture? My understanding of textures being used in math is pretty limited.

I’ve been working on something similar off-and-on, but I don’t really care about its actual physical simulation, just that it feels like it’s a simulation. I keep track of:

  • Wind heading (which is the rotation around the Z axis grabbed from an X/Y vector – I don’t care much about Z wind modulation and can fake it if I end up needing to). I keep this in two forms:
    • Initial wind heading which is any value between 0-2pi.
    • Min/Max heading waver values which are user-defined; this will ensure that the initial heading is constant while the wavering is within a controlled range.
  • Wind speed.
  • Wind intensity.

(There are also dynamic stuff like gusting, changing weather, cloudiness, etc.). Also, I keep a WindDirectionalSourceComponent in my world simulation as that updates SpeedTree assets. So I keep that in sync.

So, what I do is just:

  • Generate a noise table (GitHub - Auburn/FastNoiseLite: Fast Portable Noise Library - C# C++ C Java(Script) HLSL) – which I can’t remember if it varies over time or is a look-up table (either way, it works well).
  • Store a sample position and a sample step amount.
  • Grab an x, y, z sampled noise value using (X,Y,Z), (Z,X,Y), and (Y,Z,X) – it’s a 3D noise volume, so you could really sample it however you want, but this was quickest for me to deal with early on in this process. And then I calculate the values in some way, shape, or form based on those noise values (ensure that you’re generating a noise table with a nice flow; or use a constant one too, I suppose; mine is random every session).
  • I then store the following in a material parameter collection for use in materials:
    • Wind Intensity (modifies how strongly affected an object is by the wind).
    • Wind Speed (the general speed)
    • Set a Rotator with (0, 0, Heading) – heading being Roll in this case – so I can set my WindDirectionalSource direction. Then I convert the rotator to a quaternion using FRotator::ToAxisAndAngle. Axis gives me the wind directional vector (handy for materials), the angle is just to save me calculating the angle from the vector X/Y in-game. Toss those four values into a linear color and pass it to the material parameter collection.

This is working out for me pretty well so far, anyway.

Hey I have a question associated with this but still new to blueprints I’m try to set up a wind zone that changes on the players overlap. But I’m not sure how to get the wind variables to change properly.

Hello kage16. You can achieve this using the player begin overlap and use a timeline. You then use a lerp node and enter the values you want to change between. For the alpha plug in the track from the timeline. This should do it. It would be the other way around for end overlap