From 3d76821f020f988a0a6e22c31a321181d944b7a8 Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Tue, 19 Mar 2013 21:30:32 +0000 Subject: [PATCH] WaterFilter fixed refraction map artifact that was producing black "waves" on the screen borders. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10494 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core-effects/Common/MatDefs/Water/Water.frag | 1 + engine/src/core-effects/Common/MatDefs/Water/Water15.frag | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/engine/src/core-effects/Common/MatDefs/Water/Water.frag b/engine/src/core-effects/Common/MatDefs/Water/Water.frag index 1faaab07a..fd51f16fe 100644 --- a/engine/src/core-effects/Common/MatDefs/Water/Water.frag +++ b/engine/src/core-effects/Common/MatDefs/Water/Water.frag @@ -349,6 +349,7 @@ void main(){ #ifdef ENABLE_REFRACTION texC = texCoord.xy; texC += sin(m_Time*1.8 + 3.0 * abs(position.y)) * (refractionScale * min(depth2, 1.0)); + texC = clamp(texC,0.0,1.0); refraction = texture2D(m_Texture, texC).rgb; #endif diff --git a/engine/src/core-effects/Common/MatDefs/Water/Water15.frag b/engine/src/core-effects/Common/MatDefs/Water/Water15.frag index 55881a0db..c6b2d81aa 100644 --- a/engine/src/core-effects/Common/MatDefs/Water/Water15.frag +++ b/engine/src/core-effects/Common/MatDefs/Water/Water15.frag @@ -348,7 +348,8 @@ vec4 main_multiSample(int sampleNum){ #ifdef ENABLE_REFRACTION // texC = texCoord.xy+ m_ReflectionDisplace * normal.x; texC = texCoord.xy; - texC += sin(m_Time*1.8 + 3.0 * abs(position.y)) * (refractionScale * min(depth2, 1.0)); + texC += sin(m_Time*1.8 + 3.0 * abs(position.y))* (refractionScale * min(depth2, 1.0)); + texC = clamp(texC,0.0,1.0); #ifdef RESOLVE_MS ivec2 iTexC = ivec2(texC * textureSize(m_Texture)); refraction = texelFetch(m_Texture, iTexC, sampleNum).rgb;