Moved shaders
This commit is contained in:
11
client/world/grass/grass_material.tres
Normal file
11
client/world/grass/grass_material.tres
Normal file
@ -0,0 +1,11 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://bdsblfaxbipaa"]
|
||||
|
||||
[ext_resource type="Shader" path="res://world/grass/grass_shader.gdshader" id="1_7qi6v"]
|
||||
|
||||
[resource]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_7qi6v")
|
||||
shader_parameter/color_bottom = Color(0.0156863, 0.654902, 0.501961, 1)
|
||||
shader_parameter/color_top = Color(0.592157, 0.917647, 0.368627, 1)
|
||||
shader_parameter/wind = Vector3(0.1, 0, 0.1)
|
||||
shader_parameter/wind_speed = Vector3(1, 0, 1)
|
28
client/world/grass/grass_shader.gdshader
Normal file
28
client/world/grass/grass_shader.gdshader
Normal file
@ -0,0 +1,28 @@
|
||||
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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user