1
0
Fork 0

Extend ALS flitering to more effects

This commit is contained in:
Thorsten Renk 2016-03-18 09:32:34 +02:00
parent 8bf55eec3c
commit cbc851d415
13 changed files with 137 additions and 23 deletions

View file

@ -122,6 +122,7 @@
<fragment-shader>Shaders/noise.frag</fragment-shader>
<fragment-shader>Shaders/hazes.frag</fragment-shader>
<fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
</program>
<uniform>
<name>visibility</name>
@ -238,6 +239,7 @@
<type>float</type>
<value><use>season</use></value>
</uniform>
<!-- secondary lights -->
<uniform>
<name>view_pitch_offset</name>
<type>float</type>
@ -268,6 +270,38 @@
<type>float</type>
<value><use>landing_light3_offset</use></value>
</uniform>
<!-- filtering -->
<uniform>
<name>gamma</name>
<type>float</type>
<value><use>gamma</use></value>
</uniform>
<uniform>
<name>brightness</name>
<type>float</type>
<value><use>brightness</use></value>
</uniform>
<uniform>
<name>use_night_vision</name>
<type>bool</type>
<value><use>use_night_vision</use></value>
</uniform>
<uniform>
<name>use_IR_vision</name>
<type>bool</type>
<value><use>use_IR_vision</use></value>
</uniform>
<uniform>
<name>use_filtering</name>
<type>bool</type>
<value><use>use_filtering</use></value>
</uniform>
<uniform>
<name>delta_T</name>
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>
<type>float</type>

View file

@ -138,12 +138,12 @@
<internal-format><use>texture[11]/internal-format</use></internal-format>
</texture-unit>
<program>
<vertex-shader n="1">Shaders/terrain-ALS-ultra.vert</vertex-shader>
<fragment-shader n="1">Shaders/drunway-ALS.frag</fragment-shader>
<fragment-shader n="2">Shaders/cloud-shadowfunc.frag</fragment-shader>
<fragment-shader n="3">Shaders/noise.frag</fragment-shader>
<fragment-shader n="4">Shaders/hazes.frag</fragment-shader>
<fragment-shader n="5">Shaders/secondary_lights.frag</fragment-shader>
<vertex-shader n="0">Shaders/terrain-ALS-ultra.vert</vertex-shader>
<fragment-shader n="0">Shaders/drunway-ALS.frag</fragment-shader>
<fragment-shader n="1">Shaders/cloud-shadowfunc.frag</fragment-shader>
<fragment-shader n="2">Shaders/noise.frag</fragment-shader>
<fragment-shader n="3">Shaders/hazes.frag</fragment-shader>
<fragment-shader n="4">Shaders/secondary_lights.frag</fragment-shader>
</program>
<uniform>
<name>visibility</name>

View file

@ -145,7 +145,6 @@ please see Docs/README.model-combined.eff for documentation
<fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
<wetness><use>/environment/surface/wetness</use></wetness>
<rnorm><use>/environment/rain-norm</use></rnorm>
<use_IR_vision><use>/sim/rendering/als-filters/use-IR-vision</use></use_IR_vision>
<cloudpos1_x><use>/local-weather/cloud-shadows/cloudpos-x[0]</use></cloudpos1_x>
<cloudpos1_y><use>/local-weather/cloud-shadows/cloudpos-y[0]</use></cloudpos1_y>
<cloudpos2_x><use>/local-weather/cloud-shadows/cloudpos-x[1]</use></cloudpos2_x>

View file

@ -161,12 +161,13 @@
<internal-format><use>texture[4]/internal-format</use></internal-format>
</texture-unit>
<program>
<vertex-shader n="1">Shaders/terrain-ALS-ultra.vert</vertex-shader>
<fragment-shader n="1">Shaders/runway-ALS.frag</fragment-shader>
<fragment-shader n="2">Shaders/cloud-shadowfunc.frag</fragment-shader>
<fragment-shader n="3">Shaders/noise.frag</fragment-shader>
<fragment-shader n="4">Shaders/hazes.frag</fragment-shader>
<fragment-shader n="5">Shaders/secondary_lights.frag</fragment-shader>
<vertex-shader n="0">Shaders/terrain-ALS-ultra.vert</vertex-shader>
<fragment-shader n="0">Shaders/runway-ALS.frag</fragment-shader>
<fragment-shader n="1">Shaders/cloud-shadowfunc.frag</fragment-shader>
<fragment-shader n="2">Shaders/noise.frag</fragment-shader>
<fragment-shader n="3">Shaders/hazes.frag</fragment-shader>
<fragment-shader n="4">Shaders/secondary_lights.frag</fragment-shader>
<fragment-shader n="5">Shaders/filters-ALS.frag</fragment-shader>
</program>
<uniform>
<name>visibility</name>
@ -268,6 +269,7 @@
<type>float</type>
<value><use>air_pollution</use></value>
</uniform>
<!-- secondary lights -->
<uniform>
<name>view_pitch_offset</name>
<type>float</type>
@ -298,6 +300,38 @@
<type>float</type>
<value><use>landing_light3_offset</use></value>
</uniform>
<!-- filtering -->
<uniform>
<name>gamma</name>
<type>float</type>
<value><use>gamma</use></value>
</uniform>
<uniform>
<name>brightness</name>
<type>float</type>
<value><use>brightness</use></value>
</uniform>
<uniform>
<name>use_night_vision</name>
<type>bool</type>
<value><use>use_night_vision</use></value>
</uniform>
<uniform>
<name>use_IR_vision</name>
<type>bool</type>
<value><use>use_IR_vision</use></value>
</uniform>
<uniform>
<name>use_filtering</name>
<type>bool</type>
<value><use>use_filtering</use></value>
</uniform>
<uniform>
<name>delta_T</name>
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>
<type>float</type>

View file

@ -8,7 +8,7 @@
<pass>
<program>
<vertex-shader n="0">Shaders/space-ALS-ultra.vert</vertex-shader>
<fragment-shader n="1">Shaders/space-ALS-ultra.frag</fragment-shader>
<fragment-shader n="0">Shaders/space-ALS-ultra.frag</fragment-shader>
</program>
</pass>
</technique>

View file

@ -13,6 +13,8 @@
<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>
<use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_vision>
<use_IR_vision><use>/sim/rendering/als-filters/use-IR-vision</use></use_IR_vision>
</parameters>
<technique n="10">
@ -112,6 +114,16 @@
<!-- Short-term fix for unstable normals in taxiway lights -->
<value>false</value>
</uniform>
<uniform>
<name>use_night_vision</name>
<type>bool</type>
<value><use>use_night_vision</use></value>
</uniform>
<uniform>
<name>use_IR_vision</name>
<type>bool</type>
<value><use>use_IR_vision</use></value>
</uniform>
<uniform>
<name>texture</name>
<type>sampler-2d</type>

View file

@ -13,6 +13,8 @@
<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>
<use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_vision>
<use_IR_vision><use>/sim/rendering/als-filters/use-IR-vision</use></use_IR_vision>
</parameters>
<technique n="10">
@ -112,6 +114,16 @@
<type>bool</type>
<value><use>light-directional</use></value>
</uniform>
<uniform>
<name>use_night_vision</name>
<type>bool</type>
<value><use>use_night_vision</use></value>
</uniform>
<uniform>
<name>use_IR_vision</name>
<type>bool</type>
<value><use>use_IR_vision</use></value>
</uniform>
<uniform>
<name>texture</name>
<type>sampler-2d</type>

View file

@ -456,6 +456,7 @@
<type>float</type>
<value><use>air_pollution</use></value>
</uniform>
<!-- secondary lights -->
<uniform>
<name>view_pitch_offset</name>
<type>float</type>
@ -486,6 +487,7 @@
<type>float</type>
<value><use>landing_light3_offset</use></value>
</uniform>
<!-- filtering -->
<uniform>
<name>gamma</name>
<type>float</type>
@ -516,6 +518,7 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>
<type>float</type>

View file

@ -73,7 +73,7 @@ vec3 rayleigh_out_shift(in vec3 color, in float outscatter);
vec3 get_hazeColor(in float light_arg);
vec3 searchlight();
vec3 landing_light(in float offset, in float offsetv);
vec3 filter_combined (in vec3 color) ;
float detail_fade (in float scale, in float angle, in float dist)
@ -503,6 +503,8 @@ fragColor.rgb = mix(hazeColor+secondary_light * fog_backscatter(mvisibility), fr
}
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;

View file

@ -55,7 +55,7 @@ value = 1.0 - value;
float T_mapped = smoothstep(-10.0, 10.0, delta_T);
float gain = mix(T_mapped, value, 0.7);
float gain = mix(T_mapped, value, 0.5);
//float gain = 0.2 * T_mapped + 0.8 * value * T_mapped;
if (delta_T < -10.0) {gain = 0.0;}
@ -72,17 +72,24 @@ if (use_filtering == false)
}
color = brightness_adjust(color);
if (use_night_vision)
{
color = brightness_adjust(color);
color = night_vision(color);
}
else if (use_IR_vision)
{
float IR_brightness = min(1.0/(brightness+0.01), 5.0);
color = clamp(IR_brightness * color, 0.0, 1.0);
color = IR_vision(color);
}
else
{
color = brightness_adjust(color);
}
return gamma_correction (color);

View file

@ -538,10 +538,15 @@ void main (void)
hazeColor = vec3 (1.0, 1.0, 1.0);
}
if (use_IR_vision)
{
//hazeColor.rgb = max(hazeColor.rgb, vec3 (0.5, 0.5, 0.5));
}
/// END fog color
fragColor = clamp(fragColor, 0.0, 1.0);
//hazeColor = clamp(hazeColor, 0.0, 1.0);
hazeColor = clamp(hazeColor, 0.0, 1.0);
///BEGIN Rayleigh fog ///

View file

@ -69,7 +69,7 @@ vec3 searchlight();
vec3 landing_light(in float offset, in float offsetv);
vec3 rayleigh_out_shift(in vec3 color, in float outscatter);
vec3 get_hazeColor(in float light_arg);
vec3 filter_combined (in vec3 color) ;
void main()
@ -516,12 +516,10 @@ fragColor.rgb = mix(hazeColor +secondary_light * fog_backscatter(mvisibility), f
}
fragColor.rgb = filter_combined(fragColor.rgb);
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);}
}

View file

@ -9,6 +9,8 @@ uniform float eye_alt;
uniform float terminator;
uniform float size;
uniform bool use_IR_vision;
uniform bool use_night_vision;
varying vec3 relPos;
varying vec2 rawPos;
@ -90,6 +92,8 @@ void main()
float distance_in_layer;
float transmission_arg;
if (use_IR_vision) {discard;}
// Discard the second and third vertex, which are used for directional lighting
if (gl_Color.a == 0.0) {discard;}
@ -162,6 +166,10 @@ void main()
//vec4 texel = light_sprite(gl_TexCoord[0].st,transmission, noise);
float intensity = light_sprite(gl_TexCoord[0].st,transmission, noise);
vec3 light_color = gl_Color.rgb;
if (use_night_vision)
{light_color.rgb = vec3 (0.0, 1.0, 0.0);}
light_color = mix(light_color, vec3 (1.0, 1.0, 1.0), 0.5 * intensity * intensity);
gl_FragColor = vec4 (clamp(light_color.rgb,0.0,1.0), intensity * transmission * dist_att);