2024-02-03 23:03:25 +00:00
|
|
|
shader_type spatial;
|
2024-02-08 20:42:16 +00:00
|
|
|
render_mode cull_disabled;
|
|
|
|
render_mode diffuse_lambert_wrap;
|
|
|
|
//render_mode diffuse_lambert;
|
|
|
|
//render_mode diffuse_burley;
|
|
|
|
//render_mode diffuse_toon;
|
|
|
|
//render_mode unshaded;
|
2024-02-03 23:03:25 +00:00
|
|
|
|
|
|
|
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);
|
2024-02-08 20:42:16 +00:00
|
|
|
NORMAL = vec3(0.0, 1.0, 0.0);
|
2024-02-03 23:03:25 +00:00
|
|
|
|
2024-02-08 20:42:16 +00:00
|
|
|
//if (!FRONT_FACING) {
|
|
|
|
//NORMAL = -NORMAL;
|
|
|
|
//}
|
|
|
|
|
|
|
|
//ALPHA = 1.0 - UV.y * UV.y;
|
2024-02-03 23:03:25 +00:00
|
|
|
}
|