1
0
Fork 0

Tentative fix for taxiway line z-fighting within ALS

This commit is contained in:
Thorsten Renk 2014-10-10 11:20:19 +03:00
parent dfb8073607
commit 77e5cc4c9f
5 changed files with 38 additions and 27 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/lfeat</name>
<inherits-from>Effects/terrain-default</inherits-from>
<inherits-from>Effects/runway</inherits-from>
<parameters>
<material>
<ambient type="vec4d">
@ -19,8 +19,15 @@
<shininess>1.2</shininess>
</material>
<transparent>true</transparent>
<raise_vertex type="bool">true</raise_vertex>
</parameters>
<technique n="1">
<predicate>
<equal>
<property>/sim/rendering/shaders/skydome</property>
<value type="bool" >false</value>
</equal>
</predicate>
<pass>
<lighting>true</lighting>
<depth>

View file

@ -84,6 +84,7 @@
<moonlight><use>/environment/moonlight</use></moonlight>
<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>
<!-- END fog include -->
</parameters>
<generate>
@ -526,6 +527,11 @@
<type>int</type>
<value><use>display_ysize</use></value>
</uniform>
<uniform>
<name>raise_vertex</name>
<type>bool</type>
<value> <use>raise_vertex</use></value>
</uniform>
<uniform>
<name>texture</name>
<type>sampler-2d</type>
@ -542,10 +548,14 @@
<value>2</value>
<!-- AMBIENT_AND_DIFFUSE -->
</uniform>
<depth>
<!--<depth>
<function>lequal</function>
<!-- <write-mask type="bool">false</write-mask> -->
</depth>
<write-mask type="bool">false</write-mask>
</depth>-->
<alpha-test>
<comparison>greater</comparison>
<reference type="float">0.4</reference>
</alpha-test>
</pass>
</technique>

View file

@ -93,6 +93,7 @@
<dot_size>1.0</dot_size>
<dust_resistance>1.0</dust_resistance>
<rock_strata>0</rock_strata>
<raise_vertex type="bool">false</raise_vertex>
<visibility><use>/environment/ground-visibility-m</use></visibility>
<avisibility><use>/environment/visibility-m</use></avisibility>
<lthickness><use>/environment/ground-haze-thickness-m</use></lthickness>
@ -732,6 +733,11 @@
<type>int</type>
<value><use>rock_strata</use></value>
</uniform>
<uniform>
<name>raise_vertex</name>
<type>bool</type>
<value> <use>raise_vertex</use></value>
</uniform>
<uniform>
<name>texture</name>
<type>sampler-2d</type>

View file

@ -176,23 +176,23 @@ float noise_2000m = Noise2D(rawPos.xy, 2000.0);
}
const vec4 dust_color = vec4 (0.76, 0.71, 0.56, 1.0);
const vec4 lichen_color = vec4 (0.17, 0.20, 0.06, 1.0);;
const vec3 dust_color = vec3 (0.76, 0.71, 0.56);
const vec3 lichen_color = vec3 (0.17, 0.20, 0.06);
//float snow_alpha;
if (quality_level > 3)
{
// mix vegetation
texel = mix(texel, lichen_color, 0.4 * lichen_cover_factor + 0.8 * lichen_cover_factor * 0.5 * (noise_10m + (1.0 - noise_5m)) );
texel.rgb = mix(texel.rgb, lichen_color, 0.4 * lichen_cover_factor + 0.8 * lichen_cover_factor * 0.5 * (noise_10m + (1.0 - noise_5m)) );
// mix dust
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.rgb = mix(texel.rgb, 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
if (relPos.z + eye_alt +500.0 > snowlevel)
{
snow_alpha = smoothstep(0.75, 0.85, abs(steepness));
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.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));
}
}

View file

@ -29,9 +29,10 @@ varying vec2 grad_dir;
varying float mie_angle;
varying float steepness;
uniform int colorMode;
uniform bool raise_vertex;
uniform float hazeLayerAltitude;
uniform float terminator;
uniform float terrain_alt;
@ -87,6 +88,8 @@ void main()
steepness = dot(normalize(gl_Normal), vec3 (0.0, 0.0, 1.0));
grad_dir = normalize(gl_Normal.xy);
if (raise_vertex) gl_Vertex.z+=0.1;
// this code is copied from default.vert
//vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
@ -129,21 +132,6 @@ void main()
scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt);
// early culling of vertices which can't be seen due to ground haze despite being in aloft visibility range
//float delta_z = hazeLayerAltitude - eye_alt;
//if (((dist * (relPos.z - delta_z)/relPos.z > visibility ) && (relPos.z < 0.0) && (delta_z < 0.0) && (dist > 30000.0)))
if (0==1)
{
gl_Position = vec4(0.0, 0.0, -1000.0, 1.0); // move outside of view frustrum, gets culled before reaching fragment shader
earthShade = 1.0;
mie_angle = 1.0;
yprime_alt = 0.0;
}
else
{
// branch dependent on daytime
if (terminator < 1000000.0) // the full, sunrise and sunset computation
@ -284,7 +272,7 @@ float shade_depth = 1.0 * smoothstep (0.6,0.95,ground_scattering) * (1.0-smooth
gl_BackColor.rgb = constant_term.rgb; //gl_BackColor.a = 0.0;
gl_FrontColor.a = mie_angle;
gl_BackColor.a = mie_angle;
}
}