Added water movement
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
shader_type spatial;
|
||||
render_mode cull_disabled;
|
||||
render_mode specular_toon;
|
||||
// render_mode shadows_disabled;
|
||||
// render_mode wireframe;
|
||||
|
||||
uniform vec3 color : source_color = vec3(0.055, 0.286, 0.62);
|
||||
@ -11,6 +12,8 @@ uniform sampler2D height_map;
|
||||
uniform sampler2D normal_map;
|
||||
uniform float height_scale = 0.0;
|
||||
uniform float noise_scale = 0.5;
|
||||
uniform vec2 wave_direction = vec2(1.0, 1.0);
|
||||
uniform float time_scale : hint_range(0.0, 1.0) = 0.1;
|
||||
|
||||
varying vec2 noise_position;
|
||||
|
||||
@ -19,7 +22,8 @@ float get_fresnel(float power, vec3 normal, vec3 view) {
|
||||
}
|
||||
|
||||
void vertex() {
|
||||
noise_position = VERTEX.xz * noise_scale + 0.5;
|
||||
vec2 wave = TIME * time_scale * wave_direction;
|
||||
noise_position = (wave + VERTEX.xz) * noise_scale + 0.5;
|
||||
float height = texture(height_map, noise_position).x - 0.5;
|
||||
VERTEX.y += height * height_scale;
|
||||
}
|
||||
|
Reference in New Issue
Block a user