Fixed light extinction

This commit is contained in:
Joshua Barretto 2022-01-21 18:21:14 +00:00 committed by Imbris
parent 212392a062
commit b94d560a20
2 changed files with 5 additions and 4 deletions

View File

@ -195,11 +195,12 @@ void main() {
// Attenuate sunlight
if (medium.x == 1) {
float fluid_alt = max(f_pos.z + 1, floor(f_alt + 1));
vec3 cam_attenuation = compute_attenuation_point(cam_pos.xyz, view_dir, MU_WATER, fluid_alt, f_pos);
vec3 attenuate = pow(vec3(0.0, 0.98, 0.99), vec3(max(fluid_alt - cam_pos.z, 0)));
float water_dist = max(fluid_alt - f_pos.z, 0);
vec3 attenuate = pow(vec3(0.5, 0.98, 0.99), vec3(water_dist * 0.1));
emitted_light *= attenuate;
reflected_light *= attenuate;
surf_color *= attenuate;
}
#endif

View File

@ -89,9 +89,9 @@ void main() {
// Attenuate sunlight
if (medium.x == 1) {
float fluid_alt = max(f_pos.z + 1, floor(f_alt + 1));
vec3 cam_attenuation = compute_attenuation_point(cam_pos.xyz, view_dir, MU_WATER, fluid_alt, f_pos);
vec3 attenuate = pow(vec3(0.0, 0.98, 0.99), vec3(max(fluid_alt - cam_pos.z, 0)));
float water_dist = max(fluid_alt - f_pos.z, 0);
vec3 attenuate = pow(vec3(0.5, 0.98, 0.99), vec3(water_dist * 0.1));
emitted_light *= attenuate;
reflected_light *= attenuate;
}