1
0
Fork 0

Improvements and environment dependence to rendering of runway lighting for ALS

This commit is contained in:
Thorsten Renk 2014-02-28 09:15:41 +02:00
parent 7f1cf271a0
commit 4286141f2a
3 changed files with 62 additions and 24 deletions

View file

@ -12,6 +12,7 @@
<avisibility><use>/environment/visibility-m</use></avisibility>
<lthickness><use>/environment/ground-haze-thickness-m</use></lthickness>
<eye_alt><use>/sim/rendering/eye-altitude-m</use></eye_alt>
<terminator><use>/environment/terminator-relative-position-m</use></terminator>
</parameters>
<technique n="10">
@ -28,7 +29,7 @@
<and>
<extension-supported>GL_ARB_point_sprite</extension-supported>
<extension-supported>GL_ARB_point_parameters</extension-supported>
<extension-supported>GL_ARB_shader_objects</extension-supported>
<extension-supported>GL_ARB_shader_objects</extension-supported>
<extension-supported>GL_ARB_shading_language_100</extension-supported>
<extension-supported>GL_ARB_vertex_shader</extension-supported>
<extension-supported>GL_ARB_fragment_shader</extension-supported>
@ -36,22 +37,25 @@
</or>
</and>
</predicate>
<pass>
<render-bin>
<bin-number>8</bin-number>
<bin-name>DepthSortedBin</bin-name>
</render-bin>
<lighting>false</lighting>
<blend>
<source>src-alpha</source>
<destination>one-minus-src-alpha</destination>
</blend>
<alpha-test>
<comparison>gequal</comparison>
<reference type="float">0.1</reference>
</alpha-test>
<cull-face><use>directional</use></cull-face>
<polygon-mode>
<pass>
<render-bin>
<bin-number>8</bin-number>
<bin-name>DepthSortedBin</bin-name>
</render-bin>
<lighting>false</lighting>
<blend>
<source>src-alpha</source>
<destination>one-minus-src-alpha</destination>
</blend>
<depth>
<write-mask>false</write-mask>
</depth>
<alpha-test>
<comparison>gequal</comparison>
<reference type="float">0.03</reference>
</alpha-test>
<cull-face><use>directional</use></cull-face>
<polygon-mode>
<front>point</front>
<back>point</back>
</polygon-mode>
@ -73,8 +77,8 @@
<fragment-shader>Shaders/surface-light-lightfield.frag</fragment-shader>
</program>
<uniform>
<name>size</name>
<type>float</type>
<name>size</name>
<type>float</type>
<value><use>size</use></value>
</uniform>
<uniform>
@ -102,10 +106,18 @@
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<vertex-program-point-size>true</vertex-program-point-size>
</pass>
<uniform>
<name>terminator</name>
<type>float</type>
<value><use>terminator</use></value>
</uniform>
<vertex-program-point-size>true</vertex-program-point-size>
</pass>
</technique>
<technique n="17">
<!-- Combined technique -->
<predicate>

View file

@ -6,6 +6,7 @@ uniform float visibility;
uniform float avisibility;
uniform float hazeLayerAltitude;
uniform float eye_alt;
uniform float terminator;
varying vec3 relPos;
varying float pixelSize;
@ -40,6 +41,28 @@ else
}
float light_sprite (in vec2 coord, in float transmission)
{
coord.s = coord.s - 0.5;
coord.t = coord.t - 0.5;
float r = length(coord);
if (pixelSize<1.3) {return vec4 (1.0,1.0,1.0,1.0) * 0.08;}
float sinphi = dot(vec2 (1.0,0.0), normalize(coord));
float ray = clamp(pow(sin((sinphi-3.0) * (sinphi-3.0)),10.0),0.0,1.0);
float fogEffect = (1.0-smoothstep(0.4,0.8,transmission));
float intensity = clamp(ray * exp(-40.0 * r * r) + exp(-80.0*r*r),0.0,1.0) + 0.1 * fogEffect * (1.0-smoothstep(0.3, 0.6,r));
return vec4 (1.0,1.0,1.0,1.0) * intensity;
}
void main()
{
@ -111,9 +134,12 @@ void main()
transmission = fog_func(transmission_arg);
float dist_att = exp(-0.3/pixelSize);
float lightArg = terminator/100000.0;
float attenuationScale = 1.0 + 3.0 * (1.0 -smoothstep(-15.0, 0.0, lightArg));
float dist_att = exp(-0.3/attenuationScale/pixelSize);
vec4 texel = texture2D(texture,gl_TexCoord[0].st);
//vec4 texel = texture2D(texture,gl_TexCoord[0].st);
vec4 texel = light_sprite(gl_TexCoord[0].st,transmission);
gl_FragColor = vec4 (gl_Color.rgb, texel.a * transmission * dist_att);

View file

@ -20,5 +20,5 @@ void main()
float dist = length(relPos);
float lightScale = size * size * size * size * size / 1000.0;
pixelSize = min(size * size/25.0,lightScale/dist);
gl_PointSize = pixelSize;
gl_PointSize = 2.0 * pixelSize;
}