From 6c80e0a55811b7f4409e7572a11c77b2d7d6f5e8 Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Fri, 15 Jul 2011 16:01:37 +0000 Subject: [PATCH] WaterFilter : tracked down missing ".0" in the shaders git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7862 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../core-data/Common/MatDefs/Water/Water.frag | 2 +- .../Common/MatDefs/Water/Water15.frag | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engine/src/core-data/Common/MatDefs/Water/Water.frag b/engine/src/core-data/Common/MatDefs/Water/Water.frag index 2966c0140..928ee2275 100644 --- a/engine/src/core-data/Common/MatDefs/Water/Water.frag +++ b/engine/src/core-data/Common/MatDefs/Water/Water.frag @@ -194,7 +194,7 @@ vec4 underWater(){ specular=specular * m_LightColor.rgb * 100.0; } #endif - float fogIntensity= 8 * m_WaterTransparency; + float fogIntensity= 8.0 * m_WaterTransparency; fogFactor = exp2( -fogIntensity * fogIntensity * cameraDepth * 0.03 * LOG2 ); fogFactor = clamp(fogFactor, 0.0, 1.0); color =mix(m_DeepWaterColor.rgb,refraction,fogFactor); diff --git a/engine/src/core-data/Common/MatDefs/Water/Water15.frag b/engine/src/core-data/Common/MatDefs/Water/Water15.frag index 52f902ce8..64cf280de 100644 --- a/engine/src/core-data/Common/MatDefs/Water/Water15.frag +++ b/engine/src/core-data/Common/MatDefs/Water/Water15.frag @@ -143,10 +143,10 @@ vec4 underWater(int sampleNum){ eyeVecNorm = normalize(m_CameraPosition - surfacePoint); // Find normal of water surface - float normal1 = textureOffset(m_HeightMap, texC, ivec2(-1, 0)).r; - float normal2 = textureOffset(m_HeightMap, texC, ivec2( 1, 0)).r; - float normal3 = textureOffset(m_HeightMap, texC, ivec2( 0, -1)).r; - float normal4 = textureOffset(m_HeightMap, texC, ivec2( 0, 1)).r; + float normal1 = textureOffset(m_HeightMap, texC, ivec2(-1.0, 0.0)).r; + float normal2 = textureOffset(m_HeightMap, texC, ivec2( 1.0, 0.0)).r; + float normal3 = textureOffset(m_HeightMap, texC, ivec2( 0.0, -1.0)).r; + float normal4 = textureOffset(m_HeightMap, texC, ivec2( 0.0, 1.0)).r; vec3 myNormal = normalize(vec3((normal1 - normal2) * m_MaxAmplitude,m_NormalScale,(normal3 - normal4) * m_MaxAmplitude)); vec3 normal = myNormal*-1.0; @@ -196,7 +196,7 @@ vec4 underWater(int sampleNum){ specular=specular * m_LightColor.rgb * 100.0; } #endif - float fogIntensity= 8 * m_WaterTransparency; + float fogIntensity= 8.0 * m_WaterTransparency; fogFactor = exp2( -fogIntensity * fogIntensity * cameraDepth * 0.03 * LOG2 ); fogFactor = clamp(fogFactor, 0.0, 1.0); color =mix(m_DeepWaterColor.rgb,refraction,fogFactor); @@ -288,10 +288,10 @@ vec4 main_multiSample(int sampleNum){ eyeVecNorm = normalize(m_CameraPosition - surfacePoint); // Find normal of water surface - float normal1 = textureOffset(m_HeightMap, texC, ivec2(-1, 0)).r; - float normal2 = textureOffset(m_HeightMap, texC, ivec2( 1, 0)).r; - float normal3 = textureOffset(m_HeightMap, texC, ivec2( 0, -1)).r; - float normal4 = textureOffset(m_HeightMap, texC, ivec2( 0, 1)).r; + float normal1 = textureOffset(m_HeightMap, texC, ivec2(-1.0, 0.0)).r; + float normal2 = textureOffset(m_HeightMap, texC, ivec2( 1.0, 0.0)).r; + float normal3 = textureOffset(m_HeightMap, texC, ivec2( 0.0, -1.0)).r; + float normal4 = textureOffset(m_HeightMap, texC, ivec2( 0.0, 1.0)).r; vec3 myNormal = normalize(vec3((normal1 - normal2) * m_MaxAmplitude,m_NormalScale,(normal3 - normal4) * m_MaxAmplitude)); vec3 normal = vec3(0.0); @@ -412,7 +412,7 @@ void main(){ for (int i = 0; i < m_NumSamples; i++){ color += main_multiSample(i); } - gl_FragColor = color / m_NumSamples; + outFragColor = color / m_NumSamples; #else outFragColor = main_multiSample(0); #endif