28 lines
806 B
Plaintext
28 lines
806 B
Plaintext
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;
|
|
}
|