diff --git a/Shaders/crop.frag b/Shaders/crop.frag index 555e673a2..c3534bc41 100644 --- a/Shaders/crop.frag +++ b/Shaders/crop.frag @@ -9,6 +9,8 @@ uniform sampler3D NoiseTex; uniform sampler2D SampleTex; uniform sampler1D ColorsTex; +varying vec4 constantColor; + uniform float snowlevel; // From /sim/rendering/snow-level-m const float scale = 1.0; @@ -57,7 +59,7 @@ void main (void) 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.0, dot(VNormal, gl_LightSource[0].position.xyz)); - vec4 ambient_light = gl_LightSource[0].diffuse * vec4(diffuse, 1.0); + vec4 ambient_light = constantColor + gl_LightSource[0].diffuse * vec4(diffuse, 1.0); c1 *= ambient_light; vec4 finalColor = c1; diff --git a/Shaders/crop.vert b/Shaders/crop.vert index b5c7314a5..9e70bfa6d 100644 --- a/Shaders/crop.vert +++ b/Shaders/crop.vert @@ -4,6 +4,7 @@ varying vec4 rawpos; varying vec4 ecPosition; varying vec3 VNormal; varying vec3 Normal; +varying vec4 constantColor; void main(void) { @@ -14,6 +15,10 @@ void main(void) VNormal = normalize(gl_NormalMatrix * gl_Normal); Normal = normalize(gl_Normal); - gl_FrontColor = gl_Color; + gl_FrontColor = gl_Color; + + constantColor = gl_FrontMaterial.emission + + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient); + gl_Position = ftransform(); } \ No newline at end of file