Vegetation movement with wind

Anyone has any idea on how do to something like this in Urho?

Hey there!

Both Lumak and Eugene have excellent examples here:

I hope those are helpful :slight_smile:

Lumak seems to be manipulating the vertices directly:

Wouldn’t that be more efficient as a vertex shader?

You’re probably right and you’d be better off using Eugene’s procedural vegetation for your needs. My repo, as the title implies, focuses on geom replication as to avoid creating each grass per node, but can be used for trees, rocks, boxes, w/e you need. This came about after watching someone’s youtube vid of implementing thousands of grass nodes which ran… can’t remember, maybe 15 fps.

But why? I mean, i’m not looking for procedural generation. I’m creating my vegetation assets by hand and i just want to add the wind effect to them.

It’ll be sweet if you can write a shader for the wind effect. I’m looking forward to it :slight_smile:

Unfortunately, my shader-writing skills go as far as UE4’s material editor allows me. :frowning:

I used procedural generation because wind shader requires additional vertex information.
You may try to rewrite my shader or you may generate these vertex data in addition to your geometry.

I’m also planning to add wind in my game too (in a later moment).
I would use the vertex colors to map the displacement weight for the wind, as it seems to happen in here:

@Eugene can you please tell me which additional vertex data you used?

Huh, let me recall…

Wind system was partially stolen from Unity.
The wind consists of the following parts:

  1. Main wind controls tree bending caused by wind.
    main_wind = main_magnitude + oscillation_magnitude * wave_function(time * oscillation_frequency)
  2. Turbulence controls branches waving up-down.
  3. Foliage waving is somehow computed…

Then, vertex parameters:

  1. Base magnitude controls the influence of main wind. Magnitude is zero at the ground.
  2. Turbulence magnitude and frequency control the influence of turbulence wind. Magnitude is zero at the trunk.
  3. Foliage oscillation magnitude and frequency control the intensity of leaves trembling. Magnitude is zero at the branch.
  4. True normal of geometry used to wave leaves. If you don’t use normal hacks for better foliage shading, you may just use normals instead.
1 Like

If you just need basic wind effect on your vegetation, there’s already one example available that comes with the default materials and options in shader (Vegetation.glsl/hlsl), which should be enough, unless you’re looking for something else or better.

1 Like

I’m using CryEngine’s technique for painting wind effect strength on vertexes:

I’ m going to try to modify the mushroom to read that info when applying wind. Thanks for the tip.


Hi @darkirk
Are you solve your problem?
I interested to know what result!
thanks you.

Nope. I’m still learning about shaders and how to read vertex data such as colors painted in Blender. If i have some real progress, i’ll post here.


Thank you @darkirk
I hope you get fast and good progress in those topic…
best regards.