diff --git a/Shaders/transition.frag b/Shaders/transition.frag index 9ecb8b08e..e6df6195e 100644 --- a/Shaders/transition.frag +++ b/Shaders/transition.frag @@ -1,7 +1,7 @@ // -*-C++-*- // Texture switching based on face slope and snow level // based on earlier work by Frederic Bouvier, Tim Moore, and Yves Sablonier. -// © Emilian Huminiuc 2011 +// � Emilian Huminiuc 2011 // Ambient term comes in gl_Color.rgb. varying vec4 diffuse_term, RawPos; @@ -35,7 +35,7 @@ void main() Noise = texture3D(NoiseTex, RawPos.xyz*0.0011); MixFactor = Noise.r * Noise.g * Noise.b; //Mixing Factor to create a more organic looking boundary - MixFactor *= 300; + MixFactor *= 300.0; MixFactor = clamp(MixFactor, 0.0, 1.0); L1 = 0.90 - 0.02 * MixFactor; //first transition slope L2 = 0.78 + 0.04 * MixFactor; //Second transition slope @@ -67,9 +67,9 @@ void main() //pull the texture fetch outside flow control to fix aliasing artefacts :( vec4 baseTexel = texture2D(BaseTex, gl_TexCoord[0].st); - vec4 secondTexel = texture2D(SecondTex, gl_TexCoord[0].st); - vec4 thirdTexel = texture2D(ThirdTex, gl_TexCoord[0].st); - vec4 snowTexel = texture2D(SnowTex, gl_TexCoord[0].st * 2); + vec4 secondTexel = texture2D(SecondTex, gl_TexCoord[0].st); + vec4 thirdTexel = texture2D(ThirdTex, gl_TexCoord[0].st); + vec4 snowTexel = texture2D(SnowTex, gl_TexCoord[0].st); //Normal transition. For more abrupt faces apply another texture (or 2). if (InverseSlope == 0.0) { //Do we do an intermediate transition @@ -123,10 +123,10 @@ void main() texel.rgb = texel.rgb * wetness; - + float altitude = RawPos.z; //Snow texture for areas higher than SnowLevel - if (RawPos.z >= SnowLevel - (1000.0 * slope + 300 * MixFactor) && slope > L2 - 0.12) { - texel = mix(texel, mix(texel, snowTexel, smoothstep(L2 - 0.09 * MixFactor, L2, slope)), smoothstep(SnowLevel - (1000.0 * slope + 300 * MixFactor), SnowLevel - (1000 * slope - 150 * MixFactor), RawPos.z)); + if (altitude >= SnowLevel - (1000.0 * slope + 300.0 * MixFactor) && slope > L2 - 0.12) { + texel = mix(texel, mix(texel, snowTexel, smoothstep(L2 - 0.09 * MixFactor, L2, slope)), smoothstep(SnowLevel - (1000.0 * slope + 300.0 * MixFactor), SnowLevel - (1000.0 * slope - 150.0 * MixFactor), altitude)); } fragColor = color * texel + specular; @@ -139,7 +139,8 @@ void main() } //fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord); + fragColor.rgb *= 1.2 - 0.4 * MixFactor; fragColor.rgb = fog_Func(fragColor.rgb, fogType); //gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor); gl_FragColor = fragColor; - } \ No newline at end of file + } diff --git a/Shaders/ubershader.frag b/Shaders/ubershader.frag index 26addfc47..fb966290b 100644 --- a/Shaders/ubershader.frag +++ b/Shaders/ubershader.frag @@ -69,7 +69,7 @@ void main (void) float pf; ///BEGIN bump - if (nmap_enabled > 0 && shader_qual > 1){ + if (nmap_enabled > 0 && shader_qual > 2){ N = nmap.rgb * 2.0 - 1.0; N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal); if (nmap_dds > 0) @@ -107,7 +107,7 @@ void main (void) //////////////////////////////////////////////////////////////////// //BEGIN reflect //////////////////////////////////////////////////////////////////// - if (refl_enabled > 0 && shader_qual > 0){ + if (refl_enabled > 0 && shader_qual > 1){ float reflFactor; float transparency_offset = clamp(refl_correction, -1.0, 1.0);// set the user shininess offset @@ -115,7 +115,7 @@ void main (void) // map the shininess of the object with user input //float pam = (map.a * -2) + 1; //reverse map reflFactor = reflmap.a + transparency_offset; - } else if (nmap_enabled > 0 && shader_qual > 1) { + } else if (nmap_enabled > 0 && shader_qual > 2) { // set the reflectivity proportional to shininess with user input reflFactor = (gl_FrontMaterial.shininess / 128.0) * nmap.a + transparency_offset; } else { diff --git a/Shaders/ubershader.vert b/Shaders/ubershader.vert index a97a01931..8bca33c6d 100644 --- a/Shaders/ubershader.vert +++ b/Shaders/ubershader.vert @@ -50,7 +50,7 @@ void main(void) fog_Func(fogType); VNormal = normalize(gl_NormalMatrix * gl_Normal); - if (nmap_enabled > 0 && shader_qual > 1){ + if (nmap_enabled > 0 && shader_qual > 2){ VTangent = normalize(gl_NormalMatrix * tangent); VBinormal = normalize(gl_NormalMatrix * binormal); } else {