More opaque water surface

This commit is contained in:
Joshua Barretto 2019-10-08 12:07:10 +01:00
parent 2171e77fe5
commit 889fd678c6
6 changed files with 8 additions and 8 deletions

View File

@ -29,7 +29,7 @@ out vec4 tgt_color;
void main() {
vec3 light, diffuse_light, ambient_light;
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light);
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light, 1.0);
float point_shadow = shadow_at(f_pos, f_norm);
diffuse_light *= point_shadow;
ambient_light *= point_shadow;

View File

@ -39,7 +39,7 @@ void main() {
vec3 norm = warp_normal(f_norm, f_pos, tick.x);
vec3 light, diffuse_light, ambient_light;
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light);
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light, 0.0);
float point_shadow = shadow_at(f_pos, f_norm);
diffuse_light *= f_light * point_shadow;
ambient_light *= f_light, point_shadow;
@ -60,7 +60,7 @@ void main() {
// 0 = 100% reflection, 1 = translucent water
float passthrough = pow(dot(faceforward(norm, norm, cam_to_frag), -cam_to_frag), 1.0);
vec4 color = mix(vec4(reflect_color, 1.0), vec4(surf_color, 0.5 / (1.0 + diffuse_light * 2.0)), passthrough);
vec4 color = mix(vec4(reflect_color, 1.0), vec4(surf_color, 3.0 / (1.0 + diffuse_light * 2.0)), passthrough);
tgt_color = mix(color, vec4(fog_color, 0.0), fog_level);
}

View File

@ -34,7 +34,7 @@ float get_sun_brightness(vec3 sun_dir) {
return max(-sun_dir.z + 0.6, 0.0);
}
void get_sun_diffuse(vec3 norm, float time_of_day, out vec3 light, out vec3 diffuse_light, out vec3 ambient_light) {
void get_sun_diffuse(vec3 norm, float time_of_day, out vec3 light, out vec3 diffuse_light, out vec3 ambient_light, float diffusion) {
const float SUN_AMBIANCE = 0.0;
vec3 sun_dir = get_sun_dir(time_of_day);
@ -56,7 +56,7 @@ void get_sun_diffuse(vec3 norm, float time_of_day, out vec3 light, out vec3 diff
vec3 sun_chroma = sun_color * sun_light;
light = sun_chroma + PERSISTENT_AMBIANCE;
diffuse_light = sun_chroma * (dot(-norm, sun_dir) * 0.5 + 0.5) + PERSISTENT_AMBIANCE;
diffuse_light = sun_chroma * mix(1.0, dot(-norm, sun_dir) * 0.5 + 0.5, diffusion) + PERSISTENT_AMBIANCE;
ambient_light = vec3(SUN_AMBIANCE * sun_light);
}

View File

@ -17,7 +17,7 @@ const float FADE_DIST = 32.0;
void main() {
vec3 light, diffuse_light, ambient_light;
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light);
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light, 1.0);
float point_shadow = shadow_at(f_pos, f_norm);
diffuse_light *= f_light * point_shadow;
ambient_light *= f_light, point_shadow;

View File

@ -20,7 +20,7 @@ out vec4 tgt_color;
void main() {
vec3 light, diffuse_light, ambient_light;
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light);
get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light, 1.0);
float point_shadow = shadow_at(f_pos, f_norm);
diffuse_light *= f_light * point_shadow;
ambient_light *= f_light * point_shadow;

View File

@ -233,7 +233,7 @@ impl<V: RectRasterableVol<Vox = Block> + ReadVol + Debug> Meshable<TerrainPipeli
offs,
&colors,
|pos, norm, col, ao, light| {
FluidVertex::new(pos, norm, col, light.min(ao), 0.3)
FluidVertex::new(pos, norm, col, light, 0.3)
},
false,
&lights,