1
0
Fork 0

More work on ALS filter code - noise and vignette for night vision, IR vision work

This commit is contained in:
Thorsten Renk 2016-03-17 14:40:37 +02:00
parent 5bd2faab04
commit 8bf55eec3c
14 changed files with 224 additions and 19 deletions

View file

@ -104,6 +104,7 @@
<dust_cover_factor><use>/environment/surface/dust-cover-factor</use></dust_cover_factor> <dust_cover_factor><use>/environment/surface/dust-cover-factor</use></dust_cover_factor>
<fogtype><use>/sim/rendering/shaders/skydome</use></fogtype> <fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
<fogstructure><use>/environment/fog-structure</use></fogstructure> <fogstructure><use>/environment/fog-structure</use></fogstructure>
<delta_T><use>/environment/surface/delta-T-structure</use></delta_T>
<!-- END fog include --> <!-- END fog include -->
</parameters> </parameters>
<!-- Atmospheric scattering technique with model shader--> <!-- Atmospheric scattering technique with model shader-->
@ -190,10 +191,11 @@
</texture-unit> </texture-unit>
<program> <program>
<vertex-shader n="0">Shaders/building-model-ALS-ultra.vert</vertex-shader> <vertex-shader n="0">Shaders/building-model-ALS-ultra.vert</vertex-shader>
<fragment-shader n="1">Shaders/model-ALS-ultra.frag</fragment-shader> <!--<fragment-shader n="0">Shaders/model-ALS-ultra.frag</fragment-shader>
<fragment-shader n="2">Shaders/cloud-shadowfunc.frag</fragment-shader> <fragment-shader n="1">Shaders/cloud-shadowfunc.frag</fragment-shader>
<fragment-shader n="3">Shaders/hazes.frag</fragment-shader> <fragment-shader n="2">Shaders/hazes.frag</fragment-shader>
<fragment-shader n="4">Shaders/secondary_lights.frag</fragment-shader> <fragment-shader n="3">Shaders/secondary_lights.frag</fragment-shader>
<fragment-shader n="4">Shaders/filters-ALS.frag</fragment-shader>-->
</program> </program>
</pass> </pass>
</technique> </technique>

View file

@ -20,7 +20,11 @@
<use_filtering><use>/sim/rendering/als-filters/use-filtering</use></use_filtering> <use_filtering><use>/sim/rendering/als-filters/use-filtering</use></use_filtering>
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma> <gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness> <brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
<delta_T><use>/environment/surface/delta-T-cloud</use></delta_T>
<use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_vision> <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>
<display_xsize><use>/sim/startup/xsize</use></display_xsize>
<display_ysize><use>/sim/startup/ysize</use></display_ysize>
</parameters> </parameters>
<technique n="9"> <technique n="9">
@ -68,6 +72,7 @@
<vertex-shader>Shaders/3dcloud-ALS.vert</vertex-shader> <vertex-shader>Shaders/3dcloud-ALS.vert</vertex-shader>
<fragment-shader>Shaders/3dcloud-ALS.frag</fragment-shader> <fragment-shader>Shaders/3dcloud-ALS.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader> <fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>
<attribute> <attribute>
<name>usrAttr1</name> <name>usrAttr1</name>
<index>10</index> <index>10</index>
@ -167,6 +172,26 @@
<type>bool</type> <type>bool</type>
<value><use>use_night_vision</use></value> <value><use>use_night_vision</use></value>
</uniform> </uniform>
<uniform>
<name>use_IR_vision</name>
<type>bool</type>
<value><use>use_IR_vision</use></value>
</uniform>
<uniform>
<name>delta_T</name>
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>display_xsize</name>
<type>int</type>
<value><use>display_xsize</use></value>
</uniform>
<uniform>
<name>display_ysize</name>
<type>int</type>
<value><use>display_ysize</use></value>
</uniform>
<!--<vertex-program-two-side>true</vertex-program-two-side>--> <!--<vertex-program-two-side>true</vertex-program-two-side>-->
</pass> </pass>
</technique> </technique>

View file

@ -145,6 +145,7 @@ please see Docs/README.model-combined.eff for documentation
<fogtype><use>/sim/rendering/shaders/skydome</use></fogtype> <fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
<wetness><use>/environment/surface/wetness</use></wetness> <wetness><use>/environment/surface/wetness</use></wetness>
<rnorm><use>/environment/rain-norm</use></rnorm> <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_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> <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> <cloudpos2_x><use>/local-weather/cloud-shadows/cloudpos-x[1]</use></cloudpos2_x>
@ -435,11 +436,12 @@ please see Docs/README.model-combined.eff for documentation
<program> <program>
<vertex-shader n="0">Shaders/model-ALS-ultra.vert</vertex-shader> <vertex-shader n="0">Shaders/model-ALS-ultra.vert</vertex-shader>
<fragment-shader n="1">Shaders/model-ALS-ultra.frag</fragment-shader> <fragment-shader n="0">Shaders/model-ALS-ultra.frag</fragment-shader>
<fragment-shader n="2">Shaders/cloud-shadowfunc.frag</fragment-shader> <fragment-shader n="1">Shaders/cloud-shadowfunc.frag</fragment-shader>
<fragment-shader n="3">Shaders/hazes.frag</fragment-shader> <fragment-shader n="2">Shaders/hazes.frag</fragment-shader>
<fragment-shader n="4">Shaders/secondary_lights.frag</fragment-shader> <fragment-shader n="3">Shaders/secondary_lights.frag</fragment-shader>
<fragment-shader n="5">Shaders/noise.frag</fragment-shader> <fragment-shader n="4">Shaders/noise.frag</fragment-shader>
<fragment-shader n="5">Shaders/filters-ALS.frag</fragment-shader>
</program> </program>
<uniform> <uniform>
@ -914,11 +916,41 @@ please see Docs/README.model-combined.eff for documentation
<type>float</type> <type>float</type>
<value><use>landing_light2_offset</use></value> <value><use>landing_light2_offset</use></value>
</uniform> </uniform>
<uniform> <uniform>
<name>landing_light3_offset</name> <name>landing_light3_offset</name>
<type>float</type> <type>float</type>
<value><use>landing_light3_offset</use></value> <value><use>landing_light3_offset</use></value>
</uniform> </uniform>
<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_filtering</name>
<type>bool</type>
<value><use>use_filtering</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>delta_T</name>
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform> <uniform>
<name>cloudpos1_x</name> <name>cloudpos1_x</name>
<type>float</type> <type>float</type>

View file

@ -26,6 +26,12 @@
<moonlight><use>/environment/moonlight</use></moonlight> <moonlight><use>/environment/moonlight</use></moonlight>
<fogtype><use>/sim/rendering/shaders/skydome</use></fogtype> <fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
<air_pollution><use>/environment/air-pollution-norm</use></air_pollution> <air_pollution><use>/environment/air-pollution-norm</use></air_pollution>
<use_filtering><use>/sim/rendering/als-filters/use-filtering</use></use_filtering>
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
<delta_T><use>/environment/surface/delta-T-structure</use></delta_T>
<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>
<display_xsize><use>/sim/startup/xsize</use></display_xsize> <display_xsize><use>/sim/startup/xsize</use></display_xsize>
<display_ysize><use>/sim/startup/ysize</use></display_ysize> <display_ysize><use>/sim/startup/ysize</use></display_ysize>
<view_pitch_offset><use>/sim/current-view/pitch-offset-deg</use></view_pitch_offset> <view_pitch_offset><use>/sim/current-view/pitch-offset-deg</use></view_pitch_offset>
@ -108,6 +114,7 @@
<fragment-shader>Shaders/model-ALS-base.frag</fragment-shader> <fragment-shader>Shaders/model-ALS-base.frag</fragment-shader>
<fragment-shader>Shaders/hazes.frag</fragment-shader> <fragment-shader>Shaders/hazes.frag</fragment-shader>
<fragment-shader>Shaders/secondary_lights.frag</fragment-shader> <fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
</program> </program>
<uniform> <uniform>
<name>visibility</name> <name>visibility</name>
@ -174,6 +181,36 @@
<type>float</type> <type>float</type>
<value><use>air_pollution</use></value> <value><use>air_pollution</use></value>
</uniform> </uniform>
<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_filtering</name>
<type>bool</type>
<value><use>use_filtering</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>delta_T</name>
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform> <uniform>
<name>view_pitch_offset</name> <name>view_pitch_offset</name>
<type>float</type> <type>float</type>

View file

@ -37,6 +37,8 @@
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma> <gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness> <brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
<use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_vision> <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>
<delta_T>-50.0</delta_T>
<air_pollution><use>/environment/air-pollution-norm</use></air_pollution> <air_pollution><use>/environment/air-pollution-norm</use></air_pollution>
</parameters> </parameters>
<technique n="8"> <technique n="8">
@ -184,6 +186,11 @@
<type>float</type> <type>float</type>
<value><use>brightness</use></value> <value><use>brightness</use></value>
</uniform> </uniform>
<uniform>
<name>delta_T</name>
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform> <uniform>
<name>use_filtering</name> <name>use_filtering</name>
<type>bool</type> <type>bool</type>
@ -194,6 +201,11 @@
<type>bool</type> <type>bool</type>
<value><use>use_night_vision</use></value> <value><use>use_night_vision</use></value>
</uniform> </uniform>
<uniform>
<name>use_IR_vision</name>
<type>bool</type>
<value><use>use_IR_vision</use></value>
</uniform>
<uniform> <uniform>
<name>view_pitch_offset</name> <name>view_pitch_offset</name>
<type>float</type> <type>float</type>

View file

@ -114,6 +114,7 @@
<moonlight><use>/environment/moonlight</use></moonlight> <moonlight><use>/environment/moonlight</use></moonlight>
<season><use>/environment/season</use></season> <season><use>/environment/season</use></season>
<air_pollution><use>/environment/air-pollution-norm</use></air_pollution> <air_pollution><use>/environment/air-pollution-norm</use></air_pollution>
<delta_T><use>/environment/surface/delta-T-soil</use></delta_T>
<wind_effects><use>/sim/rendering/shaders/wind-effects</use></wind_effects> <wind_effects><use>/sim/rendering/shaders/wind-effects</use></wind_effects>
<windE><use>/environment/sea/surface/wind-from-east-fps</use></windE> <windE><use>/environment/sea/surface/wind-from-east-fps</use></windE>
<windN><use>/environment/sea/surface/wind-from-north-fps</use></windN> <windN><use>/environment/sea/surface/wind-from-north-fps</use></windN>
@ -134,6 +135,7 @@
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma> <gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness> <brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
<use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_vision> <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>
<cloudpos1_x><use>/local-weather/cloud-shadows/cloudpos-x[0]</use></cloudpos1_x> <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> <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> <cloudpos2_x><use>/local-weather/cloud-shadows/cloudpos-x[1]</use></cloudpos2_x>
@ -499,11 +501,21 @@
<type>bool</type> <type>bool</type>
<value><use>use_night_vision</use></value> <value><use>use_night_vision</use></value>
</uniform> </uniform>
<uniform>
<name>use_IR_vision</name>
<type>bool</type>
<value><use>use_IR_vision</use></value>
</uniform>
<uniform> <uniform>
<name>use_filtering</name> <name>use_filtering</name>
<type>bool</type> <type>bool</type>
<value><use>use_filtering</use></value> <value><use>use_filtering</use></value>
</uniform> </uniform>
<uniform>
<name>delta_T</name>
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform> <uniform>
<name>cloudpos1_x</name> <name>cloudpos1_x</name>
<type>float</type> <type>float</type>

View file

@ -151,6 +151,8 @@
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma> <gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness> <brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
<use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_vision> <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>
<delta_T><use>/environment/surface/delta-T-water</use></delta_T>
<!-- cloud shadows --> <!-- cloud shadows -->
<cloudpos1_x><use>/local-weather/cloud-shadows/cloudpos-x[0]</use></cloudpos1_x> <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> <cloudpos1_y><use>/local-weather/cloud-shadows/cloudpos-y[0]</use></cloudpos1_y>
@ -635,6 +637,16 @@
<type>bool</type> <type>bool</type>
<value><use>use_night_vision</use></value> <value><use>use_night_vision</use></value>
</uniform> </uniform>
<uniform>
<name>use_IR_vision</name>
<type>bool</type>
<value><use>use_IR_vision</use></value>
</uniform>
<uniform>
<name>delta_T</name>
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform> <uniform>
<name>cloudpos1_x</name> <name>cloudpos1_x</name>
<type>float</type> <type>float</type>

View file

@ -143,6 +143,8 @@
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma> <gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness> <brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
<use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_vision> <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>
<delta_T><use>/environment/surface/delta-T-water</use></delta_T>
<!-- cloud shadows --> <!-- cloud shadows -->
<cloudpos1_x><use>/local-weather/cloud-shadows/cloudpos-x[0]</use></cloudpos1_x> <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> <cloudpos1_y><use>/local-weather/cloud-shadows/cloudpos-y[0]</use></cloudpos1_y>
@ -628,6 +630,16 @@
<type>bool</type> <type>bool</type>
<value><use>use_night_vision</use></value> <value><use>use_night_vision</use></value>
</uniform> </uniform>
<uniform>
<name>use_IR_vision</name>
<type>bool</type>
<value><use>use_IR_vision</use></value>
</uniform>
<uniform>
<name>delta_T</name>
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform> <uniform>
<name>cloudpos1_x</name> <name>cloudpos1_x</name>
<type>float</type> <type>float</type>

View file

@ -460,7 +460,11 @@
<wetness-set type="double" userarchive="y">0.0</wetness-set> <wetness-set type="double" userarchive="y">0.0</wetness-set>
<wetness type="double" userarchive="n">0.0</wetness> <wetness type="double" userarchive="n">0.0</wetness>
<snow-thickness-factor type="double" userarchive="y">1.0</snow-thickness-factor> <snow-thickness-factor type="double" userarchive="y">1.0</snow-thickness-factor>
<delta-T-soil type="double" userarchive="n">0.0</delta-T-soil>
<delta-T-rock type="double" userarchive="n">0.0</delta-T-rock>
<delta-T-water type="double" userarchive="n">0.0</delta-T-water>
<delta-T-cloud type="double" userarchive="n">0.0</delta-T-cloud>
<delta-T-structure type="double" userarchive="n">0.0</delta-T-structure>
</surface> </surface>
<!-- definitions for lightning functionality --> <!-- definitions for lightning functionality -->

View file

@ -38,6 +38,7 @@ uniform float overcast;
//uniform float scattering; //uniform float scattering;
uniform float ground_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? // This is the value used in the skydome scattering shader - use the same here for consistency?
const float EarthRadius = 5800000.0; const float EarthRadius = 5800000.0;
@ -229,6 +230,11 @@ else // the faster, full-day version without lightfields
yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); 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 // default lighting based on texture and material using the light we have just computed

View file

@ -8,10 +8,17 @@
uniform float gamma; uniform float gamma;
uniform float brightness; uniform float brightness;
uniform float delta_T;
uniform float osg_SimulationTime;
uniform bool use_filtering; uniform bool use_filtering;
uniform bool use_night_vision; 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) { vec3 gamma_correction (in vec3 color) {
@ -31,7 +38,29 @@ vec3 night_vision (in vec3 color) {
float value = length(color)/1.732; 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); color = night_vision(color);
} }
else if (use_IR_vision)
{
color = IR_vision(color);
}
return gamma_correction (color); return gamma_correction (color);
} }

View file

@ -77,6 +77,8 @@ uniform float landing_light1_offset;
uniform float landing_light2_offset; uniform float landing_light2_offset;
uniform float landing_light3_offset; uniform float landing_light3_offset;
uniform bool use_IR_vision;
// constants needed by the light and fog computations ################################################### // constants needed by the light and fog computations ###################################################
const float EarthRadius = 5800000.0; 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 get_hazeColor(in float lightArg);
vec3 searchlight(); vec3 searchlight();
vec3 landing_light(in float offset, in float offsetv); 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) 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 /// END light
/// BEGIN grain overlay /// BEGIN grain overlay
@ -297,7 +300,11 @@ void main (void)
vec4 Diffuse = light_diffuse * nDotVP; 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; 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); 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 = mix(hazeColor +secondary_light * fog_backscatter(mvisibility), fragColor.rgb,transmission);
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor; gl_FragColor = fragColor;
} }

View file

@ -43,6 +43,8 @@ uniform float ground_scattering;
uniform float eye_alt; uniform float eye_alt;
uniform float moonlight; uniform float moonlight;
uniform bool use_IR_vision;
uniform mat4 osg_ViewMatrixInverse; uniform mat4 osg_ViewMatrixInverse;
float earthShade; float earthShade;
@ -72,7 +74,7 @@ void main()
vec4 light_diffuse; vec4 light_diffuse;
vec4 light_ambient; vec4 light_ambient;
vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); 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_alt;
float yprime; 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_ambient.rgb = light_ambient.rgb * (1.0 - shade_depth);
light_diffuse.rgb = light_diffuse.rgb * (1.0 + 1.2 * 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 // default lighting based on texture and material using the light we have just computed

View file

@ -297,6 +297,7 @@ Started September 2000 by David Megginson, david@megginson.com
<gamma type="float">0.0</gamma> <gamma type="float">0.0</gamma>
<brightness type="float">1.0</brightness> <brightness type="float">1.0</brightness>
<use-night-vision type="bool">false</use-night-vision> <use-night-vision type="bool">false</use-night-vision>
<use-IR-vision type="bool">false</use-IR-vision>
</als-filters> </als-filters>
</rendering> </rendering>
<model-hz type="int">120</model-hz> <model-hz type="int">120</model-hz>