1
0
Fork 0

Basic Weather integration with Atmospheric Shader.

This commit is contained in:
Stuart Buchanan 2013-04-16 22:09:44 +01:00
parent e12f7b8ff3
commit 823510f0b4

View file

@ -16,7 +16,7 @@
General Public License for more details. General Public License for more details.
--> -->
<!-- <!--
Compute local weather related properties Compute Atmospheric Light Shading related properties
--> -->
<PropertyList> <PropertyList>
@ -45,4 +45,710 @@
<type>gain</type> <type>gain</type>
<gain>0.30480</gain> <gain>0.30480</gain>
</filter> </filter>
<!-- Properties used by the atmospheric scattering shader, when not being set directly
by Advanced Weather -->
<filter>
<!-- Ground visibility. Same as lowest boundary layer. -->
<name>EnvironmentInterpolator:AtmosphericShader:ground-visibility-m</name>
<type>gain</type>
<enable>
<condition>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
</condition>
</enable>
<input>/environment/config/boundary/entry[0]/visibility-m</input>
<output>/environment/ground-visibility-m</output>
</filter>
<filter>
<!-- Ground haze level - assumed to be up to the lowest cloud layer. -->
<name>EnvironmentInterpolator:AtmosphericShader:GroundHazeThickness</name>
<type>gain</type>
<enable>
<condition>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
</condition>
</enable>
<input>
<expression>
<sum>
<property>/environment/clouds/layer[0]/elevation-ft</property>
<property>/environment/clouds/layer[0]/thickness-ft</property>
</sum>
</expression>
</input>
<gain>
<!-- feet to meters -->
<value>0.3048</value>
</gain>
<u_min>
<value>0</value>
</u_min>
<u_max>
<!-- haze maxes out at 6000ft. Could probably do something using lapse rates instead -->
<value>2000</value>
</u_max>
<output>/environment/ground-haze-thickness-m</output>
</filter>
<!-- Build up the ground level scattering from 1 for clear skies to 0.6 for overcast -->
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:GroundScattering:0:Clear</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<equals>
<property>/environment/clouds/layer[0]/coverage</property>
<value>clear</value>
</equals>
</and>
</condition>
</enable>
<input>
<value>1</value>
</input>
<output>/environment/surface/ground-scattering</output>
</filter>
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:GroundScattering:0:Few</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<equals>
<property>/environment/clouds/layer[0]/coverage</property>
<value>few</value>
</equals>
</and>
</condition>
</enable>
<input>
<value>0.9</value>
</input>
<output>/environment/surface/ground-scattering</output>
</filter>
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:GroundScattering:0:Scattered</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<equals>
<property>/environment/clouds/layer[0]/coverage</property>
<value>scattered</value>
</equals>
</and>
</condition>
</enable>
<input>
<value>0.8</value>
</input>
<output>/environment/surface/ground-scattering</output>
</filter>
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:GroundScattering:0:Broken</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<equals>
<property>/environment/clouds/layer[0]/coverage</property>
<value>broken</value>
</equals>
</and>
</condition>
</enable>
<input>
<value>0.7</value>
</input>
<output>/environment/surface/ground-scattering</output>
</filter>
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:GroundScattering:0:Overcast</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<equals>
<property>/environment/clouds/layer[0]/coverage</property>
<value>overcast</value>
</equals>
</and>
</condition>
</enable>
<input>
<value>0.6</value>
</input>
<output>/environment/surface/ground-scattering</output>
</filter>
<!-- TODO: Handle layers beyond the first -->
<!-- Set the scattering at the aircraft level -->
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:Scattering:AircraftAboveLayer</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<greater-than>
<property>/position/altitude-ft</property>
<expression>
<sum>
<property>/environment/clouds/layer[0]/elevation-ft</property>
<property>/environment/clouds/layer[0]/thickness-ft</property>
</sum>
</expression>
</greater-than>
</and>
</condition>
</enable>
<input>
<value>1</value>
</input>
<output>/rendering/scene/scattering</output>
</filter>
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:Scattering:AircraftBelowLayer</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<less-than-equals>
<property>/position/altitude-ft</property>
<expression>
<sum>
<property>/environment/clouds/layer[0]/elevation-ft</property>
<property>/environment/clouds/layer[0]/thickness-ft</property>
</sum>
</expression>
</less-than-equals>
</and>
</condition>
</enable>
<input>/environment/surface/ground-scattering</input>
<output>/rendering/scene/scattering</output>
</filter>
<!-- Clouds self-shading -->
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:CloudSelfShading</name>
<type>gain</type>
<enable>
<condition>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
</condition>
</enable>
<input>
<!-- TODO : Make this sun-angle dependent -->
<value>1.0</value>
</input>
<output>/environment/cloud-self-shading</output>
</filter>
<!-- Skydome parameters - /sim/rendering/[mie|rayleigh|dome-density] -->
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:VisFactor</name>
<type>gain</type>
<enable>
<condition>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
</condition>
</enable>
<input>
<expression>
<product>
<difference>
<property>/environment/visibility-m</property>
<value>30000</value>
</difference>
<value>0.000011111</value>
</product>
</expression>
</input>
<u_min>0.0</u_min>
<u_max>1.0</u_max>
<output>/sim/rendering/skydome-vis-factor</output>
</filter>
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Rayleigh:Low</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<less-than>
<property>/position/altitude-ft</property>
<value>36000</value>
</less-than>
</and>
</condition>
</enable>
<input>
<expression>
<difference>
<value>0.0003</value>
<product>
<property>/sim/rendering/skydome-vis-factor</property>
<value>0.0001</value>
</product>
</difference>
</expression>
</input>
<output>/sim/rendering/rayleigh-no-polution</output>
</filter>
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Rayleigh:Medium</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<greater-than>
<property>/position/altitude-ft</property>
<value>36000</value>
</greater-than>
<less-than>
<property>/position/altitude-ft</property>
<value>85000</value>
</less-than>
</and>
</condition>
</enable>
<input>
<expression>
<difference>
<difference>
<value>0.0003</value>
<product>
<property>/sim/rendering/skydome-vis-factor</property>
<value>0.0001</value>
</product>
</difference>
<product>
<difference>
<property>/position/altitude-ft</property>
<value>36000</value>
</difference>
<value>0.000000002</value>
</product>
</difference>
</expression>
</input>
<output>/sim/rendering/rayleigh-no-polution</output>
</filter>
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Rayleigh:High</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<greater-than>
<property>/position/altitude-ft</property>
<value>85000</value>
</greater-than>
</and>
</condition>
</enable>
<input>
<expression>
<difference>
<value>0.0002</value>
<product>
<property>/sim/rendering/skydome-vis-factor</property>
<value>0.0001</value>
</product>
</difference>
</expression>
</input>
<output>/sim/rendering/rayleigh-no-polution</output>
</filter>
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Rayleight:Polution:Low</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<less-than-equals>
<property>/position/altitude-ft</property>
<expression>
<sum>
<property>/environment/clouds/layer[0]/elevation-ft</property>
<property>/environment/clouds/layer[0]/thickness-ft</property>
</sum>
</expression>
</less-than-equals>
</and>
</condition>
</enable>
<input>
<expression>
<sum>
<property>/sim/rendering/rayleigh-no-polution</property>
<product>
<property>/environment/air-pollution-norm</property>
<value>0.0003</value>
</product>
<product>
<property>/environment/air-pollution-norm</property>
<value>0.0004</value>
<difference>
<value>1.0</value>
<product>
<div>
<property>/position/altitude-ft</property>
<sum>
<property>/environment/clouds/layer[0]/elevation-ft</property>
<property>/environment/clouds/layer[0]/thickness-ft</property>
<value>1.0</value><!-- to avoid divide by 0 exceptions -->
</sum>
</div>
<div>
<property>/position/altitude-ft</property>
<sum>
<property>/environment/clouds/layer[0]/elevation-ft</property>
<property>/environment/clouds/layer[0]/thickness-ft</property>
<value>1.0</value><!-- to avoid divide by 0 exceptions -->
</sum>
</div>
</product>
</difference>
</product>
</sum>
</expression>
</input>
<output>/sim/rendering/rayleigh</output>
</filter>
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Rayleight:Polution:High</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<greater-than>
<property>/position/altitude-ft</property>
<expression>
<sum>
<property>/environment/clouds/layer[0]/elevation-ft</property>
<property>/environment/clouds/layer[0]/thickness-ft</property>
</sum>
</expression>
</greater-than>
</and>
</condition>
</enable>
<input>
<expression>
<sum>
<property>/sim/rendering/rayleigh-no-polution</property>
<product>
<property>/environment/air-pollution-norm</property>
<value>0.0003</value>
</product>
</sum>
</expression>
</input>
<output>/sim/rendering/rayleigh</output>
</filter>
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Mie:Low</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<less-than>
<property>/position/altitude-ft</property>
<value>36000</value>
</less-than>
</and>
</condition>
</enable>
<input>
<expression>
<difference>
<value>0.005</value>
<product>
<property>/sim/rendering/skydome-vis-factor</property>
<value>0.002</value>
</product>
</difference>
</expression>
</input>
<output>/sim/rendering/mie</output>
</filter>
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Mie:Medium</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<greater-than>
<property>/position/altitude-ft</property>
<value>36000</value>
</greater-than>
<less-than>
<property>/position/altitude-ft</property>
<value>85000</value>
</less-than>
</and>
</condition>
</enable>
<input>
<expression>
<difference>
<difference>
<value>0.005</value>
<product>
<property>/sim/rendering/skydome-vis-factor</property>
<value>0.002</value>
</product>
</difference>
<product>
<difference>
<property>/position/altitude-ft</property>
<value>36000</value>
</difference>
<value>0.00000004</value>
</product>
</difference>
</expression>
</input>
<output>/sim/rendering/mie</output>
</filter>
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Mie:High</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<greater-than>
<property>/position/altitude-ft</property>
<value>85000</value>
</greater-than>
</and>
</condition>
</enable>
<input>
<expression>
<difference>
<value>0.003</value>
<product>
<property>/sim/rendering/skydome-vis-factor</property>
<value>0.002</value>
</product>
</difference>
</expression>
</input>
<output>/sim/rendering/mie</output>
</filter>
<!-- Density -->
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Density:Low</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<less-than-equals>
<property>/position/altitude-ft</property>
<expression>
<sum>
<property>/environment/clouds/layer[0]/elevation-ft</property>
<property>/environment/clouds/layer[0]/thickness-ft</property>
</sum>
</expression>
</less-than-equals>
</and>
</condition>
</enable>
<input>
<expression>
<sum>
<value>0.3</value>
<product>
<property>/environment/air-pollution-norm</property>
<value>0.05</value>
</product>
<product>
<property>/environment/air-pollution-norm</property>
<value>0.05</value>
<difference>
<value>1.0</value>
<product>
<div>
<property>/position/altitude-ft</property>
<sum>
<property>/environment/clouds/layer[0]/elevation-ft</property>
<property>/environment/clouds/layer[0]/thickness-ft</property>
<value>1.0</value><!-- to avoid divide by 0 exceptions -->
</sum>
</div>
<div>
<property>/position/altitude-ft</property>
<sum>
<property>/environment/clouds/layer[0]/elevation-ft</property>
<property>/environment/clouds/layer[0]/thickness-ft</property>
<value>1.0</value><!-- to avoid divide by 0 exceptions -->
</sum>
</div>
</product>
</difference>
</product>
</sum>
</expression>
</input>
<output>/sim/rendering/dome-density</output>
</filter>
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:Density:High</name>
<type>gain</type>
<enable>
<condition>
<and>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
<greater-than>
<property>/position/altitude-ft</property>
<expression>
<sum>
<property>/environment/clouds/layer[0]/elevation-ft</property>
<property>/environment/clouds/layer[0]/thickness-ft</property>
</sum>
</expression>
</greater-than>
</and>
</condition>
</enable>
<input>
<expression>
<sum>
<value>0.3</value>
<product>
<property>/environment/air-pollution-norm</property>
<value>0.05</value>
</product>
</sum>
</expression>
</input>
<output>/sim/rendering/dome-density</output>
</filter>
<!-- Mean elevation. No easy way to do this, so we'll just use the altitude of the nearest METAR station -->
<filter>
<name>EnvironmentInterpolator:AtmosphericShader:Skydome:MeanElevation</name>
<type>gain</type>
<enable>
<condition>
<not>
<property>/nasal/local_weather/enabled</property>
<value>true</value>
</not>
</condition>
</enable>
<input>
<expression>
<product>
<property>/environment/metar[0]/station-elevation-ft</property>
<value>0.3048</value>
</product>
</expression>
</input>
<output>/environment/mean-terrain-elevation-m</output>
</filter>
</PropertyList> </PropertyList>