Anyone has any idea on how do to something like this in Urho?
Both Lumak and Eugene have excellent examples here:
I hope those are helpful
Lumak seems to be manipulating the vertices directly: https://github.com/Lumak/Urho3D-Geom-Replication/blob/master/Source/Samples/62_GeomReplicator/StaticScene.cpp#L265
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
Unfortunately, my shader-writing skills go as far as UE4’s material editor allows me.
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: https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch16.html
@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:
- Main wind controls tree bending caused by wind.
main_wind = main_magnitude + oscillation_magnitude * wave_function(time * oscillation_frequency)
- Turbulence controls branches waving up-down.
- Foliage waving is somehow computed…
Then, vertex parameters:
- Base magnitude controls the influence of main wind. Magnitude is zero at the ground.
- Turbulence magnitude and frequency control the influence of turbulence wind. Magnitude is zero at the trunk.
- Foliage oscillation magnitude and frequency control the intensity of leaves trembling. Magnitude is zero at the branch.
- 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.
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.
I’m using CryEngine’s technique for painting wind effect strength on vertexes: http://docs.cryengine.com/display/SDKDOC2/Detail+Bending
I’ m going to try to modify the mushroom to read that info when applying wind. Thanks for the tip.
Are you solve your problem?
I interested to know what result!
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…