1
0
Fork 0

Groundwork for ALS g-force blackout filter, WIP

This commit is contained in:
Thorsten Renk 2017-03-03 19:50:13 +02:00
parent 93568a5061
commit 662d782f98
21 changed files with 386 additions and 6 deletions

View file

@ -457,6 +457,17 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>
<type>float</type>

View file

@ -327,6 +327,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>

View file

@ -12,6 +12,8 @@
<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-cloud</use></delta_T>
<fact_grey><use>/sim/rendering/als-filters/grey-factor</use></fact_grey>
<fact_black><use>/sim/rendering/als-filters/black-factor</use></fact_black>
<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>
@ -124,6 +126,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<uniform>
<name>display_xsize</name>
<type>int</type>

View file

@ -21,6 +21,8 @@
<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-cloud</use></delta_T>
<fact_grey><use>/sim/rendering/als-filters/grey-factor</use></fact_grey>
<fact_black><use>/sim/rendering/als-filters/black-factor</use></fact_black>
<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>
@ -182,6 +184,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<uniform>
<name>display_xsize</name>
<type>int</type>

View file

@ -362,6 +362,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>

View file

@ -972,6 +972,18 @@ please see Docs/README.model-combined.eff for documentation
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>
<type>float</type>

View file

@ -30,6 +30,8 @@
<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>
<fact_grey><use>/sim/rendering/als-filters/grey-factor</use></fact_grey>
<fact_black><use>/sim/rendering/als-filters/black-factor</use></fact_black>
<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>
@ -221,6 +223,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<uniform>
<name>view_pitch_offset</name>
<type>float</type>

View file

@ -387,6 +387,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<uniform>
<name>texture</name>
<type>sampler-2d</type>
@ -694,6 +704,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<uniform>
<name>texture</name>
<type>sampler-2d</type>

View file

@ -16,6 +16,8 @@
<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-cloud</use></delta_T>
<fact_grey><use>/sim/rendering/als-filters/grey-factor</use></fact_grey>
<fact_black><use>/sim/rendering/als-filters/black-factor</use></fact_black>
<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>
@ -147,6 +149,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<uniform>
<name>display_xsize</name>
<type>int</type>

View file

@ -325,6 +325,16 @@
<name>delta_T</name>
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>

View file

@ -569,6 +569,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>

View file

@ -38,6 +38,8 @@
<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_IR_vision><use>/sim/rendering/als-filters/use-IR-vision</use></use_IR_vision>
<fact_grey><use>/sim/rendering/als-filters/grey-factor</use></fact_grey>
<fact_black><use>/sim/rendering/als-filters/black-factor</use></fact_black>
<delta_T>-50.0</delta_T>
<air_pollution><use>/environment/air-pollution-norm</use></air_pollution>
</parameters>
@ -191,6 +193,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<uniform>
<name>use_filtering</name>
<type>bool</type>

View file

@ -134,6 +134,8 @@
<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>
<fact_grey><use>/sim/rendering/als-filters/grey-factor</use></fact_grey>
<fact_black><use>/sim/rendering/als-filters/black-factor</use></fact_black>
<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>
@ -518,6 +520,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>
@ -1061,6 +1073,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<uniform>
<name>display_xsize</name>
<type>int</type>
@ -1292,6 +1314,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<uniform>
<name>display_xsize</name>
<type>int</type>

View file

@ -60,6 +60,8 @@
<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>
<fact_grey><use>/sim/rendering/als-filters/grey-factor</use></fact_grey>
<fact_black><use>/sim/rendering/als-filters/black-factor</use></fact_black>
<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-vegetation</use></delta_T>
@ -304,6 +306,16 @@
<name>delta_T</name>
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
@ -794,6 +806,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>
@ -1242,6 +1264,51 @@
<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>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>
<type>float</type>

View file

@ -508,6 +508,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>
@ -1064,6 +1074,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>

View file

@ -647,6 +647,17 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>
<type>float</type>
@ -1306,6 +1317,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- sea colors -->
<uniform>
<name>sea_r</name>

View file

@ -641,6 +641,17 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>
<type>float</type>
@ -1304,6 +1315,16 @@
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<uniform>
<name>fact_grey</name>
<type>float</type>
<value><use>fact_grey</use></value>
</uniform>
<uniform>
<name>fact_black</name>
<type>float</type>
<value><use>fact_black</use></value>
</uniform>
<!-- sea colors -->
<uniform>
<name>sea_r</name>

View file

@ -10,6 +10,8 @@ uniform float gamma;
uniform float brightness;
uniform float delta_T;
uniform float osg_SimulationTime;
uniform float fact_grey;
uniform float fact_black;
uniform bool use_filtering;
uniform bool use_night_vision;
@ -64,6 +66,40 @@ return vec3 (0.7, 0.7, 0.7) * gain;
}
vec3 g_force (in vec3 color) {
vec2 center = vec2 (float(display_xsize) * 0.5, float(display_ysize) * 0.5);
float greyout_band_width = 0.2;
float blackout_band_width = 0.3;
float f_grey = 1.0 - fact_grey;
float greyout = smoothstep( f_grey * display_ysize, (f_grey + greyout_band_width) * display_ysize, length(gl_FragCoord.xy -center));
float tgt_brightness = (1.0 - 0.5 * greyout);
float noise = Noise2D( vec2 (gl_FragCoord.x + 100.0 * osg_SimulationTime,
gl_FragCoord.y + 300.0 * osg_SimulationTime), 8.0);
float f_black = 1.0 - fact_black;
noise *= (1.0 - smoothstep(0.0, 0.5, f_black));
color = mix(color, vec3 (1.0, 1.0, 1.0) * mix(length(color),
tgt_brightness, greyout) , 0.9* greyout + 0.6 * noise);
color *= tgt_brightness;
float blackout = 1.0 - smoothstep( f_black * display_ysize, (f_black + blackout_band_width) * display_ysize, length(gl_FragCoord.xy -center));
color *= blackout;
return color;
}
vec3 filter_combined (in vec3 color) {
if (use_filtering == false)
@ -71,7 +107,7 @@ if (use_filtering == false)
return color;
}
color = g_force(color);
if (use_night_vision)

View file

@ -363,6 +363,9 @@ Started September 2000 by David Megginson, david@megginson.com
<brightness type="float">1.0</brightness>
<use-night-vision type="bool">false</use-night-vision>
<use-IR-vision type="bool">false</use-IR-vision>
<use-normal-filters type="bool">true</use-normal-filters>
<grey-factor type="float">0.0</grey-factor>
<black-factor type="float">0.0</black-factor>
</als-filters>
<scenery-path-suffix>

View file

@ -85,6 +85,33 @@
<group>
<layout>hbox</layout>
<radio>
<halign>left</halign>
<label>Normal</label>
<live>true</live>
<property>/sim/rendering/als-filters/use-normal-filters</property>
<enable>
<property>/sim/rendering/shaders/skydome</property>
<property>/sim/rendering/als-filters/use-filtering</property>
</enable>
<binding>
<command>property-assign</command>
<property>/sim/rendering/als-filters/use-night-vision</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/rendering/als-filters/use-IR-vision</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/rendering/als-filters/use-normal-filters</property>
<value type="bool">true</value>
</binding>
</radio>
<radio>
<halign>left</halign>
<label>Night vision</label>
@ -95,10 +122,15 @@
<property>/sim/rendering/als-filters/use-filtering</property>
</enable>
<binding>
<command>property-toggle</command>
<command>property-assign</command>
<property>/sim/rendering/als-filters/use-night-vision</property>
<value type="bool">true</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/rendering/als-filters/use-normal-filters</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/rendering/als-filters/use-IR-vision</property>
@ -116,7 +148,7 @@
<property>/sim/rendering/als-filters/use-filtering</property>
</enable>
<binding>
<command>property-toggle</command>
<command>property-assign</command>
<property>/sim/rendering/als-filters/use-IR-vision</property>
<value type="bool">true</value>
</binding>
@ -125,6 +157,11 @@
<property>/sim/rendering/als-filters/use-night-vision</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/rendering/als-filters/use-normal-filters</property>
<value type="bool">false</value>
</binding>
</radio>
</group>