add option to world uv shader, scale checker grass
This commit is contained in:
parent
8ab5f5de3e
commit
ffc1935570
4 changed files with 22 additions and 11 deletions
|
@ -2,13 +2,14 @@ shader_type spatial;
|
||||||
|
|
||||||
uniform sampler2D albedo_texture : repeat_enable, filter_nearest, source_color;
|
uniform sampler2D albedo_texture : repeat_enable, filter_nearest, source_color;
|
||||||
uniform vec2 horizontal_uv_offset = vec2(0.0);
|
uniform vec2 horizontal_uv_offset = vec2(0.0);
|
||||||
|
uniform vec2 uv_scale = vec2(1.0);
|
||||||
|
|
||||||
void vertex() {
|
void vertex() {
|
||||||
vec3 world_position = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
|
vec3 world_position = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
|
||||||
vec3 world_normal = (MODEL_NORMAL_MATRIX * NORMAL).xyz;
|
vec3 world_normal = (MODEL_NORMAL_MATRIX * NORMAL).xyz;
|
||||||
vec2 uv_y = world_position.xz + horizontal_uv_offset;
|
vec2 uv_y = world_position.xz + horizontal_uv_offset;
|
||||||
//vec3 normal_weights = world_normal / (world_normal.x + world_normal.y + world_normal.z);
|
//vec3 normal_weights = world_normal / (world_normal.x + world_normal.y + world_normal.z);
|
||||||
UV = mix(UV, uv_y, abs(world_normal.y));
|
UV = mix(UV, uv_y * uv_scale, abs(world_normal.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
void fragment() {
|
void fragment() {
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 2.1 KiB |
File diff suppressed because one or more lines are too long
|
@ -8,6 +8,7 @@
|
||||||
render_priority = 0
|
render_priority = 0
|
||||||
shader = ExtResource("1_2mr0t")
|
shader = ExtResource("1_2mr0t")
|
||||||
shader_parameter/horizontal_uv_offset = Vector2(0, 0)
|
shader_parameter/horizontal_uv_offset = Vector2(0, 0)
|
||||||
|
shader_parameter/uv_scale = Vector2(1, 1)
|
||||||
shader_parameter/albedo_texture = ExtResource("1_yg8om")
|
shader_parameter/albedo_texture = ExtResource("1_yg8om")
|
||||||
|
|
||||||
[node name="SandPit" type="CSGPolygon3D" node_paths=PackedStringArray("collision_polygon")]
|
[node name="SandPit" type="CSGPolygon3D" node_paths=PackedStringArray("collision_polygon")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue