diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2022-09-23 09:11:35 -0400 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2022-09-23 09:11:35 -0400 |
commit | a20afe2e211305af26c6a10f307ebf24da44d115 (patch) | |
tree | 2664ce0250af697b83d7e42644bd84b6dea380a2 /water/Wave.gdshader | |
parent | d089c01a602964d2e3b4892e6b5e40c7bbbe725d (diff) | |
download | godot_wildjam_49-a20afe2e211305af26c6a10f307ebf24da44d115.tar.gz godot_wildjam_49-a20afe2e211305af26c6a10f307ebf24da44d115.zip |
Add wave height and speed multipliers for bigger, faster waves
Diffstat (limited to '')
-rw-r--r-- | water/Wave.gdshader | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/water/Wave.gdshader b/water/Wave.gdshader index 06c5327..bf9a744 100644 --- a/water/Wave.gdshader +++ b/water/Wave.gdshader @@ -13,6 +13,8 @@ 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 float wave_size = 1.5; + uniform vec4 water_color : hint_color; uniform vec4 foam_color: hint_color; @@ -71,6 +73,7 @@ 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.y *= wave_size; VERTEX += displacement; NORMAL = normalize(cross(BINORMAL,TANGENT)); } @@ -114,7 +117,7 @@ void fragment() wave_pos *= wave_position(wave2.y,wave2_dir,wave2_t); wave_pos *= wave_position(wave3.y,wave3_dir,wave3_t); wave_pos = 1.0 - (pow(1.0 - wave_pos, foam_amount_crest)); - vec4 foam = texture(foam_map, UV + (-displacement.xz * 0.001)); + vec4 foam = texture(foam_map, UV + (-displacement.xz * 0.005)); vec4 mapped_foam_color = mix(water_color,foam_color,foam.b); vec4 color = mix(water_color, mapped_foam_color, wave_pos); float object_foam = clamp((foam_amount_edge - submersion) / foam_amount_edge, 0.0, 1.0); |