add wind fade in/out + add wire movement when is windy
This commit is contained in:
@@ -6,19 +6,24 @@ 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;
|
||||
global uniform float global_wind_fade;
|
||||
|
||||
void vertex() {
|
||||
//COLOR.r is the drawing. 0 -> lampost (no move); 1.0 is the center of the wire
|
||||
float movement = COLOR.r;
|
||||
float wind_amount = global_wind_strength * global_wind_fade;
|
||||
|
||||
//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;
|
||||
float vertical_wave = 0.0;
|
||||
if (global_wind_speed > 0.0 && wind_amount > 0.0) {
|
||||
wind_wave = sin(TIME * global_wind_speed + NODE_POSITION_WORLD.x * 0.5 + NODE_POSITION_WORLD.z * 0.35) * wind_amount;
|
||||
vertical_wave = sin(TIME * global_wind_speed * 0.7 + NODE_POSITION_WORLD.z * 0.35) * wind_amount;
|
||||
}
|
||||
|
||||
VERTEX.x += wind_wave * 0.1 * movement;
|
||||
VERTEX.z += wind_wave * 0.05 * movement;
|
||||
VERTEX.x += wind_wave * 0.28 * movement;
|
||||
VERTEX.y += vertical_wave * 0.125 * movement;
|
||||
VERTEX.z += wind_wave * 0.24 * movement;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
|
||||
Reference in New Issue
Block a user