1
0
Fork 0

New combination of snow and glacier/permanent snow

This commit is contained in:
gral@who.net 2010-08-22 23:05:46 +02:00
parent 1286a77977
commit 10f97d1718
3 changed files with 15 additions and 5 deletions

View file

@ -27,6 +27,8 @@ void main (void)
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale); vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale);
float vegetationlevel = (rawpos.z)+nvL[2]*3000.0;
float fogFactor; float fogFactor;
float fogCoord = ecPosition.z; float fogCoord = ecPosition.z;
const float LOG2 = 1.442695; const float LOG2 = 1.442695;
@ -57,20 +59,27 @@ 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);
//brings vegetation 'floor', added vegetationlevel //brings vegetation 'floor' only at vegetationlevel
float vegetationlevel = (rawpos.z)+nvL[2]*3000.0;
if (vegetationlevel < 2200) { if (vegetationlevel < 2200) {
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.4)); c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.4));
} }
//draw (almost) bare peaks
else { else {
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.1)); c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.1));
} }
//snow //adding snow and permanent snow/glacier
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)); if (vegetationlevel > snowlevel || vegetationlevel > 3300) {
c3 = mix(vec4(n+0.94, n+0.94, n+1.0, 0.7), c1, smoothstep(0.990, 0.965, abs(normalize(Normal).z)+nvL[2]*1.3));
c4 = mix(vec4(n+0.94, n+0.94, n+1.0, 0.7), c1, smoothstep(0.990, 0.965, abs(normalize(Normal).z)+nvL[2]*1.2));
c5 = mix(c3, c4, 1.0);
c1 = mix(c1, c5, clamp(0.65, -n, 0.6));
}
//snow (just white color at the moment)
//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);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 690 KiB

View file

@ -2383,6 +2383,7 @@ Shared parameters for various materials.
<material> <material>
<name>Glacier</name> <name>Glacier</name>
<name>PolarIce</name> <name>PolarIce</name>
<effect>Effects/glacier</effect>
<texture>Terrain/glacier1.png</texture> <texture>Terrain/glacier1.png</texture>
<texture>Terrain/glacier2.png</texture> <texture>Terrain/glacier2.png</texture>
<texture>Terrain/glacier3.png</texture> <texture>Terrain/glacier3.png</texture>