Fixed shader compilation error

This commit is contained in:
Joshua Barretto 2022-01-21 00:50:14 +00:00
parent 5b606f0d50
commit c17abb93f1
2 changed files with 3 additions and 2 deletions

View File

@ -73,7 +73,7 @@ void main() {
#if (CLOUD_MODE != CLOUD_MODE_NONE)
color.rgb = get_cloud_color(color.rgb, dir, cam_pos.xyz, time_of_day.x, dist, 1.0);
#else
color.rgb = apply_point_glow(cam_pos.xyz + focus_off.xyz, dir, dist, color.rgb, BLOOM_FACTOR);
color.rgb = apply_point_glow(cam_pos.xyz + focus_off.xyz, dir, dist, color.rgb);
#endif
tgt_color = vec4(color.rgb, 1);

View File

@ -271,11 +271,12 @@ vec3 get_cloud_color(vec3 surf_color, vec3 dir, vec3 origin, const float time_of
}
#endif
// Underwater light attenuation
if (medium.x == 1) {
float f_alt = alt_at(cam_pos.xy);
float fluid_alt = max(cam_pos.z + 1, floor(f_alt + 1));
float water_dist = clamp((fluid_alt - cam_pos.z) / max(dir.z, 0), 0, max_dist);
float water_dist = clamp((fluid_alt - cam_pos.z) / pow(max(dir.z, 0), 10), 0, max_dist);
//float fade = 1.0 - clamp(water_dist * 0.01, 0, 1);//pow(0.97, water_dist);
float fade = pow(0.98, water_dist);