Simple wind sway

Made with Godot 4.3

A somewhat very very short and simple wind sway effect

(Im trying to add gif to show how good is it but bruh it uploading sooo looooong TvT)

Shader code
shader_type spatial;
render_mode cull_disabled, depth_draw_always, depth_prepass_alpha;

// what a gentle wind
uniform float wind_strength : hint_range(0.0, 2.0) = 0.2;
uniform float wind_speed : hint_range(0.0, 10.0) = 1.0;
uniform vec3 wind_direction = vec3(1.0, 0.0, 0.0);

uniform vec4 base_color : source_color = vec4(1.0, 1.0, 1.0, 1.0);

void vertex() {
	float sway = sin(VERTEX.x * 0.5 + TIME * wind_speed)
	           + cos(VERTEX.z * 0.5 + TIME * wind_speed * 1.3);
	sway *= 0.5;
	VERTEX += wind_direction * sway * wind_strength;
}

void fragment() {
	ALBEDO = base_color.rgb;
	ALPHA = base_color.a;
}
Tags
grass, leaves, Spatial, 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 TTien63

Threshold – Silhouette effect (Impact frame)

Stylized Cloud as texture

Quad mesh Black hole

Related shaders

3D wind sway shader with wind mask texture controll

vertex paint controlled simple 3D wind sway shader

Pixel Art Wind Sway (MeshInstance3D, Godot 4.0)

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments