Pixel Art Wind Sway (MeshInstance3D, Godot 4.0)
Simple shader that creates wind-like movement.
Works with MeshInstance3D node.
Assets made by:
Cainos: https://cainos.itch.io/pixel-art-top-down-basic
and
Aamatniekss: https://aamatniekss.itch.io/fantasy-knight-free-pixelart-animated-character
Shader code
shader_type spatial;
render_mode cull_disabled, depth_draw_opaque;
uniform sampler2D grass_texture : filter_nearest, source_color;
void vertex(){
NORMAL = vec3(0.0, 1.0, 0.0);
VERTEX.x += sin(NODE_POSITION_WORLD.x + TIME * 1.25 + UV.y) * ( 1.0 - UV.y) * 0.2;
VERTEX.z += cos(NODE_POSITION_WORLD.z + TIME * 0.45 + UV.y) * ( 1.0 - UV.y) * 0.15;
}
void fragment(){
ALBEDO = texture(grass_texture, UV).rgb;
ALPHA = texture(grass_texture, UV).a;
}
Looks really good , thanks!!