diff --git a/Effects/water.eff b/Effects/water.eff index 49c0a6630..4a886557a 100644 --- a/Effects/water.eff +++ b/Effects/water.eff @@ -11,9 +11,6 @@ normalized - - - Textures/Water/waves-ver10-nm.dds linear-mipmap-linear repeat @@ -21,11 +18,7 @@ normalized - - - - - Textures/Water/water_sine_nmap.dds + Textures/Water/water_sine_nmap.dds linear-mipmap-linear repeat repeat @@ -47,7 +40,6 @@ Textures/Water/perlin-noise-nm.dds - linear-mipmap-linear repeat repeat @@ -77,18 +69,12 @@ /environment/clouds/layer[4]/coverage-type - /environment/sea/surface/wind-from-east-fps /environment/sea/surface/wind-from-north-fps - /environment/wave/freq @@ -109,50 +95,74 @@ - /environment/ground-visibility-m - /environment/visibility-m - /environment/ground-haze-thickness-m - /rendering/scene/scattering - /environment/surface/scattering - /environment/terminator-relative-position-m - /environment/mean-terrain-elevation-m - /rendering/scene/overcast - /sim/rendering/eye-altitude-m + + /environment/ground-visibility-m + + + /environment/visibility-m + + + /environment/ground-haze-thickness-m + + + /rendering/scene/scattering + + + /environment/surface/scattering + + + /environment/terminator-relative-position-m + + + /environment/mean-terrain-elevation-m + + + /rendering/scene/overcast + + + /sim/rendering/eye-altitude-m + /sim/rendering/shaders/skydome - /environment/sea/color_r - /environment/sea/color_g - /environment/sea/color_b + + /environment/sea/color_r + + + /environment/sea/color_g + + + /environment/sea/color_b + - + - - - - /sim/rendering/shaders/skydome - - 4.0 - /sim/rendering/shaders/water - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - + + + + /sim/rendering/shaders/skydome + + 4.0 + /sim/rendering/shaders/water + + + + 2.0 + + + + GL_ARB_shader_objects + GL_ARB_shading_language_100 + GL_ARB_vertex_shader + GL_ARB_fragment_shader + + + + + true @@ -201,10 +211,6 @@ texture[0]/internal-format --> - 2 @@ -297,9 +303,7 @@ - Shaders/water_lightfield.vert - Shaders/water_lightfield.frag - water_normalmap sampler-2d @@ -322,11 +321,6 @@ sampler-2d 3 - sea_foam sampler-2d @@ -341,57 +335,10 @@ saturation float - saturation - - - WindE float @@ -406,13 +353,6 @@ windN - WaveFreq float @@ -458,7 +398,7 @@ - + visibility float @@ -488,10 +428,12 @@ - ground_scattering - float - ground_scattering - + ground_scattering + float + + ground_scattering + + terminator float @@ -499,48 +441,50 @@ terminator - - terrain_alt - float - terrain_alt - - - overcast - float - overcast - - - eye_alt - float - eye_alt - - - - sea_r - float - sea_r - - - sea_g - float - sea_g - - - sea_b - float - sea_b - - - - - - + + + overcast + float + + overcast + + + + eye_alt + float + + eye_alt + + + + + sea_r + float + + sea_r + + + + sea_g + float + + sea_g + + + + sea_b + float + + sea_b + + + @@ -598,6 +542,7 @@ render-bin/bin-name + 0 @@ -616,7 +561,6 @@ texture[0]/internal-format - 2 @@ -709,7 +653,6 @@ - Shaders/water.vert Shaders/include_fog.frag Shaders/water_sine.frag @@ -719,7 +662,6 @@ sampler-2d 0 - water_normalmap sampler-2d @@ -749,7 +691,9 @@ saturation float - saturation + + saturation + CloudCover0 @@ -815,13 +759,6 @@ windN - WaveFreq float @@ -865,9 +802,7 @@ - - - + visibility float @@ -910,7 +845,7 @@ fogtype - + @@ -1075,7 +1010,6 @@ - Shaders/water.vert Shaders/include_fog.frag Shaders/water.frag diff --git a/Shaders/water.frag b/Shaders/water.frag index 2d5345bb8..1a3ee8b60 100644 --- a/Shaders/water.frag +++ b/Shaders/water.frag @@ -4,6 +4,9 @@ // © Michael Horsch - 2005 // Major update and revisions - 2011-10-07 // © Emilian Huminiuc and Vivian Meazza +// Optimisation - 2012-5-05 +// Based on ideas by Thorsten Renk +// © Emilian Huminiuc and Vivian Meazza #version 120 @@ -21,8 +24,6 @@ uniform int Status; varying vec4 waterTex1; //moving texcoords varying vec4 waterTex2; //moving texcoords -varying vec4 waterTex4; //viewts -varying vec4 ecPosition; varying vec3 viewerdir; varying vec3 lightdir; varying vec3 normal; @@ -72,7 +73,7 @@ void main(void) //bool Status = true; - float windEffect = sqrt( WindE*WindE + WindN*WindN ) * 0.6; //wind speed in kt + float windEffect = sqrt( WindE*WindE + WindN*WindN ) * 0.6; //wind speed in kt float windScale = 15.0/(3.0 + windEffect); //wave scale float windEffect_low = 0.3 + 0.7 * smoothstep(0.0, 5.0, windEffect); //low windspeed wave filter float waveRoughness = 0.05 + smoothstep(0.0, 20.0, windEffect); //wave roughness filter @@ -91,7 +92,7 @@ void main(void) } } - vec4 viewt = normalize(waterTex4); + vec4 viewt = vec4(-E, 0.0) * 0.6; vec4 disdis = texture2D(water_dudvmap, vec2(waterTex2 * tscale)* windScale) * 2.0 - 1.0; @@ -122,13 +123,14 @@ void main(void) nmap1 *= windEffect_low; // mix water and noise, modulated by factor vec4 vNorm = normalize(mix(nmap, nmap1, mixFactor) * waveRoughness); - //vNorm.r += ddx; + vNorm = -vNorm; //dds fix //load reflection vec4 tmp = vec4(lightdir, 0.0); vec4 refTex; vec4 refl; + // cover = 0; if(cover >= 1.5){ @@ -163,8 +165,6 @@ void main(void) N1 *= windEffect_low; vec3 N = normalize(mix(Normal + N0, Normal + N1, mixFactor) * waveRoughness); - //N.r += ddx; - //N.g += ddy; N = -N; //dds fix @@ -180,15 +180,6 @@ void main(void) vec4 fres = vec4(1.0) + invfres; refl *= fres; - //calculate the fog factor -// float fogFactor; -// float fogCoord = ecPosition.z; -// const float LOG2 = 1.442695; -// fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2); -// -// if(gl_Fog.density == 1.0) -// fogFactor=1.0; - //calculate final colour vec4 ambient_light = gl_LightSource[0].diffuse; vec4 finalColor; @@ -200,7 +191,6 @@ void main(void) } float foamSlope = 0.10 + 0.1 * windScale; - //float waveSlope = mix(N0.g, N1.g, 0.25); vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 25.0); float waveSlope = N.g; diff --git a/Shaders/water.vert b/Shaders/water.vert index ab6e1b92c..614f84f0e 100644 --- a/Shaders/water.vert +++ b/Shaders/water.vert @@ -9,8 +9,7 @@ varying vec4 waterTex1; varying vec4 waterTex2; -varying vec4 waterTex4; -varying vec4 ecPosition; +//varying vec4 waterTex4; varying vec3 viewerdir; varying vec3 lightdir; @@ -19,53 +18,48 @@ varying vec3 normal; uniform float osg_SimulationTime; uniform float WindE, WindN; -////fog "include"//////// -// uniform int fogType; -// -// void fog_Func(int type); -///////////////////////// - /////// functions ///////// void rotationmatrix(in float angle, out mat4 rotmat) -{ - rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, - sin( angle ), cos( angle ), 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); -} + { + rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, + sin( angle ), cos( angle ), 0.0, 0.0, + 0.0 , 0.0 , 1.0, 0.0, + 0.0 , 0.0 , 0.0, 1.0 ); + } void main(void) -{ - mat4 RotationMatrix; - vec3 N = normalize(gl_Normal); - normal = N; + { + mat4 RotationMatrix; + vec3 N = normalize(gl_Normal); + normal = N; - ecPosition = gl_ModelViewMatrix * gl_Vertex; + vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; - viewerdir = vec3(gl_ModelViewMatrixInverse[3]) - vec3(gl_Vertex); - lightdir = normalize(vec3(gl_ModelViewMatrixInverse * gl_LightSource[0].position)); + viewerdir = vec3(gl_ModelViewMatrixInverse[3]) - vec3(gl_Vertex); + lightdir = normalize(vec3(gl_ModelViewMatrixInverse * gl_LightSource[0].position)); - waterTex4 = vec4( ecPosition.xzy, 0.0 ); + //waterTex4 = vec4(ecPosition.xzy, 0.0 ); - vec4 t1 = vec4(0.0, osg_SimulationTime * 0.005217, 0.0, 0.0); - vec4 t2 = vec4(0.0, osg_SimulationTime * -0.0012, 0.0, 0.0); + vec4 t1 = vec4(0.0, osg_SimulationTime * 0.005217, 0.0, 0.0); + vec4 t2 = vec4(0.0, osg_SimulationTime * -0.0012, 0.0, 0.0); - float Angle; + float Angle; - float windFactor = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.05; - if (WindN == 0.0 && WindE == 0.0) { - Angle = 0.0; - }else{ - Angle = atan(-WindN, WindE) - atan(1.0); - } + float windFactor = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.05; - rotationmatrix(Angle, RotationMatrix); - waterTex1 = gl_MultiTexCoord0 * RotationMatrix - t1 * windFactor; + if (WindN == 0.0 && WindE == 0.0) { + Angle = 0.0; + }else{ + Angle = atan(-WindN, WindE) - atan(1.0); + } - rotationmatrix(Angle, RotationMatrix); - waterTex2 = gl_MultiTexCoord0 * RotationMatrix - t2 * windFactor; + rotationmatrix(Angle, RotationMatrix); + waterTex1 = gl_MultiTexCoord0 * RotationMatrix - t1 * windFactor; -// fog_Func(fogType); - gl_Position = ftransform(); -} \ No newline at end of file + rotationmatrix(Angle, RotationMatrix); + waterTex2 = gl_MultiTexCoord0 * RotationMatrix - t2 * windFactor; + + // fog_Func(fogType); + gl_Position = ftransform(); + } \ No newline at end of file diff --git a/Shaders/water_sine.frag b/Shaders/water_sine.frag index 3cf7ec94b..506782391 100644 --- a/Shaders/water_sine.frag +++ b/Shaders/water_sine.frag @@ -4,6 +4,9 @@ // © Michael Horsch - 2005 // Major update and revisions - 2011-10-07 // © Emilian Huminiuc and Vivian Meazza +// Optimisation - 2012-5-05 +// Based on ideas by Thorsten Renk +// © Emilian Huminiuc and Vivian Meazza #version 120 @@ -23,8 +26,7 @@ uniform int Status; varying vec4 waterTex1; //moving texcoords varying vec4 waterTex2; //moving texcoords -varying vec4 waterTex4; //viewts -//varying vec4 ecPosition; + varying vec3 viewerdir; varying vec3 lightdir; varying vec3 normal; @@ -42,6 +44,8 @@ uniform int fogType; vec3 fog_Func(vec3 color, int type); ////////////////////// +const vec4 AllOnes = vec4(1.0); + /////// functions ///////// void rotationmatrix(in float angle, out mat4 rotmat) @@ -92,7 +96,7 @@ void sumWaves(float angle, float dangle, float windScale, float factor, out floa { mat4 RotationMatrix; float deriv; - vec4 P = waterTex1 * 1024; + vec4 P = waterTex1 * 1024.0; rotationmatrix(radians(angle + dangle * windScale + 0.6 * sin(P.x * factor)), RotationMatrix); P *= RotationMatrix; @@ -139,14 +143,16 @@ void main(void) const float water_shininess = 240.0; + float range = gl_ProjectionMatrix[3].z/(gl_FragCoord.z * -2.0 + 1.0 - gl_ProjectionMatrix[2].z); + // approximate cloud cover float cover = 0.0; //bool Status = true; - float windEffect = sqrt( WindE*WindE + WindN*WindN ) * 0.6; //wind speed in kt - float windScale = 15.0/(3.0 + windEffect); //wave scale - float windEffect_low = 0.3 + 0.7 * smoothstep(0.0, 5.0, windEffect); //low windspeed wave filter - float waveRoughness = 0.01 + smoothstep(0.0, 40.0, windEffect); //wave roughness filter + float windEffect = sqrt( WindE*WindE + WindN*WindN ) * 0.6; //wind speed in kt + float windScale = 15.0/(3.0 + windEffect); //wave scale + float windEffect_low = 0.3 + 0.7 * smoothstep(0.0, 5.0, windEffect); //low windspeed wave filter + float waveRoughness = 0.01 + smoothstep(0.0, 40.0, windEffect); //wave roughness filter float mixFactor = 0.2 + 0.02 * smoothstep(0.0, 50.0, windEffect); //mixFactor = 0.2; @@ -154,68 +160,94 @@ void main(void) // sine waves + // Test data //float WaveFreq =1.0; //float WaveAmp = 1000.0; //float WaveSharp = 10.0; - float angle = 0.0; - wave0.freq = WaveFreq ; - wave0.amp = WaveAmp; - wave0.dir = vec2(cos(radians(angle)), sin(radians(angle))); + vec4 ddxVec = vec4(0.0); + vec4 ddyVec = vec4(0.0); + int detailFlag = 0; - angle -= 45; - wave1.freq = WaveFreq * 2.0 ; - wave1.amp = WaveAmp * 1.25; - wave1.dir = vec2(cos(radians(angle)), sin(radians(angle))); + //uncomment to test + //range = -20000; - angle += 30; - wave2.freq = WaveFreq * 3.5; - wave2.amp = WaveAmp * 0.75; - wave2.dir = vec2(cos(radians(angle)), sin(radians(angle))); + if (range > -15000 || dot(Normal,H) > 0.95 ) { - angle -= 50; - wave3.freq = WaveFreq * 3.0 ; - wave3.amp = WaveAmp * 0.75; - wave3.dir = vec2(cos(radians(angle)), sin(radians(angle))); + float ddx = 0.0, ddy = 0.0; + float ddx1 = 0.0, ddy1 = 0.0; + float ddx2 = 0.0, ddy2 = 0.0; + float ddx3 = 0.0, ddy3 = 0.0; + float waveamp; - // sum waves + float angle = 0.0; - float ddx = 0.0, ddy = 0.0; - sumWaves(WaveAngle, -1.5, windScale, WaveFactor, ddx, ddy); + wave0.freq = WaveFreq ; + wave0.amp = WaveAmp; + wave0.dir = vec2(cos(radians(angle)), sin(radians(angle))); - float ddx1 = 0.0, ddy1 = 0.0; - sumWaves(WaveAngle, 1.5, windScale, WaveFactor, ddx1, ddy1); + angle -= 45; + wave1.freq = WaveFreq * 2.0 ; + wave1.amp = WaveAmp * 1.25; + wave1.dir = vec2(cos(radians(angle)), sin(radians(angle))); - //reset the waves - angle = 0.0; - float waveamp = WaveAmp * 0.75; + angle += 30; + wave2.freq = WaveFreq * 3.5; + wave2.amp = WaveAmp * 0.75; + wave2.dir = vec2(cos(radians(angle)), sin(radians(angle))); - wave0.freq = WaveFreq ; - wave0.amp = waveamp; - wave0.dir = vec2(cos(radians(angle)), sin(radians(angle))); + angle -= 50; + wave3.freq = WaveFreq * 3.0 ; + wave3.amp = WaveAmp * 0.75; + wave3.dir = vec2(cos(radians(angle)), sin(radians(angle))); - angle -= 20; - wave1.freq = WaveFreq * 2.0 ; - wave1.amp = waveamp * 1.25; - wave1.dir = vec2(cos(radians(angle)), sin(radians(angle))); + // sum waves - angle += 35; - wave2.freq = WaveFreq * 3.5; - wave2.amp = waveamp * 0.75; - wave2.dir = vec2(cos(radians(angle)), sin(radians(angle))); + ddx = 0.0, ddy = 0.0; + sumWaves(WaveAngle, -1.5, windScale, WaveFactor, ddx, ddy); - angle -= 45; - wave3.freq = WaveFreq * 3.0 ; - wave3.amp = waveamp * 0.75; - wave3.dir = vec2(cos(radians(angle)), sin(radians(angle))); + ddx1 = 0.0, ddy1 = 0.0; + sumWaves(WaveAngle, 1.5, windScale, WaveFactor, ddx1, ddy1); - float ddx2 = 0.0, ddy2 = 0.0; - sumWaves(WaveAngle + WaveDAngle, -1.5, windScale, WaveFactor, ddx2, ddy2); + //reset the waves + angle = 0.0; + waveamp = WaveAmp * 0.75; - float ddx3 = 0.0, ddy3 = 0.0; - sumWaves(WaveAngle + WaveDAngle, 1.5, windScale, WaveFactor, ddx3, ddy3); + wave0.freq = WaveFreq ; + wave0.amp = waveamp; + wave0.dir = vec2(cos(radians(angle)), sin(radians(angle))); - // end sine stuff + angle -= 20; + wave1.freq = WaveFreq * 2.0 ; + wave1.amp = waveamp * 1.25; + wave1.dir = vec2(cos(radians(angle)), sin(radians(angle))); + + angle += 35; + wave2.freq = WaveFreq * 3.5; + wave2.amp = waveamp * 0.75; + wave2.dir = vec2(cos(radians(angle)), sin(radians(angle))); + + angle -= 45; + wave3.freq = WaveFreq * 3.0 ; + wave3.amp = waveamp * 0.75; + wave3.dir = vec2(cos(radians(angle)), sin(radians(angle))); + + // sum waves + ddx2 = 0.0, ddy2 = 0.0; + sumWaves(WaveAngle + WaveDAngle, -1.5, windScale, WaveFactor, ddx2, ddy2); + + ddx3 = 0.0, ddy3 = 0.0; + sumWaves(WaveAngle + WaveDAngle, 1.5, windScale, WaveFactor, ddx3, ddy3); + + ddxVec = vec4(ddx, ddx1, ddx2, ddx3); + ddyVec = vec4(ddy, ddy1, ddy2, ddy3); + + //toggle detailFlag + detailFlag = 1; + } // end sine stuff + + float ddxSum = dot(ddxVec, AllOnes); + float ddySum = dot(ddyVec, AllOnes); if (Status == 1){ cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4); @@ -228,16 +260,11 @@ void main(void) } } - vec4 viewt = normalize(waterTex4); +// vec4 viewt = normalize(waterTex4); + vec4 viewt = vec4(-E, 0.0) * 0.6; vec4 disdis = texture2D(water_dudvmap, vec2(waterTex2 * tscale)* windScale) * 2.0 - 1.0; - //vec4 dist = texture2D(water_dudvmap, vec2(waterTex1 + disdis*sca2)* windScale) * 2.0 - 1.0; - //dist *= (0.6 + 0.5 * smoothstep(0.0, 15.0, windEffect)); - //vec4 fdist = normalize(dist); - //fdist = -fdist; //dds fix - //fdist *= sca; - //normalmaps vec4 nmap = texture2D(water_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0; vec4 nmap1 = texture2D(perlin_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0; @@ -251,18 +278,21 @@ void main(void) // mix water and noise, modulated by factor vec4 vNorm = normalize(mix(nmap, nmap1, mixFactor) * waveRoughness); - vNorm.r += ddx + ddx1 + ddx2 + ddx3; + vNorm.r += ddxSum; vNorm = -vNorm; //dds fix //load reflection vec4 tmp = vec4(lightdir, 0.0); - vec4 refTex = texture2D(water_reflection, vec2(tmp)) ; - vec4 refTexGrey = texture2D(water_reflection_grey, vec2(tmp)) ; + vec4 refTex = texture2D(water_reflection, vec2(tmp + waterTex1) * 32.0) ; + vec4 refTexGrey = texture2D(water_reflection_grey, vec2(tmp * waterTex1)) ; vec4 refl ; - // cover = 0; + + // Test data + // cover = 0; if(cover >= 1.5){ - refl= normalize(refTex); + refl = normalize(refTex); + refl.a = 1.0; } else { @@ -270,10 +300,9 @@ void main(void) refl.r *= (0.75 + 0.15 * cover); refl.g *= (0.80 + 0.15 * cover); refl.b *= (0.875 + 0.125 * cover); - refl.a *= 1.0; + refl.a = 1.0; } - vec3 N0 = vec3(texture2D(water_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0); vec3 N1 = vec3(texture2D(perlin_normalmap, vec2(waterTex1 + disdis * sca) * windScale) * 2.0 - 1.0); @@ -288,19 +317,24 @@ void main(void) N0 += vec3(texture2D(water_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0); N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca) * windScale) * 2.0 - 1.0); - N0 *= windEffect_low; - N1 *= windEffect_low; + if(detailFlag > 0) + { + N0 *= windEffect_low; + N1 *= windEffect_low; + //N0.r += (ddx + ddx1 + ddx2 + ddx3); + //N0.g += (ddy + ddy1 + ddy2 + ddy3); - N0.r += (ddx + ddx1 + ddx2 + ddx3); - N0.g += (ddy + ddy1 + ddy2 + ddy3); + N0.r += ddxSum; + N0.g += ddySum; - vec3 N = normalize(mix(Normal + N0, Normal + N1, mixFactor) * waveRoughness); + Normal = normalize(mix(Normal + N0, Normal + N1, mixFactor) * waveRoughness); + Normal = -Normal; //dds fix + } - N = -N; //dds fix // specular vec3 specular_color = vec3(gl_LightSource[0].diffuse) - * pow(max(0.0, dot(N, H)), water_shininess) * 6.0; + * pow(max(0.0, dot(Normal, H)), water_shininess) * 6.0; vec4 specular = vec4(specular_color, 0.5); specular = specular * saturation * 0.3 ; @@ -310,15 +344,6 @@ void main(void) vec4 fres = vec4(1.0) + invfres; refl *= fres; - //calculate the fog factor - // float fogFactor; - // float fogCoord = ecPosition.z; - // const float LOG2 = 1.442695; - // fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2); - // - // if(gl_Fog.density == 1.0) - // fogFactor=1.0; - //calculate final colour vec4 ambient_light = gl_LightSource[0].diffuse; vec4 finalColor; @@ -330,41 +355,26 @@ void main(void) } //add foam - - float foamSlope = 0.10 + 0.1 * windScale; - //float waveSlope = mix(N0.g, N1.g, 0.25); - vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 25.0); - float waveSlope = N.g; + if (range > -10000.0){ - if (windEffect >= 8.0) - if (waveSlope >= foamSlope){ - finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.01, 0.50, N.g)); + float foamSlope = 0.1 + 0.1 * windScale; + //float waveSlope = mix(N0.g, N1.g, 0.25); + float waveSlope = Normal.g; + + if (windEffect >= 8.0) + + if (waveSlope >= foamSlope){ + finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), + smoothstep(0.01, 0.50, Normal.g)); } - // float deltaN0 = 1.0 - N0.g; - //float deltaN1 = 1.0 - N1.g; - //if (windEffect >= 8.0){ - // if (N0.g >= foamSlope){ - // if (deltaN0 > 0.8){ - // finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.01, 0.50, N0.g)); - // } else { - // finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.15, 0.25, deltaN0)); - // } - // } - // if (N1.g >= foamSlope){ - // if (deltaN1 > 0.85){ - // finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.01, 0.13, N1.g)); - // } else { - // finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.01, 0.20, deltaN1)); - // } - // } - //} + } // end range - finalColor *= ambient_light; + finalColor *= ambient_light; - //gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor); - finalColor.rgb = fog_Func(finalColor.rgb, fogType); - gl_FragColor = finalColor; + //gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor); + finalColor.rgb = fog_Func(finalColor.rgb, fogType); + gl_FragColor = finalColor; } diff --git a/Textures/Terrain/water.png b/Textures/Terrain/water.png index 54c47eaef..74eaba2d8 100644 Binary files a/Textures/Terrain/water.png and b/Textures/Terrain/water.png differ diff --git a/Textures/Water/water-reflection.png b/Textures/Water/water-reflection.png index 1dbfa27e7..d5d689cc6 100644 Binary files a/Textures/Water/water-reflection.png and b/Textures/Water/water-reflection.png differ