Topdown wind shader
Topdown windy plants shader
Then used OpenSimplexNoise to provide the wind to the plants
Shader code
shader_type canvas_item;
render_mode blend_mix;
// Wind settings.
uniform vec2 wind = vec2(0, 0);
uniform float heightOffset : hint_range(0.0, 1.0);
void vertex() {
vec4 pos = WORLD_MATRIX * vec4(0.0, 0.0, 0.0, 1.0);
VERTEX.x += wind.x * max(0.0, (1.0-UV.y) - heightOffset);
VERTEX.y += wind.y * max(0.0, (1.0-UV.y) - heightOffset);
}
I changed it to version 4.0 and made it sway left and right
zhangxuetu niu
No idea how it works, no explanation at all.
animate the “shader parameters” values in an AnimationPlayer, “Wind” is the direction of the wind and how strong the movement will be, and “HeightOffset” is the movement itself that you will animate.