diff --git a/Effects/building.eff b/Effects/building.eff
index 70e429dba..58d3e0346 100644
--- a/Effects/building.eff
+++ b/Effects/building.eff
@@ -104,6 +104,7 @@
+
@@ -190,10 +191,11 @@
Shaders/building-model-ALS-ultra.vert
- Shaders/model-ALS-ultra.frag
- Shaders/cloud-shadowfunc.frag
- Shaders/hazes.frag
- Shaders/secondary_lights.frag
+
diff --git a/Effects/cloud.eff b/Effects/cloud.eff
index b133b799f..647d8773b 100644
--- a/Effects/cloud.eff
+++ b/Effects/cloud.eff
@@ -20,7 +20,11 @@
+
+
+
+
@@ -68,6 +72,7 @@
Shaders/3dcloud-ALS.vert
Shaders/3dcloud-ALS.frag
Shaders/filters-ALS.frag
+ Shaders/noise.frag
usrAttr1
10
@@ -167,6 +172,26 @@
bool
+
+ use_IR_vision
+ bool
+
+
+
+ delta_T
+ float
+
+
+
+ display_xsize
+ int
+
+
+
+ display_ysize
+ int
+
+
diff --git a/Effects/model-combined.eff b/Effects/model-combined.eff
index e24078462..662e53ae6 100644
--- a/Effects/model-combined.eff
+++ b/Effects/model-combined.eff
@@ -145,6 +145,7 @@ please see Docs/README.model-combined.eff for documentation
+
@@ -435,11 +436,12 @@ please see Docs/README.model-combined.eff for documentation
Shaders/model-ALS-ultra.vert
- Shaders/model-ALS-ultra.frag
- Shaders/cloud-shadowfunc.frag
- Shaders/hazes.frag
- Shaders/secondary_lights.frag
- Shaders/noise.frag
+ Shaders/model-ALS-ultra.frag
+ Shaders/cloud-shadowfunc.frag
+ Shaders/hazes.frag
+ Shaders/secondary_lights.frag
+ Shaders/noise.frag
+ Shaders/filters-ALS.frag
@@ -914,11 +916,41 @@ please see Docs/README.model-combined.eff for documentation
float
-
- landing_light3_offset
- float
-
-
+
+ landing_light3_offset
+ float
+
+
+
+ gamma
+ float
+
+
+
+ brightness
+ float
+
+
+
+ use_filtering
+ bool
+
+
+
+ use_night_vision
+ bool
+
+
+
+ use_IR_vision
+ bool
+
+
+
+ delta_T
+ float
+
+
cloudpos1_x
float
diff --git a/Effects/model-default.eff b/Effects/model-default.eff
index d9e6e8066..fbca771f1 100644
--- a/Effects/model-default.eff
+++ b/Effects/model-default.eff
@@ -26,6 +26,12 @@
+
+
+
+
+
+
@@ -108,6 +114,7 @@
Shaders/model-ALS-base.frag
Shaders/hazes.frag
Shaders/secondary_lights.frag
+ Shaders/filters-ALS.frag
visibility
@@ -174,6 +181,36 @@
float
+
+ gamma
+ float
+
+
+
+ brightness
+ float
+
+
+
+ use_filtering
+ bool
+
+
+
+ use_night_vision
+ bool
+
+
+
+ use_IR_vision
+ bool
+
+
+
+ delta_T
+ float
+
+
view_pitch_offset
float
diff --git a/Effects/skydome.eff b/Effects/skydome.eff
index 1d612a6e7..90859d566 100644
--- a/Effects/skydome.eff
+++ b/Effects/skydome.eff
@@ -37,6 +37,8 @@
+
+ -50.0
@@ -184,6 +186,11 @@
float
+
+ delta_T
+ float
+
+
use_filtering
bool
@@ -194,6 +201,11 @@
bool
+
+ use_IR_vision
+ bool
+
+
view_pitch_offset
float
diff --git a/Effects/terrain-default.eff b/Effects/terrain-default.eff
index c42c22ba5..492f64537 100644
--- a/Effects/terrain-default.eff
+++ b/Effects/terrain-default.eff
@@ -114,6 +114,7 @@
+
@@ -134,6 +135,7 @@
+
@@ -499,11 +501,21 @@
bool
+
+ use_IR_vision
+ bool
+
+
use_filtering
bool
+
+ delta_T
+ float
+
+
cloudpos1_x
float
diff --git a/Effects/water-inland.eff b/Effects/water-inland.eff
index 379577156..a590509c9 100644
--- a/Effects/water-inland.eff
+++ b/Effects/water-inland.eff
@@ -151,6 +151,8 @@
+
+
@@ -635,6 +637,16 @@
bool
+
+ use_IR_vision
+ bool
+
+
+
+ delta_T
+ float
+
+
cloudpos1_x
float
diff --git a/Effects/water.eff b/Effects/water.eff
index 0e3f7ae21..9387c1c68 100644
--- a/Effects/water.eff
+++ b/Effects/water.eff
@@ -143,6 +143,8 @@
+
+
@@ -628,6 +630,16 @@
bool
+
+ use_IR_vision
+ bool
+
+
+
+ delta_T
+ float
+
+
cloudpos1_x
float
diff --git a/Environment/environment.xml b/Environment/environment.xml
index da70f8448..161544e63 100644
--- a/Environment/environment.xml
+++ b/Environment/environment.xml
@@ -460,7 +460,11 @@
0.0
0.0
1.0
-
+ 0.0
+ 0.0
+ 0.0
+ 0.0
+ 0.0
diff --git a/Shaders/building-ALS.vert b/Shaders/building-ALS.vert
index e677feff5..1a53f6593 100644
--- a/Shaders/building-ALS.vert
+++ b/Shaders/building-ALS.vert
@@ -38,6 +38,7 @@ uniform float overcast;
//uniform float scattering;
uniform float ground_scattering;
+uniform bool use_IR_vision;
// This is the value used in the skydome scattering shader - use the same here for consistency?
const float EarthRadius = 5800000.0;
@@ -229,6 +230,11 @@ else // the faster, full-day version without lightfields
yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude);
}
+if (use_IR_vision)
+ {
+ light_ambient.rgb = max(light_ambient.rgb, vec3 (0.5, 0.5, 0.5));
+ }
+
// default lighting based on texture and material using the light we have just computed
diff --git a/Shaders/filters-ALS.frag b/Shaders/filters-ALS.frag
index 9f7fd4cf9..46d4914c8 100644
--- a/Shaders/filters-ALS.frag
+++ b/Shaders/filters-ALS.frag
@@ -8,10 +8,17 @@
uniform float gamma;
uniform float brightness;
+uniform float delta_T;
+uniform float osg_SimulationTime;
uniform bool use_filtering;
uniform bool use_night_vision;
+uniform bool use_IR_vision;
+uniform int display_xsize;
+uniform int display_ysize;
+
+float Noise2D(in vec2 coord, in float wavelength);
vec3 gamma_correction (in vec3 color) {
@@ -31,7 +38,29 @@ vec3 night_vision (in vec3 color) {
float value = length(color)/1.732;
-return vec3 (0.0, 1.0, 0.0) * value;
+vec2 center = vec2 (float(display_xsize) * 0.5, float(display_ysize) * 0.5);
+float noise = Noise2D( vec2 (gl_FragCoord.x + 100.0 * osg_SimulationTime, gl_FragCoord.y + 300.0 * osg_SimulationTime), 4.0);
+
+float fade = 1.0 - smoothstep( 0.3 * display_ysize, 0.55 * display_ysize, length(gl_FragCoord.xy -center));
+
+return vec3 (0.0, 1.0, 0.0) * value * (0.5 + 0.5 * noise) * fade;
+
+}
+
+
+vec3 IR_vision (in vec3 color) {
+
+float value = length(color)/1.732;
+value = 1.0 - value;
+
+float T_mapped = smoothstep(-10.0, 10.0, delta_T);
+
+float gain = mix(T_mapped, value, 0.7);
+//float gain = 0.2 * T_mapped + 0.8 * value * T_mapped;
+if (delta_T < -10.0) {gain = 0.0;}
+
+
+return vec3 (0.7, 0.7, 0.7) * gain;
}
@@ -50,6 +79,11 @@ if (use_night_vision)
color = night_vision(color);
}
+else if (use_IR_vision)
+ {
+ color = IR_vision(color);
+ }
+
return gamma_correction (color);
}
diff --git a/Shaders/model-ALS-ultra.frag b/Shaders/model-ALS-ultra.frag
index 3156d1ed1..65278c758 100644
--- a/Shaders/model-ALS-ultra.frag
+++ b/Shaders/model-ALS-ultra.frag
@@ -77,6 +77,8 @@ uniform float landing_light1_offset;
uniform float landing_light2_offset;
uniform float landing_light3_offset;
+uniform bool use_IR_vision;
+
// constants needed by the light and fog computations ###################################################
const float EarthRadius = 5800000.0;
@@ -103,7 +105,7 @@ vec3 rayleigh_out_shift(in vec3 color, in float outscatter);
vec3 get_hazeColor(in float lightArg);
vec3 searchlight();
vec3 landing_light(in float offset, in float offsetv);
-
+vec3 filter_combined (in vec3 color) ;
float light_func (in float x, in float a, in float b, in float c, in float d, in float e)
@@ -213,6 +215,7 @@ void main (void)
}
+
/// END light
/// BEGIN grain overlay
@@ -297,7 +300,11 @@ void main (void)
vec4 Diffuse = light_diffuse * nDotVP;
- Diffuse.rgb += secondary_light * light_distance_fading(dist);
+ Diffuse.rgb += secondary_light * light_distance_fading(dist);
+ if (use_IR_vision)
+ {
+ Diffuse.rgb = max(Diffuse.rgb, vec3 (0.5, 0.5, 0.5));
+ }
vec4 Specular = gl_FrontMaterial.specular * light_diffuse * pf + gl_FrontMaterial.specular * light_ambient * pf1;
Specular+= gl_FrontMaterial.specular * pow(max(0.0,-dot(N,normalize(vertVec))),gl_FrontMaterial.shininess) * vec4(secondary_light,1.0);
@@ -558,5 +565,8 @@ void main (void)
fragColor.rgb = mix(hazeColor +secondary_light * fog_backscatter(mvisibility), fragColor.rgb,transmission);
+
+
+ fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
}
diff --git a/Shaders/terrain-ALS-ultra.vert b/Shaders/terrain-ALS-ultra.vert
index 4ce7efa65..9792d59c3 100644
--- a/Shaders/terrain-ALS-ultra.vert
+++ b/Shaders/terrain-ALS-ultra.vert
@@ -43,6 +43,8 @@ uniform float ground_scattering;
uniform float eye_alt;
uniform float moonlight;
+uniform bool use_IR_vision;
+
uniform mat4 osg_ViewMatrixInverse;
float earthShade;
@@ -72,7 +74,7 @@ void main()
vec4 light_diffuse;
vec4 light_ambient;
vec3 shadedFogColor = vec3(0.55, 0.67, 0.88);
- vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
+ vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight + vec3 (0.005, 0.005, 0.005);
//float yprime_alt;
float yprime;
@@ -266,6 +268,10 @@ float shade_depth = 1.0 * smoothstep (0.6,0.95,ground_scattering) * (1.0-smooth
light_ambient.rgb = light_ambient.rgb * (1.0 - shade_depth);
light_diffuse.rgb = light_diffuse.rgb * (1.0 + 1.2 * shade_depth);
+if (use_IR_vision)
+ {
+ light_ambient.rgb = max(light_ambient.rgb, vec3 (0.5, 0.5, 0.5));
+ }
// default lighting based on texture and material using the light we have just computed
diff --git a/preferences.xml b/preferences.xml
index bb540aeee..1dbbfaa34 100644
--- a/preferences.xml
+++ b/preferences.xml
@@ -297,6 +297,7 @@ Started September 2000 by David Megginson, david@megginson.com
0.0
1.0
false
+ false
120