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 vec2 horizontal_uv_offset = vec2(0.0);
|
||||
uniform vec2 uv_scale = vec2(1.0);
|
||||
|
||||
void vertex() {
|
||||
vec3 world_position = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
|
||||
vec3 world_normal = (MODEL_NORMAL_MATRIX * NORMAL).xyz;
|
||||
vec2 uv_y = world_position.xz + horizontal_uv_offset;
|
||||
//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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue