Runway effect with bumpmap and snow for Atmospheric Light Scattering
This commit is contained in:
parent
28b3d77566
commit
8bcc21263f
2 changed files with 40 additions and 29 deletions
|
@ -56,9 +56,9 @@
|
||||||
<normalmap_dds type="float">0.0</normalmap_dds>
|
<normalmap_dds type="float">0.0</normalmap_dds>
|
||||||
<vertex-program-two-side type="bool">false</vertex-program-two-side>
|
<vertex-program-two-side type="bool">false</vertex-program-two-side>
|
||||||
<cull-face>back</cull-face>
|
<cull-face>back</cull-face>
|
||||||
<wetness>
|
<rnorm>
|
||||||
<use>/environment/rain-norm</use>
|
<use>/environment/rain-norm</use>
|
||||||
</wetness>
|
</rnorm>
|
||||||
|
|
||||||
<!-- BEGIN fog include -->
|
<!-- BEGIN fog include -->
|
||||||
<visibility><use>/environment/ground-visibility-m</use></visibility>
|
<visibility><use>/environment/ground-visibility-m</use></visibility>
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
<lichen_cover_factor><use>/environment/surface/lichen-cover-factor</use></lichen_cover_factor>
|
<lichen_cover_factor><use>/environment/surface/lichen-cover-factor</use></lichen_cover_factor>
|
||||||
<snow_thickness_factor><use>/environment/surface/snow-thickness-factor</use></snow_thickness_factor>
|
<snow_thickness_factor><use>/environment/surface/snow-thickness-factor</use></snow_thickness_factor>
|
||||||
<wetness><use>/environment/surface/wetness</use></wetness>
|
<wetness><use>/environment/surface/wetness</use></wetness>
|
||||||
<fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
|
<fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
|
||||||
<fogstructure><use>/environment/fog-structure</use></fogstructure>
|
<fogstructure><use>/environment/fog-structure</use></fogstructure>
|
||||||
<cloud_self_shading><use>/environment/cloud-self-shading</use></cloud_self_shading>
|
<cloud_self_shading><use>/environment/cloud-self-shading</use></cloud_self_shading>
|
||||||
<moonlight><use>/environment/moonlight</use></moonlight>
|
<moonlight><use>/environment/moonlight</use></moonlight>
|
||||||
|
@ -166,9 +166,13 @@
|
||||||
<wrap-t><use>texture[0]/wrap-t</use></wrap-t>
|
<wrap-t><use>texture[0]/wrap-t</use></wrap-t>
|
||||||
<internal-format><use>texture[0]/internal-format</use></internal-format>
|
<internal-format><use>texture[0]/internal-format</use></internal-format>
|
||||||
</texture-unit>
|
</texture-unit>
|
||||||
<texture-unit>
|
<texture-unit>
|
||||||
<unit>1</unit>
|
<unit>4</unit>
|
||||||
<type>noise</type>
|
<image><use>texture[4]/image</use></image>
|
||||||
|
<filter><use>texture[4]/filter</use></filter>
|
||||||
|
<wrap-s><use>texture[4]/wrap-s</use></wrap-s>
|
||||||
|
<wrap-t><use>texture[4]/wrap-t</use></wrap-t>
|
||||||
|
<internal-format><use>texture[4]/internal-format</use></internal-format>
|
||||||
</texture-unit>
|
</texture-unit>
|
||||||
<texture-unit>
|
<texture-unit>
|
||||||
<unit>5</unit>
|
<unit>5</unit>
|
||||||
|
@ -299,9 +303,9 @@
|
||||||
<value type="int">0</value>
|
<value type="int">0</value>
|
||||||
</uniform>
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>NoiseTex</name>
|
<name>NormalTex</name>
|
||||||
<type>sampler-3d</type>
|
<type>sampler-2d</type>
|
||||||
<value type="int">1</value>
|
<value type="int">4</value>
|
||||||
</uniform>
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>mix_texture</name>
|
<name>mix_texture</name>
|
||||||
|
@ -582,7 +586,7 @@
|
||||||
<name>spec_adjust</name>
|
<name>spec_adjust</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value>
|
<value>
|
||||||
<use>wetness</use>
|
<use>rnorm</use>
|
||||||
</value>
|
</value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
|
||||||
|
@ -892,7 +896,7 @@
|
||||||
<name>spec_adjust</name>
|
<name>spec_adjust</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value>
|
<value>
|
||||||
<use>wetness</use>
|
<use>rnorm</use>
|
||||||
</value>
|
</value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,8 @@ varying vec2 rawPos;
|
||||||
|
|
||||||
|
|
||||||
uniform sampler2D texture;
|
uniform sampler2D texture;
|
||||||
uniform sampler3D NoiseTex;
|
uniform sampler2D NormalTex;
|
||||||
|
//uniform sampler3D NoiseTex;
|
||||||
uniform sampler2D snow_texture;
|
uniform sampler2D snow_texture;
|
||||||
uniform sampler2D detail_texture;
|
uniform sampler2D detail_texture;
|
||||||
uniform sampler2D mix_texture;
|
uniform sampler2D mix_texture;
|
||||||
|
@ -191,6 +192,8 @@ float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist;
|
||||||
// 1500m: overlay, detail, dust, fog
|
// 1500m: overlay, detail, dust, fog
|
||||||
// 2000m: overlay, detail, snow, fog
|
// 2000m: overlay, detail, snow, fog
|
||||||
|
|
||||||
|
float noise_01m;
|
||||||
|
float noise_1m = Noise2D(rawPos.xy, 1.0);
|
||||||
float noise_10m;
|
float noise_10m;
|
||||||
float noise_5m;
|
float noise_5m;
|
||||||
noise_10m = Noise2D(rawPos.xy, 10.0);
|
noise_10m = Noise2D(rawPos.xy, 10.0);
|
||||||
|
@ -215,6 +218,8 @@ float noise_2000m = Noise2D(rawPos.xy, 2000.0);
|
||||||
// get the texels
|
// get the texels
|
||||||
|
|
||||||
texel = texture2D(texture, gl_TexCoord[0].st);
|
texel = texture2D(texture, gl_TexCoord[0].st);
|
||||||
|
vec4 nmap = texture2D(NormalTex, gl_TexCoord[0].st * 8.0);
|
||||||
|
vec3 N = nmap.rgb * 2.0 - 1.0;
|
||||||
|
|
||||||
float distortion_factor = 1.0;
|
float distortion_factor = 1.0;
|
||||||
vec2 stprime;
|
vec2 stprime;
|
||||||
|
@ -230,18 +235,17 @@ float noise_2000m = Noise2D(rawPos.xy, 2000.0);
|
||||||
|
|
||||||
if ((quality_level > 3)&&(relPos.z + eye_alt +500.0 > snowlevel))
|
if ((quality_level > 3)&&(relPos.z + eye_alt +500.0 > snowlevel))
|
||||||
{
|
{
|
||||||
//snow_texel = texture2D(snow_texture, gl_TexCoord[0].st);
|
|
||||||
float sfactor;
|
float sfactor;
|
||||||
snow_texel = vec4 (0.95, 0.95, 0.95, 1.0) * (0.9 + 0.1* noise_500m + 0.1* (1.0 - noise_10m) );
|
noise_01m = Noise2D(rawPos.xy,0.1);
|
||||||
snow_texel.r = snow_texel.r * (0.9 + 0.05 * (noise_10m + noise_5m));
|
snow_texel = vec4 (0.95, 0.95, 0.95, 1.0) * (0.9 + 0.1* noise_50m + 0.1* (1.0 - noise_10m) );
|
||||||
snow_texel.g = snow_texel.g * (0.9 + 0.05 * (noise_10m + noise_5m));
|
|
||||||
snow_texel.a = 1.0;
|
snow_texel.a = 1.0;
|
||||||
noise_term = 0.1 * (noise_500m-0.5);
|
noise_term = 0.1 * (noise_50m-0.5);
|
||||||
sfactor = sqrt(2.0 * (1.0-steepness)/0.03) + abs(ct)/0.15;
|
sfactor = 1.0;//sqrt(2.0 * (1.0-steepness)/0.03) + abs(ct)/0.15;
|
||||||
noise_term = noise_term + 0.2 * (noise_50m -0.5) * (1.0 - smoothstep(18000.0*sfactor, 40000.0*sfactor, dist) ) ;
|
noise_term = noise_term + 0.2 * (noise_10m -0.5) * (1.0 - smoothstep(10000.0*sfactor, 16000.0*sfactor, dist) ) ;
|
||||||
noise_term = noise_term + 0.3 * (noise_10m -0.5) * (1.0 - smoothstep(4000.0 * sfactor, 8000.0 * sfactor, dist) ) ;
|
noise_term = noise_term + 0.3 * (noise_5m -0.5) * (1.0 - smoothstep(1200.0 * sfactor, 2000.0 * sfactor, dist) ) ;
|
||||||
if (dist < 3000*sfactor){ noise_term = noise_term + 0.3 * (noise_5m -0.5) * (1.0 - smoothstep(1000.0 * sfactor, 3000.0 *sfactor, dist) );}
|
noise_term = noise_term + 0.3 * (noise_1m -0.5) * (1.0 - smoothstep(500.0 * sfactor, 1000.0 *sfactor, 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) );
|
noise_term = noise_term + 0.3 * (noise_01m -0.5) * (1.0 - smoothstep(20.0 * sfactor, 100.0 *sfactor, dist) );
|
||||||
|
snow_texel.a = snow_texel.a * 0.2+0.8* smoothstep(0.2,0.8, 0.3 +noise_term + 0.2*snow_thickness_factor +0.0001*(relPos.z +eye_alt -snowlevel) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,12 +328,11 @@ if (quality_level > 3)
|
||||||
texel = mix(texel, dust_color, clamp(0.5 * dust_cover_factor + 3.0 * dust_cover_factor * (((noise_1500m - 0.5) * 0.125)+0.125 ),0.0, 1.0) );
|
texel = mix(texel, dust_color, clamp(0.5 * dust_cover_factor + 3.0 * dust_cover_factor * (((noise_1500m - 0.5) * 0.125)+0.125 ),0.0, 1.0) );
|
||||||
|
|
||||||
// mix snow
|
// mix snow
|
||||||
//if (relPos.z + eye_alt +500.0 > snowlevel)
|
if (relPos.z + eye_alt +500.0 > snowlevel)
|
||||||
// {
|
{
|
||||||
// snow_alpha = smoothstep(0.75, 0.85, abs(steepness));
|
snow_alpha = smoothstep(0.75, 0.85, abs(steepness));
|
||||||
//texel = mix(texel, snow_texel, texel_snow_fraction);
|
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));
|
||||||
// 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));
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -369,8 +372,12 @@ if ((dist < 5000.0)&& (quality_level > 3) && (wetness>0.0))
|
||||||
{
|
{
|
||||||
noisegrad_10m = (noise_10m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),10.0))/0.05;
|
noisegrad_10m = (noise_10m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),10.0))/0.05;
|
||||||
noisegrad_5m = (noise_5m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),5.0))/0.05;
|
noisegrad_5m = (noise_5m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),5.0))/0.05;
|
||||||
NdotL = NdotL + 1.0 * (noisegrad_10m + 0.5* noisegrad_5m) * mix_factor/0.8 * (1.0 - smoothstep(1000.0, 2000.0, dist));
|
NdotL = NdotL +1.0 * (noisegrad_10m + 0.5* noisegrad_5m) * mix_factor/0.8 * (1.0 - smoothstep(1000.0, 2000.0, dist));
|
||||||
}
|
}
|
||||||
|
if (quality_level > 4)
|
||||||
|
{
|
||||||
|
NdotL = NdotL + 3.0 * N + 0.1 * (noise_01m-0.5) ;
|
||||||
|
}
|
||||||
if (NdotL > 0.0) {
|
if (NdotL > 0.0) {
|
||||||
color += diffuse_term * NdotL;
|
color += diffuse_term * NdotL;
|
||||||
NdotHV = max(dot(n, halfVector), 0.0);
|
NdotHV = max(dot(n, halfVector), 0.0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue