29 lines
649 B
Plaintext
29 lines
649 B
Plaintext
shader_type spatial;
|
|
render_mode shadows_disabled, cull_disabled;
|
|
|
|
uniform vec3 color_bottom : source_color;
|
|
uniform vec3 color_top : source_color;
|
|
uniform vec3 wind = vec3(0.1, 0.0, 0.1);
|
|
uniform vec3 wind_speed = vec3(1.0, 0.0, 1.0);
|
|
|
|
void vertex() {
|
|
float distance_to_ground = 1.0 - UV.y;
|
|
|
|
vec4 sway = vec4(
|
|
sin(NODE_POSITION_WORLD.x + TIME * wind_speed.x) * distance_to_ground * wind.x,
|
|
0.0,
|
|
cos(NODE_POSITION_WORLD.z + TIME * wind_speed.z) * distance_to_ground * wind.z,
|
|
1.0
|
|
);
|
|
|
|
VERTEX += (sway * MODEL_MATRIX).xyz;
|
|
}
|
|
|
|
void fragment() {
|
|
ALBEDO = mix(color_top, color_bottom, UV.y);
|
|
|
|
if (!FRONT_FACING) {
|
|
NORMAL = -NORMAL;
|
|
}
|
|
}
|