1
0
Fork 0

Adding snow and snowlevel adjustement

This commit is contained in:
gral@who.net 2010-08-21 14:27:25 +02:00
parent 5a39f0738c
commit 07c6ffedc0
3 changed files with 11 additions and 5 deletions

View file

@ -23,6 +23,7 @@
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level>
</parameters> </parameters>
<technique n="9"> <technique n="9">
<predicate> <predicate>
@ -121,6 +122,11 @@
<type>sampler-1d</type> <type>sampler-1d</type>
<value type="int">3</value> <value type="int">3</value>
</uniform> </uniform>
<uniform>
<name>snowlevel</name>
<type>float</type>
<value><use>snow-level</use></value>
</uniform>
</pass> </pass>
</technique> </technique>
</PropertyList> </PropertyList>

View file

@ -10,11 +10,12 @@ uniform sampler2D SampleTex;
uniform sampler1D ColorsTex; uniform sampler1D ColorsTex;
uniform sampler2D SampleTex2; uniform sampler2D SampleTex2;
uniform float snowlevel; // From /sim/rendering/snow-level-m
const float scale = 1.0; const float scale = 1.0;
void main (void) void main (void)
{ {
const float snowlevel=2000.0;
vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000144); vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000144);
vec4 basecolor2 = texture2D(SampleTex2, 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)); 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); c5 = mix(c3, c4, 1.0);
//mix floor with texture right way //mix floor with texture right way
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.4)); 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)); 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); vec4 ambient_light = gl_LightSource[0].diffuse * vec4(diffuse, 1.0);

View file

@ -4,7 +4,6 @@ varying vec4 rawpos;
varying vec4 ecPosition; varying vec4 ecPosition;
varying vec3 VNormal; varying vec3 VNormal;
varying vec3 Normal; varying vec3 Normal;
//varying vec4 constantColor;
void main(void) void main(void)
{ {
@ -16,7 +15,5 @@ void main(void)
Normal = normalize(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(); gl_Position = ftransform();
} }