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;
}
Tags
animation, grass, movement, wind
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from Darfine

Billboard Sprite3D Sway (Godot 4.0)

Related shaders

2D wind sway

Billboard Sprite3D Sway (Godot 4.0)

Pixel Art Tileset Texture Mapping (Godot 4)

Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
srbisonte
1 year ago

Looks really good , thanks!!

Arovin
Arovin
4 months ago

I am finding the back side of the quad is always darker than the front? Anyway to correct that in the shader? For now I am duplicating the quad and flipping the face.