diff --git a/TODO b/TODO index 502c2f3..8205520 100644 --- a/TODO +++ b/TODO @@ -14,7 +14,6 @@ Technology Preview 2 : => Covering texture height should inpact terrain height. => Add texture shadowing. - Clouds should keep distance to ground. -- Apply depth filtering to water preview. - Fix rendering when inside a cloud layer, with other upper or lower layers. - Improve cloud rendering precision (and beware of precision discontinuity when rendering clouds in front of ground (shorter distance)). - Translations. diff --git a/gui_qt/formwater.cpp b/gui_qt/formwater.cpp index ea50605..d01da4a 100644 --- a/gui_qt/formwater.cpp +++ b/gui_qt/formwater.cpp @@ -168,6 +168,21 @@ private: result.hit_location.x = x; result.hit_location.y = y; result.hit_location.z = 0.0; + + if (result.hit_location.y < 0.0) + { + if (result.hit_location.y < -renderer->water->definition->lighting_depth) + { + result.hit_color = COLOR_BLACK; + } + else + { + double attenuation = -result.hit_location.y / renderer->water->definition->lighting_depth; + result.hit_color.r *= 1.0 - attenuation; + result.hit_color.g *= 1.0 - attenuation; + result.hit_color.b *= 1.0 - attenuation; + } + } } return result;