2024-02-08 23:46:03 +01:00

37 lines
847 B
Plaintext

shader_type spatial;
render_mode cull_disabled;
render_mode diffuse_lambert_wrap;
//render_mode diffuse_lambert;
//render_mode diffuse_burley;
//render_mode diffuse_toon;
//render_mode unshaded;
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);
NORMAL = vec3(0.0, 1.0, 0.0);
//if (!FRONT_FACING) {
//NORMAL = -NORMAL;
//}
//ALPHA = 1.0 - UV.y * UV.y;
}