fix wind!

This commit is contained in:
2026-04-21 12:40:59 +02:00
parent 7a1ac3b698
commit 9a26a4114b
48 changed files with 2376 additions and 234 deletions

View File

@@ -0,0 +1,27 @@
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_disabled;
//Wire color
uniform vec4 albedo_color : source_color = vec4(0.1, 0.1, 0.1, 1.0);
global uniform float global_wind_strength;
global uniform float global_wind_speed;
void vertex() {
//COLOR.r is the drawing. 0 -> lampost (no move); 1.0 is the center of the wire
float movement = COLOR.r;
//Create a wave (based on position and time to be random)
float wind_wave = 0.0;
if (global_wind_speed > 0.0 && global_wind_strength > 0.0) {
wind_wave = sin(TIME * global_wind_speed + NODE_POSITION_WORLD.x * 0.5) * global_wind_strength;
}
VERTEX.x += wind_wave * 0.1 * movement;
VERTEX.z += wind_wave * 0.05 * movement;
}
void fragment() {
ALBEDO = albedo_color.rgb;
ROUGHNESS = 0.9;
}