improved sand pit material
This commit is contained in:
parent
4a7cc4c401
commit
c7d401a752
2 changed files with 24 additions and 10 deletions
16
assets/shaders/horizontal_world_uv.gdshader
Normal file
16
assets/shaders/horizontal_world_uv.gdshader
Normal file
|
@ -0,0 +1,16 @@
|
|||
shader_type spatial;
|
||||
|
||||
uniform sampler2D albedo_texture : repeat_enable, filter_nearest, source_color;
|
||||
uniform vec2 horizontal_uv_offset = vec2(0.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));
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
ALBEDO = texture(albedo_texture, UV).rgb;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue