Improvements and environment dependence to rendering of runway lighting for ALS
This commit is contained in:
parent
7f1cf271a0
commit
4286141f2a
3 changed files with 62 additions and 24 deletions
|
@ -12,6 +12,7 @@
|
||||||
<avisibility><use>/environment/visibility-m</use></avisibility>
|
<avisibility><use>/environment/visibility-m</use></avisibility>
|
||||||
<lthickness><use>/environment/ground-haze-thickness-m</use></lthickness>
|
<lthickness><use>/environment/ground-haze-thickness-m</use></lthickness>
|
||||||
<eye_alt><use>/sim/rendering/eye-altitude-m</use></eye_alt>
|
<eye_alt><use>/sim/rendering/eye-altitude-m</use></eye_alt>
|
||||||
|
<terminator><use>/environment/terminator-relative-position-m</use></terminator>
|
||||||
</parameters>
|
</parameters>
|
||||||
|
|
||||||
<technique n="10">
|
<technique n="10">
|
||||||
|
@ -28,7 +29,7 @@
|
||||||
<and>
|
<and>
|
||||||
<extension-supported>GL_ARB_point_sprite</extension-supported>
|
<extension-supported>GL_ARB_point_sprite</extension-supported>
|
||||||
<extension-supported>GL_ARB_point_parameters</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_shading_language_100</extension-supported>
|
||||||
<extension-supported>GL_ARB_vertex_shader</extension-supported>
|
<extension-supported>GL_ARB_vertex_shader</extension-supported>
|
||||||
<extension-supported>GL_ARB_fragment_shader</extension-supported>
|
<extension-supported>GL_ARB_fragment_shader</extension-supported>
|
||||||
|
@ -36,22 +37,25 @@
|
||||||
</or>
|
</or>
|
||||||
</and>
|
</and>
|
||||||
</predicate>
|
</predicate>
|
||||||
<pass>
|
<pass>
|
||||||
<render-bin>
|
<render-bin>
|
||||||
<bin-number>8</bin-number>
|
<bin-number>8</bin-number>
|
||||||
<bin-name>DepthSortedBin</bin-name>
|
<bin-name>DepthSortedBin</bin-name>
|
||||||
</render-bin>
|
</render-bin>
|
||||||
<lighting>false</lighting>
|
<lighting>false</lighting>
|
||||||
<blend>
|
<blend>
|
||||||
<source>src-alpha</source>
|
<source>src-alpha</source>
|
||||||
<destination>one-minus-src-alpha</destination>
|
<destination>one-minus-src-alpha</destination>
|
||||||
</blend>
|
</blend>
|
||||||
<alpha-test>
|
<depth>
|
||||||
<comparison>gequal</comparison>
|
<write-mask>false</write-mask>
|
||||||
<reference type="float">0.1</reference>
|
</depth>
|
||||||
</alpha-test>
|
<alpha-test>
|
||||||
<cull-face><use>directional</use></cull-face>
|
<comparison>gequal</comparison>
|
||||||
<polygon-mode>
|
<reference type="float">0.03</reference>
|
||||||
|
</alpha-test>
|
||||||
|
<cull-face><use>directional</use></cull-face>
|
||||||
|
<polygon-mode>
|
||||||
<front>point</front>
|
<front>point</front>
|
||||||
<back>point</back>
|
<back>point</back>
|
||||||
</polygon-mode>
|
</polygon-mode>
|
||||||
|
@ -73,8 +77,8 @@
|
||||||
<fragment-shader>Shaders/surface-light-lightfield.frag</fragment-shader>
|
<fragment-shader>Shaders/surface-light-lightfield.frag</fragment-shader>
|
||||||
</program>
|
</program>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>size</name>
|
<name>size</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value><use>size</use></value>
|
<value><use>size</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
|
@ -102,9 +106,17 @@
|
||||||
<type>sampler-2d</type>
|
<type>sampler-2d</type>
|
||||||
<value type="int">0</value>
|
<value type="int">0</value>
|
||||||
</uniform>
|
</uniform>
|
||||||
<vertex-program-point-size>true</vertex-program-point-size>
|
<uniform>
|
||||||
</pass>
|
<name>terminator</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value><use>terminator</use></value>
|
||||||
|
</uniform>
|
||||||
|
<vertex-program-point-size>true</vertex-program-point-size>
|
||||||
|
</pass>
|
||||||
</technique>
|
</technique>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<technique n="17">
|
<technique n="17">
|
||||||
<!-- Combined technique -->
|
<!-- Combined technique -->
|
||||||
|
|
|
@ -6,6 +6,7 @@ uniform float visibility;
|
||||||
uniform float avisibility;
|
uniform float avisibility;
|
||||||
uniform float hazeLayerAltitude;
|
uniform float hazeLayerAltitude;
|
||||||
uniform float eye_alt;
|
uniform float eye_alt;
|
||||||
|
uniform float terminator;
|
||||||
|
|
||||||
varying vec3 relPos;
|
varying vec3 relPos;
|
||||||
varying float pixelSize;
|
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()
|
void main()
|
||||||
{
|
{
|
||||||
|
@ -111,9 +134,12 @@ void main()
|
||||||
|
|
||||||
|
|
||||||
transmission = fog_func(transmission_arg);
|
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);
|
gl_FragColor = vec4 (gl_Color.rgb, texel.a * transmission * dist_att);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,5 +20,5 @@ void main()
|
||||||
float dist = length(relPos);
|
float dist = length(relPos);
|
||||||
float lightScale = size * size * size * size * size / 1000.0;
|
float lightScale = size * size * size * size * size / 1000.0;
|
||||||
pixelSize = min(size * size/25.0,lightScale/dist);
|
pixelSize = min(size * size/25.0,lightScale/dist);
|
||||||
gl_PointSize = pixelSize;
|
gl_PointSize = 2.0 * pixelSize;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue