summaryrefslogtreecommitdiffstats
path: root/water/Wave.gdshader
diff options
context:
space:
mode:
Diffstat (limited to 'water/Wave.gdshader')
-rw-r--r--water/Wave.gdshader21
1 files changed, 20 insertions, 1 deletions
diff --git a/water/Wave.gdshader b/water/Wave.gdshader
index bf9a744..65743af 100644
--- a/water/Wave.gdshader
+++ b/water/Wave.gdshader
@@ -13,6 +13,18 @@ uniform vec3 wave3 = vec3(0.5,0.5,0.5);
uniform vec2 wave3_dir = vec2(1.0,0.0);
uniform float wave3_t = 0.0;
+uniform vec3 wave4 = vec3(0.5,0.5,0.5);
+uniform vec2 wave4_dir = vec2(1.0,0.0);
+uniform float wave4_t = 0.0;
+
+uniform vec3 wave5 = vec3(0.5,0.5,0.5);
+uniform vec2 wave5_dir = vec2(1.0,0.0);
+uniform float wave5_t = 0.0;
+
+uniform vec3 wave6 = vec3(0.5,0.5,0.5);
+uniform vec2 wave6_dir = vec2(1.0,0.0);
+uniform float wave6_t = 0.0;
+
uniform float wave_size = 1.5;
uniform vec4 water_color : hint_color;
@@ -73,6 +85,9 @@ void vertex()
displacement += gerstner_wave(wave1,wave1_dir,wave1_t,global_vertex,TANGENT,BINORMAL);
displacement += gerstner_wave(wave2,wave2_dir,wave2_t,global_vertex,TANGENT,BINORMAL);
displacement += gerstner_wave(wave3,wave3_dir,wave3_t,global_vertex,TANGENT,BINORMAL);
+ displacement += gerstner_wave(wave4,wave4_dir,wave4_t,global_vertex,TANGENT,BINORMAL);
+ displacement += gerstner_wave(wave5,wave5_dir,wave5_t,global_vertex,TANGENT,BINORMAL);
+ displacement += gerstner_wave(wave6,wave6_dir,wave6_t,global_vertex,TANGENT,BINORMAL);
displacement.y *= wave_size;
VERTEX += displacement;
NORMAL = normalize(cross(BINORMAL,TANGENT));
@@ -113,9 +128,13 @@ void fragment()
float depth = get_depth(SCREEN_UV, DEPTH_TEXTURE, INV_PROJECTION_MATRIX);
float water_depth = -VERTEX.z;
float submersion = depth - water_depth;
- float wave_pos = wave_position(wave1.y,wave1_dir,wave1_t);
+ float wave_pos = 0.0;
+ wave_pos += wave_position(wave1.y,wave1_dir,wave1_t);
wave_pos *= wave_position(wave2.y,wave2_dir,wave2_t);
wave_pos *= wave_position(wave3.y,wave3_dir,wave3_t);
+ wave_pos *= wave_position(wave4.y,wave4_dir,wave4_t);
+ wave_pos *= wave_position(wave5.y,wave5_dir,wave5_t);
+ wave_pos *= wave_position(wave6.y,wave6_dir,wave6_t);
wave_pos = 1.0 - (pow(1.0 - wave_pos, foam_amount_crest));
vec4 foam = texture(foam_map, UV + (-displacement.xz * 0.005));
vec4 mapped_foam_color = mix(water_color,foam_color,foam.b);