diff --git a/Effects/airfield.eff b/Effects/airfield.eff index fc54e445f..d344d7612 100644 --- a/Effects/airfield.eff +++ b/Effects/airfield.eff @@ -122,6 +122,7 @@ Shaders/noise.frag Shaders/hazes.frag Shaders/secondary_lights.frag + Shaders/filters-ALS.frag visibility @@ -238,6 +239,7 @@ float season + view_pitch_offset float @@ -268,6 +270,38 @@ float landing_light3_offset + + + gamma + float + gamma + + + brightness + float + brightness + + + use_night_vision + bool + use_night_vision + + + use_IR_vision + bool + use_IR_vision + + + use_filtering + bool + use_filtering + + + delta_T + float + delta_T + + cloudpos1_x float diff --git a/Effects/dirt-runway.eff b/Effects/dirt-runway.eff index f53144879..3ac13231b 100644 --- a/Effects/dirt-runway.eff +++ b/Effects/dirt-runway.eff @@ -138,12 +138,12 @@ texture[11]/internal-format - Shaders/terrain-ALS-ultra.vert - Shaders/drunway-ALS.frag - Shaders/cloud-shadowfunc.frag - Shaders/noise.frag - Shaders/hazes.frag - Shaders/secondary_lights.frag + Shaders/terrain-ALS-ultra.vert + Shaders/drunway-ALS.frag + Shaders/cloud-shadowfunc.frag + Shaders/noise.frag + Shaders/hazes.frag + Shaders/secondary_lights.frag visibility diff --git a/Effects/model-combined.eff b/Effects/model-combined.eff index 662e53ae6..192ae9dec 100644 --- a/Effects/model-combined.eff +++ b/Effects/model-combined.eff @@ -145,7 +145,6 @@ please see Docs/README.model-combined.eff for documentation /sim/rendering/shaders/skydome /environment/surface/wetness /environment/rain-norm - /sim/rendering/als-filters/use-IR-vision /local-weather/cloud-shadows/cloudpos-x[0] /local-weather/cloud-shadows/cloudpos-y[0] /local-weather/cloud-shadows/cloudpos-x[1] diff --git a/Effects/runway.eff b/Effects/runway.eff index 542ca162e..74910dbaa 100644 --- a/Effects/runway.eff +++ b/Effects/runway.eff @@ -161,12 +161,13 @@ texture[4]/internal-format - Shaders/terrain-ALS-ultra.vert - Shaders/runway-ALS.frag - Shaders/cloud-shadowfunc.frag - Shaders/noise.frag - Shaders/hazes.frag - Shaders/secondary_lights.frag + Shaders/terrain-ALS-ultra.vert + Shaders/runway-ALS.frag + Shaders/cloud-shadowfunc.frag + Shaders/noise.frag + Shaders/hazes.frag + Shaders/secondary_lights.frag + Shaders/filters-ALS.frag visibility @@ -268,6 +269,7 @@ float air_pollution + view_pitch_offset float @@ -298,6 +300,38 @@ float landing_light3_offset + + + gamma + float + gamma + + + brightness + float + brightness + + + use_night_vision + bool + use_night_vision + + + use_IR_vision + bool + use_IR_vision + + + use_filtering + bool + use_filtering + + + delta_T + float + delta_T + + cloudpos1_x float diff --git a/Effects/space-combined.eff b/Effects/space-combined.eff index 11b83af4b..03d392828 100644 --- a/Effects/space-combined.eff +++ b/Effects/space-combined.eff @@ -8,7 +8,7 @@ Shaders/space-ALS-ultra.vert - Shaders/space-ALS-ultra.frag + Shaders/space-ALS-ultra.frag diff --git a/Effects/surface-lights-directional.eff b/Effects/surface-lights-directional.eff index 957a46a04..f5e0ab51b 100644 --- a/Effects/surface-lights-directional.eff +++ b/Effects/surface-lights-directional.eff @@ -13,6 +13,8 @@ /environment/ground-haze-thickness-m /sim/rendering/eye-altitude-m /environment/terminator-relative-position-m + /sim/rendering/als-filters/use-night-vision + /sim/rendering/als-filters/use-IR-vision @@ -112,6 +114,16 @@ false + + use_night_vision + bool + use_night_vision + + + use_IR_vision + bool + use_IR_vision + texture sampler-2d diff --git a/Effects/surface-lights.eff b/Effects/surface-lights.eff index 1f3d9bc14..8db7f03dd 100644 --- a/Effects/surface-lights.eff +++ b/Effects/surface-lights.eff @@ -13,6 +13,8 @@ /environment/ground-haze-thickness-m /sim/rendering/eye-altitude-m /environment/terminator-relative-position-m + /sim/rendering/als-filters/use-night-vision + /sim/rendering/als-filters/use-IR-vision @@ -112,6 +114,16 @@ bool light-directional + + use_night_vision + bool + use_night_vision + + + use_IR_vision + bool + use_IR_vision + texture sampler-2d diff --git a/Effects/terrain-default.eff b/Effects/terrain-default.eff index 492f64537..15a45ccdf 100644 --- a/Effects/terrain-default.eff +++ b/Effects/terrain-default.eff @@ -456,6 +456,7 @@ float air_pollution + view_pitch_offset float @@ -486,6 +487,7 @@ float landing_light3_offset + gamma float @@ -516,6 +518,7 @@ float delta_T + cloudpos1_x float diff --git a/Shaders/airfield-ALS.frag b/Shaders/airfield-ALS.frag index 2a016aaaf..1ce745b29 100644 --- a/Shaders/airfield-ALS.frag +++ b/Shaders/airfield-ALS.frag @@ -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; diff --git a/Shaders/filters-ALS.frag b/Shaders/filters-ALS.frag index 46d4914c8..812f4deed 100644 --- a/Shaders/filters-ALS.frag +++ b/Shaders/filters-ALS.frag @@ -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); diff --git a/Shaders/model-ALS-ultra.frag b/Shaders/model-ALS-ultra.frag index 65278c758..04aa8dbd8 100644 --- a/Shaders/model-ALS-ultra.frag +++ b/Shaders/model-ALS-ultra.frag @@ -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 /// diff --git a/Shaders/runway-ALS.frag b/Shaders/runway-ALS.frag index 5fcbf92f5..51d952aba 100644 --- a/Shaders/runway-ALS.frag +++ b/Shaders/runway-ALS.frag @@ -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);} } diff --git a/Shaders/surface-light-ALS.frag b/Shaders/surface-light-ALS.frag index 99efddea2..3dd1bbb40 100644 --- a/Shaders/surface-light-ALS.frag +++ b/Shaders/surface-light-ALS.frag @@ -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);