From bcee5d5943592584fb39921686301088ecbd1133 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 6 Apr 2012 19:40:37 +0200 Subject: [PATCH] fix areas with only water (no objects below) --- files/water/water.cg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/water/water.cg b/files/water/water.cg index a3393e3bf..bbd42874b 100644 --- a/files/water/water.cg +++ b/files/water/water.cg @@ -59,8 +59,10 @@ void main_fp oColor.a = 1; // Sample screen-space depth map and subtract pixel depth to get the real water depth - float depth1 = tex2D(depthMap, screenCoords).r * far - iDepth; + float depthTex = tex2D(depthMap, screenCoords).r; + float depth1 = depthTex * far - iDepth; depth1 = saturate(depth1 / 500.f); + depth1 = (depthTex == 0 ? 1 : depth1); // Simple wave effect. to be replaced by something better float2 uv1 = iUv + time * float2(0.5, 0);