1
0
Fork 0

Implement a simple snow shader for the low quality levels

This commit is contained in:
Erik Hofman 2021-01-19 11:10:44 +01:00
parent 0adef7663d
commit 40e871a911
6 changed files with 68 additions and 73 deletions

View file

@ -391,13 +391,42 @@
<texture>Terrain/water.png</texture>
</material>
<material>
<effect>Effects/water-inland</effect>
<name>Stream</name>
<name>Canal</name>
<texture>Terrain/water-lake.png</texture>
<xsize>400</xsize>
<ysize>400</ysize>
<ambient>
<r>0.0</r>
<g>0.0</g>
<b>0.0</b>
<a>1.0</a>
</ambient>
<diffuse>
<r>0.5</r>
<g>0.5</g>
<b>0.5</b>
<a>1.0</a>
</diffuse>
<specular>
<r>0.3</r>
<g>0.3</g>
<b>0.3</b>
<a>1.0</a>
</specular>
<shininess>1.2</shininess>
<solid>0</solid>
<rolling-friction>1.5</rolling-friction>
<bumpiness>0.6</bumpiness>
</material>
<material>
<effect>Effects/water-inland</effect>
<name>Lake</name>
<name>Pond</name>
<name>Reservoir</name>
<name>Stream</name>
<name>Canal</name>
<name>Lagoon</name>
<name>Estuary</name>
<name>Watercourse</name>

View file

@ -193,6 +193,12 @@ float noise_2000m = Noise3D(worldPos.xyz, 2000.0);
if (dist < 1000.0){ noise_term = noise_term + 0.3 * (noise_1m -0.5) * (1.0 - smoothstep(500.0 , 1000.0 , dist) );}
snow_texel.a = snow_texel.a * 0.2+0.8* smoothstep(0.2,0.8, 0.3 +noise_term + snow_thickness_factor +0.0001*(relPos.z +eye_alt -snowlevel) );
}
else if (relPos.z + eye_alt +500.0 > snowlevel && tquality_level > 2)
{
float snow_alpha = 0.5+0.5* smoothstep(0.2,0.8, 0.3 + snow_thickness_factor +0.0001*(relPos.z +eye_alt -snowlevel) );
// texel = vec4(dot(vec3(0.2989, 0.5870, 0.1140), texel.rgb));
texel = mix(texel, vec4(1.0), snow_alpha* smoothstep(snowlevel, snowlevel+200.0, (relPos.z + eye_alt)));
}
if (use_overlay == 1)
{

View file

@ -245,6 +245,12 @@ if (quality_level > 3)
texel = mix(texel, snow_texel, snow_texel.a* smoothstep(snowlevel, snowlevel+200.0, snow_alpha * (relPos.z + eye_alt)+ (noise_2000m + 0.1 * noise_10m -0.55) *400.0));
}
}
else if (relPos.z + eye_alt +500.0 > snowlevel)
{
float snow_alpha = 0.5+0.5* smoothstep(0.2,0.8, 0.3 + snow_thickness_factor +0.0001*(relPos.z +eye_alt -snowlevel) );
// texel = vec4(dot(vec3(0.2989, 0.5870, 0.1140), texel.rgb));
texel = mix(texel, vec4(1.0), snow_alpha* smoothstep(snowlevel, snowlevel+200.0, (relPos.z + eye_alt)));
}

View file

@ -248,6 +248,12 @@ if (quality_level > 3)
texel.rgb = mix(texel.rgb, snow_texel.rgb, snow_texel.a* smoothstep(snowlevel, snowlevel+200.0, snow_alpha * (relPos.z + eye_alt)+ (noise_2000m + 0.1 * noise_10m -0.55) *400.0));
}
}
else if (relPos.z + eye_alt +500.0 > snowlevel)
{
float snow_alpha = 0.1+0.4* smoothstep(0.2,0.8, 0.3 + snow_thickness_factor +0.0001*(relPos.z +eye_alt -snowlevel) );
// texel = vec4(dot(vec3(0.2989, 0.5870, 0.1140), texel.rgb));
texel = mix(texel, vec4(1.0), snow_alpha* smoothstep(snowlevel, snowlevel+200.0, (relPos.z + eye_alt)));
}

View file

@ -279,6 +279,12 @@ if (quality_level > 3)
texel = mix(texel, snow_texel, snow_texel.a* smoothstep(snowlevel, snowlevel+200.0, snow_alpha * (relPos.z + eye_alt)+ (noise_2000m + 0.1 * noise_10m -0.55) *400.0));
}
}
else if (relPos.z + eye_alt +500.0 > snowlevel)
{
float snow_alpha = 0.5+0.5* smoothstep(0.2,0.8, 0.3 + snow_thickness_factor +0.0001*(relPos.z +eye_alt -snowlevel) );
// texel = vec4(dot(vec3(0.2989, 0.5870, 0.1140), texel.rgb));
texel = mix(texel, vec4(1.0), snow_alpha* smoothstep(snowlevel, snowlevel+200.0, (relPos.z + eye_alt)));
}

View file

@ -38,47 +38,6 @@
<hrule/>
<group>
<layout>table</layout>
<default-padding>5</default-padding>
<text>
<row>0</row>
<col>0</col>
<label> Ground Textures:</label>
<halign>left</halign>
</text>
<combo>
<row>0</row>
<col>1</col>
<pref-width>90</pref-width>
<name>season</name>
<halign>left</halign>
<live>true</live>
<property>/sim/startup/season</property>
<value>summer</value>
<value>winter</value>
<binding>
<command>dialog-apply</command>
<object-name>season</object-name>
</binding>
</combo>
<button>
<row>0</row>
<col>2</col>
<legend>Reload Scenery</legend>
<binding>
<command>reinit</command>
<subsystem>scenery</subsystem>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<halign>left</halign>
@ -88,29 +47,13 @@
</text>
<group>
<layout>vbox</layout>
<layout>hbox</layout>
<halign>left</halign>
<text>
<label> </label>
<halign>left</halign>
</text>
<group>
<layout>hbox</layout>
<checkbox>
<label> Climate updates weather</label>
<name>climate-update</name>
<property>/environment/climate/weather-update</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
<checkbox>
<label> Climate updates environment</label>
<name>climate-update</name>
@ -123,7 +66,6 @@
<command>property-toggle</command>
</binding>
</checkbox>
</group>
<checkbox>
<label> Set maximum snow level from weather</label>