1
0
Fork 0

Tentative procedural skid marks for paved runways, work in progress

This commit is contained in:
Thorsten Renk 2015-10-27 15:18:45 +02:00
parent 34315227c1
commit 8e03960e3b
3 changed files with 159 additions and 7 deletions

View file

@ -85,6 +85,7 @@
<quality_level><use>/sim/rendering/shaders/landmass</use></quality_level>
<tquality_level><use>/sim/rendering/shaders/transition</use></tquality_level>
<raise_vertex type="bool">false</raise_vertex>
<overlay_flag type="int">0</overlay_flag>
<!-- END fog include -->
</parameters>
<generate>
@ -537,6 +538,11 @@
<type>int</type>
<value><use>display_ysize</use></value>
</uniform>
<uniform>
<name>overlay_flag</name>
<type>int</type>
<value><use>overlay_flag</use></value>
</uniform>
<uniform>
<name>raise_vertex</name>
<type>bool</type>

View file

@ -45,7 +45,70 @@
<material>
<name>dirt_rwy</name>
<effect>Effects/dirt-runway</effect>
<texture>Runway/dirt_rwy.png</texture>
<!--<texture>Runway/dirt_rwy.png</texture>-->
<!--<texture-set>
<texture>Runway/dirt_rwy.png</texture>
<texture n="16">Runway/dirt_rwy.png</texture>
<texture n="17">Terrain/sand_hires_ochre.png</texture>
</texture-set>
<parameters>
<strength_05m>0.0</strength_05m>
<strength_1m>0.4</strength_1m>
<strength_2m>0.3</strength_2m>
<strength_5m>0.2</strength_5m>
<strength_10m>0.1</strength_10m>
<filter_threshold>0.2</filter_threshold>
<filter_transition>0.2</filter_transition>
<bias_center>1</bias_center>
<bias_center_strength>0.6</bias_center_strength>
<relief_strength>0.35</relief_strength>
<size_base>25.0</size_base>
<size_overlay>25.0</size_overlay>
<size_grain>25.0</size_grain>
<grain_strength>0.4</grain_strength>
</parameters>-->
<!--<texture-set>
<texture>Runway/dirt_rwy.png</texture>
<texture n="16">Runway/lakebed_taxiway.png</texture>
<texture n="17">Terrain/airport_grass2.png</texture>
</texture-set>
<parameters>
<strength_05m>0.2</strength_05m>
<strength_1m>0.6</strength_1m>
<strength_2m>0.2</strength_2m>
<strength_5m>0.0</strength_5m>
<strength_10m>0.0</strength_10m>
<filter_threshold>0.2</filter_threshold>
<filter_transition>0.1</filter_transition>
<bias_center>1</bias_center>
<bias_center_strength>0.8</bias_center_strength>
<relief_strength>0.35</relief_strength>
<size_base>25.0</size_base>
<size_overlay>25.0</size_overlay>
<size_grain>20.0</size_grain>
<grain_strength>0.6</grain_strength>
</parameters>-->
<texture-set>
<texture>Runway/dirt_rwy.png</texture>
<texture n="16">Runway/lakebed_taxiway.png</texture>
<texture n="17">Terrain/sand_hires.png</texture>
</texture-set>
<parameters>
<strength_05m>0.0</strength_05m>
<strength_1m>0.2</strength_1m>
<strength_2m>0.3</strength_2m>
<strength_5m>0.3</strength_5m>
<strength_10m>0.2</strength_10m>
<filter_threshold>0.2</filter_threshold>
<filter_transition>0.4</filter_transition>
<bias_center>1</bias_center>
<bias_center_strength>0.5</bias_center_strength>
<relief_strength>0.35</relief_strength>
<size_base>25.0</size_base>
<size_overlay>25.0</size_overlay>
<size_grain>20.0</size_grain>
<grain_strength>0.2</grain_strength>
</parameters>
<friction-factor>0.7</friction-factor>
<rolling-friction>0.04</rolling-friction>
<bumpiness>0.1</bumpiness>
@ -298,12 +361,18 @@
<material include="Materials/base/runway_effect.xml">
<name>pa_tz_three</name>
<parameters>
<overlay_flag type="int">1</overlay_flag>
</parameters>
<texture>Runway/pa_tz_three.png</texture>
<wrapu>false</wrapu>
</material>
<material include="Materials/base/runway_effect.xml">
<name>pa_aim</name>
<parameters>
<overlay_flag type="int">2</overlay_flag>
</parameters>
<texture>Runway/pa_aim.png</texture>
<wrapu>false</wrapu>
</material>
@ -316,36 +385,54 @@
<material include="Materials/base/runway_effect.xml">
<name>pa_tz_two_a</name>
<parameters>
<overlay_flag type="int">3</overlay_flag>
</parameters>
<texture>Runway/pa_tz_two_a.png</texture>
<wrapu>false</wrapu>
</material>
<material include="Materials/base/runway_effect.xml">
<name>pa_tz_two_b</name>
<parameters>
<overlay_flag type="int">3</overlay_flag>
</parameters>
<texture>Runway/pa_tz_two_b.png</texture>
<wrapu>false</wrapu>
</material>
<material include="Materials/base/runway_effect.xml">
<name>pa_tz_one_a</name>
<parameters>
<overlay_flag type="int">3</overlay_flag>
</parameters>
<texture>Runway/pa_tz_one_a.png</texture>
<wrapu>false</wrapu>
</material>
<material include="Materials/base/runway_effect.xml">
<name>pa_tz_one_b</name>
<parameters>
<overlay_flag type="int">3</overlay_flag>
</parameters>
<texture>Runway/pa_tz_one_b.png</texture>
<wrapu>false</wrapu>
</material>
<material include="Materials/base/runway_effect.xml">
<name>pa_centerline</name>
<parameters>
<overlay_flag type="int">1</overlay_flag>
</parameters>
<texture>Runway/pa_centerline.png</texture>
<wrapu>false</wrapu>
</material>
<material include="Materials/base/runway_effect.xml">
<name>pa_rest</name>
<parameters>
<overlay_flag type="int">3</overlay_flag>
</parameters>
<texture>Runway/pa_rest.png</texture>
<wrapu>false</wrapu>
</material>

View file

@ -45,6 +45,7 @@ uniform int cloud_shadow_flag;
uniform int use_searchlight;
uniform int use_landing_light;
uniform int use_alt_landing_light;
uniform int overlay_flag;
const float EarthRadius = 5800000.0;
const float terminator_width = 200000.0;
@ -118,13 +119,11 @@ void main()
float noise_01m;
float noise_1m = Noise2D(rawPos.xy, 1.0);
float noise_10m;
float noise_5m;
noise_10m = Noise2D(rawPos.xy, 10.0);
noise_5m = Noise2D(rawPos.xy ,5.0);
float noise_10m = Noise2D(rawPos.xy, 10.0);
float noise_20m = Noise2D(rawPos.xy, 20.0);
float noise_5m = Noise2D(rawPos.xy ,5.0);
float noisegrad_10m;
float noisegrad_5m;
float noise_50m = Noise2D(rawPos.xy, 50.0);
@ -144,6 +143,61 @@ float noise_2000m = Noise3D(worldPos.xyz, 2000.0);
vec4 nmap = texture2D(NormalTex, gl_TexCoord[0].st * 8.0);
vec3 N = nmap.rgb * 2.0 - 1.0;
// skid marks by procedural darkening
float mix_factor = smoothstep(0.0, 0.3, 1.0 - gl_TexCoord[0].t)* smoothstep(0.0, 0.1, gl_TexCoord[0].t);
float threshold;
if (overlay_flag > 0)
{
float centerness = 2.0 * (0.5 - abs(gl_TexCoord[0].s - 0.5));
if (overlay_flag == 1)
{
threshold = 0.4 + 0.3 * (1.0 -noise_50m);
}
else if (overlay_flag == 2)
{
threshold = mix(0.4 + 0.3 * (1.0 -noise_50m), 0.4, mix_factor);
}
else if (overlay_flag == 3)
{
threshold = 0.4 + 0.3 * (1.0 -noise_50m);
}
centerness = smoothstep(threshold, 1.0, centerness);
float sine_factor1 = smoothstep(0.6, 1.0, abs(sin(1.0 * noise_50m + 2.0 * gl_TexCoord[0].s + gl_TexCoord[0].s * 40.0)));
float sine_factor2 = smoothstep(0.7, 1.0, abs(sin(2.0 * noise_10m + gl_TexCoord[0].s + gl_TexCoord[0].s * 60.0)));
float sine_factor3 = smoothstep(0.7, 1.0, abs(sin(1.0 * noise_20m + gl_TexCoord[0].s + gl_TexCoord[0].s * 80.0)));
float sine_factor = sine_factor1 * smoothstep(0.4, 0.6, noise_10m);
sine_factor += sine_factor2 * (1.0 - smoothstep(0.5, 0.7, noise_10m));
sine_factor += sine_factor3 * smoothstep(0.5, 0.6, noise_20m);
sine_factor = min(sine_factor, 1.0);
centerness *=(0.7 + 0.3 *sine_factor);
float t_factor;
if (overlay_flag == 1)
{t_factor = smoothstep(0.0, 0.3, gl_TexCoord[0].t) * (0.4 + 0.2 * noise_50m);}
else if (overlay_flag == 2)
{
t_factor = mix (0.4 + 0.2 * noise_50m, 0.7 + 0.2 * noise_50m, mix_factor);
}
else if (overlay_flag == 3)
{t_factor = 0.3 + 0.2 * noise_50m;}
centerness *= t_factor;
centerness = 1.0 - centerness;
texel.rgb = texel.rgb * (0.2 + 0.8 * centerness);
}
float distortion_factor = 1.0;
vec2 stprime;
int flag = 1;
@ -464,5 +518,10 @@ fragColor.rgb = mix(hazeColor +secondary_light * fog_backscatter(mvisibility), f
gl_FragColor = fragColor;
//if (overlay_flag == 1)
// {gl_FragColor = vec4 (1.0, 0.0, 0.0, 1.0);}
//if (gl_TexCoord[0].s > 0.5) {gl_FragColor = vec4 (1.0, 0.0, 0.0, 1.0);}
//if (gl_TexCoord[0].t > 0.5) {gl_FragColor = vec4 (0.0, 1.0, 0.0, 1.0);}
}