diff --git a/Effects/forest.eff b/Effects/forest.eff
index 52b2b8ad6..eba84aca1 100644
--- a/Effects/forest.eff
+++ b/Effects/forest.eff
@@ -23,6 +23,7 @@
repeat
normalized
+
@@ -121,6 +122,11 @@
sampler-1d
3
+
+ snowlevel
+ float
+
+
diff --git a/Shaders/forest.frag b/Shaders/forest.frag
index 057b00c12..3d632b537 100644
--- a/Shaders/forest.frag
+++ b/Shaders/forest.frag
@@ -10,11 +10,12 @@ uniform sampler2D SampleTex;
uniform sampler1D ColorsTex;
uniform sampler2D SampleTex2;
+uniform float snowlevel; // From /sim/rendering/snow-level-m
+
const float scale = 1.0;
void main (void)
{
- const float snowlevel=2000.0;
vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000144);
vec4 basecolor2 = texture2D(SampleTex2, rawpos.xy*0.000144);
@@ -55,9 +56,11 @@ void main (void)
c4 = mix(vec4(n-0.88, n-0.74, -n, 0.0), c1, smoothstep(0.990, 0.890, abs(normalize(Normal).z)+nvL[2]*0.9));
c5 = mix(c3, c4, 1.0);
-
//mix floor with texture right way
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.4));
+
+ //snow
+ c1 = mix(c1, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0), smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0));
vec3 diffuse = gl_Color.rgb * max(0.4, dot(VNormal, gl_LightSource[0].position.xyz));
vec4 ambient_light = gl_LightSource[0].diffuse * vec4(diffuse, 1.0);
diff --git a/Shaders/forest.vert b/Shaders/forest.vert
index 29f9ad7d0..631133d09 100644
--- a/Shaders/forest.vert
+++ b/Shaders/forest.vert
@@ -4,7 +4,6 @@ varying vec4 rawpos;
varying vec4 ecPosition;
varying vec3 VNormal;
varying vec3 Normal;
-//varying vec4 constantColor;
void main(void)
{
@@ -16,7 +15,5 @@ void main(void)
Normal = normalize(gl_Normal);
gl_FrontColor = gl_Color;
- //constantColor = gl_FrontMaterial.emission
- // + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
gl_Position = ftransform();
}