1
0
Fork 0

Earthview 2.0 - support for normal maps, better upper atmosphere edge, cloud relief shader, improved dawn zone, horizon estimation, improved resource management,...

This commit is contained in:
Thorsten Renk 2016-11-17 20:54:32 +02:00
parent 950fc0ab22
commit 5c437d74cb
59 changed files with 283286 additions and 127 deletions

View file

@ -21,7 +21,23 @@
</material> </material>
<visibility><use>/environment/visibility-m</use></visibility> <visibility><use>/environment/visibility-m</use></visibility>
<use-overlay-textures><use>/earthview/overlay-texture-flag</use></use-overlay-textures> <use-overlay-textures><use>/earthview/overlay-texture-flag</use></use-overlay-textures>
<use-cloud-normals><use>/earthview/cloud-normal-flag</use></use-cloud-normals>
<shade-effect><use>/earthview/shade-effect</use></shade-effect>
<sun-angle><use>/sim/time/sun-angle-rad</use></sun-angle>
<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-cloud</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_ysize><use>/sim/startup/ysize</use></display_ysize>
</parameters> </parameters>
<generate>
<normal type="int">15</normal>
<tangent type="int">6</tangent>
</generate>
<technique n="10"> <technique n="10">
@ -68,15 +84,11 @@
<source>src-alpha</source> <source>src-alpha</source>
<destination>one-minus-src-alpha</destination> <destination>one-minus-src-alpha</destination>
</blend> </blend>
<shade-model> <shade-model>smooth</shade-model>
<use>shade-model</use>
</shade-model>
<cull-face> <cull-face>
<use>cull-face</use> <use>cull-face</use>
</cull-face> </cull-face>
<rendering-hint> <rendering-hint>transparent</rendering-hint>
<use>rendering-hint</use>
</rendering-hint>
<render-bin> <render-bin>
<bin-number>111</bin-number> <bin-number>111</bin-number>
<bin-name>DepthSortedBin</bin-name> <bin-name>DepthSortedBin</bin-name>
@ -110,13 +122,19 @@
<wrap-t><use>texture[1]/wrap-t</use></wrap-t> <wrap-t><use>texture[1]/wrap-t</use></wrap-t>
<internal-format><use>texture[1]/internal-format</use></internal-format> <internal-format><use>texture[1]/internal-format</use></internal-format>
</texture-unit> </texture-unit>
<!--<vertex-program-two-side>
<use>vertex-program-two-side</use>
</vertex-program-two-side>-->
<program> <program>
<vertex-shader>Shaders/planet.vert</vertex-shader> <vertex-shader>Shaders/planet.vert</vertex-shader>
<fragment-shader>Shaders/planet-cloudlayer.frag</fragment-shader> <fragment-shader>Shaders/planet-cloudlayer.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader> <fragment-shader>Shaders/noise.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>
</attribute>
<attribute>
<name>normal</name>
<index>15</index>
</attribute>
</program> </program>
<uniform> <uniform>
@ -136,6 +154,13 @@
<use>use-overlay-textures</use> <use>use-overlay-textures</use>
</value> </value>
</uniform> </uniform>
<uniform>
<name>use_cloud_normals</name>
<type>bool</type>
<value>
<use>use-cloud-normals</use>
</value>
</uniform>
<uniform> <uniform>
<name>colorMode</name> <name>colorMode</name>
<type>int</type> <type>int</type>
@ -150,6 +175,65 @@
<use>visibility</use> <use>visibility</use>
</value> </value>
</uniform> </uniform>
<uniform>
<name>shade_effect</name>
<type>float</type>
<value>
<use>shade-effect</use>
</value>
</uniform>
<uniform>
<name>air_pollution</name>
<type>float</type>
<value><use>air_pollution</use></value>
</uniform>
<uniform>
<name>sun_angle</name>
<type>float</type>
<value>
<use>sun-angle</use>
</value>
</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>
<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>
</pass> </pass>
</technique> </technique>

View file

@ -21,6 +21,14 @@
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<texture n ="3">
<image>Textures/Terrain/void.png</image>
<type>2d</type>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<vertex-program-two-side type="bool">false</vertex-program-two-side> <vertex-program-two-side type="bool">false</vertex-program-two-side>
<material> <material>
<color-mode-uniform>1</color-mode-uniform> <color-mode-uniform>1</color-mode-uniform>
@ -31,14 +39,23 @@
<use-cloud-shadows><use>/earthview/cloud-shadow-flag</use></use-cloud-shadows> <use-cloud-shadows><use>/earthview/cloud-shadow-flag</use></use-cloud-shadows>
<use-overlay-textures><use>/earthview/overlay-texture-flag</use></use-overlay-textures> <use-overlay-textures><use>/earthview/overlay-texture-flag</use></use-overlay-textures>
<sun-angle><use>/sim/time/sun-angle-rad</use></sun-angle> <sun-angle><use>/sim/time/sun-angle-rad</use></sun-angle>
<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-cloud</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_ysize><use>/sim/startup/ysize</use></display_ysize>
</parameters> </parameters>
<generate> <generate>
<normal type="int">15</normal>
<tangent type="int">6</tangent> <tangent type="int">6</tangent>
</generate> </generate>
<technique n="9">
<technique n="10">
<predicate> <predicate>
<and>
<or> <or>
<less-equal> <less-equal>
<value type="float">2.0</value> <value type="float">2.0</value>
@ -51,6 +68,8 @@
<extension-supported>GL_ARB_fragment_shader</extension-supported> <extension-supported>GL_ARB_fragment_shader</extension-supported>
</and> </and>
</or> </or>
<property>/earthview/normal-flag</property>
</and>
</predicate> </predicate>
<pass> <pass>
<lighting>true</lighting> <lighting>true</lighting>
@ -116,19 +135,242 @@
<wrap-t><use>texture[2]/wrap-t</use></wrap-t> <wrap-t><use>texture[2]/wrap-t</use></wrap-t>
<internal-format><use>texture[2]/internal-format</use></internal-format> <internal-format><use>texture[2]/internal-format</use></internal-format>
</texture-unit> </texture-unit>
<texture-unit>
<unit>3</unit>
<image><use>texture[3]/image</use></image>
<type><use>texture[3]/type</use></type>
<filter><use>texture[3]/filter</use></filter>
<wrap-s><use>texture[3]/wrap-s</use></wrap-s>
<wrap-t><use>texture[3]/wrap-t</use></wrap-t>
<internal-format><use>texture[3]/internal-format</use></internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/planet.vert</vertex-shader>
<fragment-shader>Shaders/planet-high.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>
</attribute>
<attribute>
<name>normal</name>
<index>15</index>
</attribute>
</program>
<uniform>
<name>texture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>shadowtex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>grain_texture</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>normal_texture</name>
<type>sampler-2d</type>
<value type="int">3</value>
</uniform>
<uniform>
<name>colorMode</name>
<type>int</type>
<value>
<use>material/color-mode-uniform</use>
</value>
</uniform>
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>sun_angle</name>
<type>float</type>
<value>
<use>sun-angle</use>
</value>
</uniform>
<uniform>
<name>use_clouds</name>
<type>bool</type>
<value>
<use>use-clouds</use>
</value>
</uniform>
<uniform>
<name>use_overlay</name>
<type>bool</type>
<value>
<use>use-overlay-textures</use>
</value>
</uniform>
<uniform>
<name>use_cloud_shadows</name>
<type>bool</type>
<value>
<use>use-cloud-shadows</use>
</value>
</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>
<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>
</pass>
</technique>
<technique n="10">
<predicate>
<or>
<less-equal>
<value type="float">2.0</value>
<glversion/>
</less-equal>
<and>
<extension-supported>GL_ARB_shader_objects</extension-supported>
<extension-supported>GL_ARB_shading_language_100</extension-supported>
<extension-supported>GL_ARB_vertex_shader</extension-supported>
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
</predicate>
<pass>
<lighting>true</lighting>
<material>
<active>
<use>material/active</use>
</active>
<ambient>
<use>material/ambient</use>
</ambient>
<diffuse>
<use>material/diffuse</use>
</diffuse>
<specular>
<use>material/specular</use>
</specular>
<emissive>
<use>material/emissive</use>
</emissive>
<shininess>
<use>material/shininess</use>
</shininess>
<color-mode>
<use>material/color-mode</use>
</color-mode>
</material>
<blend><use>transparent</use></blend>
<alpha-test>
<active type="bool">false</active>
</alpha-test>
<shade-model>
<use>shade-model</use>
</shade-model>
<cull-face>
<use>cull-face</use>
</cull-face>
<rendering-hint>
<use>rendering-hint</use>
</rendering-hint>
<texture-unit>
<unit>0</unit>
<type><use>texture[0]/type</use></type>
<image><use>texture[0]/image</use></image>
<filter><use>texture[0]/filter</use></filter>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t>
</texture-unit>
<texture-unit>
<unit>1</unit>
<image><use>texture[1]/image</use></image>
<type><use>texture[1]/type</use></type>
<filter><use>texture[1]/filter</use></filter>
<wrap-s><use>texture[1]/wrap-s</use></wrap-s>
<wrap-t><use>texture[1]/wrap-t</use></wrap-t>
<internal-format><use>texture[1]/internal-format</use></internal-format>
</texture-unit>
<texture-unit>
<unit>2</unit>
<image><use>texture[2]/image</use></image>
<type><use>texture[2]/type</use></type>
<filter><use>texture[2]/filter</use></filter>
<wrap-s><use>texture[2]/wrap-s</use></wrap-s>
<wrap-t><use>texture[2]/wrap-t</use></wrap-t>
<internal-format><use>texture[2]/internal-format</use></internal-format>
</texture-unit>
<texture-unit>
<unit>3</unit>
<image><use>texture[3]/image</use></image>
<type><use>texture[3]/type</use></type>
<filter><use>texture[3]/filter</use></filter>
<wrap-s><use>texture[3]/wrap-s</use></wrap-s>
<wrap-t><use>texture[3]/wrap-t</use></wrap-t>
<internal-format><use>texture[3]/internal-format</use></internal-format>
</texture-unit>
<program> <program>
<vertex-shader>Shaders/planet.vert</vertex-shader> <vertex-shader>Shaders/planet.vert</vertex-shader>
<fragment-shader>Shaders/planet.frag</fragment-shader> <fragment-shader>Shaders/planet.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader> <fragment-shader>Shaders/noise.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
<attribute> <attribute>
<name>tangent</name> <name>tangent</name>
<index>6</index> <index>6</index>
</attribute> </attribute>
<attribute>
<name>normal</name>
<index>15</index>
</attribute>
</program> </program>
<uniform> <uniform>
<name>texture</name> <name>texture</name>
<type>sampler-2d</type> <type>sampler-2d</type>
@ -182,10 +424,48 @@
<uniform> <uniform>
<name>use_cloud_shadows</name> <name>use_cloud_shadows</name>
<type>bool</type> <type>bool</type>
<value> <value><use>use-cloud-shadows</use></value>
<use>use-cloud-shadows</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>
<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>
</pass> </pass>
</technique> </technique>

View file

@ -9,8 +9,16 @@
<wrap-s>repeat</wrap-s> <wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<texture n="3">
<image>Models/Astro/Textures/normalmap_earth_N1.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
</parameters> </parameters>
</PropertyList> </PropertyList>

View file

@ -9,7 +9,14 @@
<wrap-s>repeat</wrap-s> <wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<texture n="3">
<image>Models/Astro/Textures/normalmap_earth_N2.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
</parameters> </parameters>

View file

@ -9,7 +9,14 @@
<wrap-s>repeat</wrap-s> <wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<texture n="3">
<image>Models/Astro/Textures/normalmap_earth_N3.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
</parameters> </parameters>

View file

@ -10,6 +10,13 @@
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<texture n="3">
<image>Models/Astro/Textures/normalmap_earth_N4.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
</parameters> </parameters>

View file

@ -9,7 +9,14 @@
<wrap-s>repeat</wrap-s> <wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<texture n="3">
<image>Models/Astro/Textures/normalmap_earth_S1.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
</parameters> </parameters>

View file

@ -9,7 +9,14 @@
<wrap-s>repeat</wrap-s> <wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<texture n="3">
<image>Models/Astro/Textures/normalmap_earth_S2.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
</parameters> </parameters>

View file

@ -9,7 +9,14 @@
<wrap-s>repeat</wrap-s> <wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<texture n="3">
<image>Models/Astro/Textures/normalmap_earth_S3.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
</parameters> </parameters>

View file

@ -9,7 +9,14 @@
<wrap-s>repeat</wrap-s> <wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<texture n="3">
<image>Models/Astro/Textures/normalmap_earth_S4.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
</parameters> </parameters>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 959 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

17578
Models/Astro/clouds_N1.ac Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,74 @@
<?xml version="1.0"?>
<PropertyList>
<path>clouds_N1.ac</path>
<animation>
<type>scale</type>
<x-offset>58040</x-offset>
<y-offset>58040</y-offset>
<z-offset>58040</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/cloudsphere-angle</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>select</type>
<condition>
<property>/earthview/cloudsphere-flag</property>
</condition>
</animation>
<effect>
<inherits-from>Effects/planet-cloudlayer</inherits-from>
<object-name>clouds_N1</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_N1</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

17578
Models/Astro/clouds_N2.ac Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,74 @@
<?xml version="1.0"?>
<PropertyList>
<path>clouds_N2.ac</path>
<animation>
<type>scale</type>
<x-offset>58040</x-offset>
<y-offset>58040</y-offset>
<z-offset>58040</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/cloudsphere-angle</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>select</type>
<condition>
<property>/earthview/cloudsphere-flag</property>
</condition>
</animation>
<effect>
<inherits-from>Effects/planet-cloudlayer</inherits-from>
<object-name>clouds_N2</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_N2</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

17578
Models/Astro/clouds_N3.ac Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,82 @@
<?xml version="1.0"?>
<PropertyList>
<path>clouds_N3.ac</path>
<animation>
<type>scale</type>
<x-offset>58040</x-offset>
<y-offset>58040</y-offset>
<z-offset>58040</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/cloudsphere-angle</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>select</type>
<condition>
<property>/earthview/cloudsphere-flag</property>
</condition>
</animation>
<effect>
<inherits-from>Effects/planet-cloudlayer</inherits-from>
<object-name>clouds_N3</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_N3</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>dummy_N3</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

17578
Models/Astro/clouds_N4.ac Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,74 @@
<?xml version="1.0"?>
<PropertyList>
<path>clouds_N4.ac</path>
<animation>
<type>scale</type>
<x-offset>58040</x-offset>
<y-offset>58040</y-offset>
<z-offset>58040</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/cloudsphere-angle</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>select</type>
<condition>
<property>/earthview/cloudsphere-flag</property>
</condition>
</animation>
<effect>
<inherits-from>Effects/planet-cloudlayer</inherits-from>
<object-name>clouds_N4</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_N4</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

17578
Models/Astro/clouds_S1.ac Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,74 @@
<?xml version="1.0"?>
<PropertyList>
<path>clouds_S1.ac</path>
<animation>
<type>scale</type>
<x-offset>58040</x-offset>
<y-offset>58040</y-offset>
<z-offset>58040</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/cloudsphere-angle</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>select</type>
<condition>
<property>/earthview/cloudsphere-flag</property>
</condition>
</animation>
<effect>
<inherits-from>Effects/planet-cloudlayer</inherits-from>
<object-name>clouds_S1</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_S1</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

17578
Models/Astro/clouds_S2.ac Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,74 @@
<?xml version="1.0"?>
<PropertyList>
<path>clouds_S2.ac</path>
<animation>
<type>scale</type>
<x-offset>58040</x-offset>
<y-offset>58040</y-offset>
<z-offset>58040</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/cloudsphere-angle</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>select</type>
<condition>
<property>/earthview/cloudsphere-flag</property>
</condition>
</animation>
<effect>
<inherits-from>Effects/planet-cloudlayer</inherits-from>
<object-name>clouds_S2</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_S2</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

17578
Models/Astro/clouds_S3.ac Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,74 @@
<?xml version="1.0"?>
<PropertyList>
<path>clouds_S3.ac</path>
<animation>
<type>scale</type>
<x-offset>58040</x-offset>
<y-offset>58040</y-offset>
<z-offset>58040</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/cloudsphere-angle</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>select</type>
<condition>
<property>/earthview/cloudsphere-flag</property>
</condition>
</animation>
<effect>
<inherits-from>Effects/planet-cloudlayer</inherits-from>
<object-name>clouds_S3</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_S3</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

17578
Models/Astro/clouds_S4.ac Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,74 @@
<?xml version="1.0"?>
<PropertyList>
<path>clouds_S4.ac</path>
<animation>
<type>scale</type>
<x-offset>58040</x-offset>
<y-offset>58040</y-offset>
<z-offset>58040</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/cloudsphere-angle</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>select</type>
<condition>
<property>/earthview/cloudsphere-flag</property>
</condition>
</animation>
<effect>
<inherits-from>Effects/planet-cloudlayer</inherits-from>
<object-name>clouds_S4</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_S4</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

17578
Models/Astro/earth_N1.ac Normal file

File diff suppressed because it is too large Load diff

50
Models/Astro/earth_N1.xml Normal file
View file

@ -0,0 +1,50 @@
<?xml version="1.0"?>
<PropertyList>
<path>earth_N1.ac</path>
<animation>
<type>scale</type>
<x-offset>58030</x-offset>
<y-offset>58030</y-offset>
<z-offset>58030</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<effect>
<inherits-from>Models/Astro/Effects/planet_N1</inherits-from>
<object-name>earth_N1</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_N1</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

17578
Models/Astro/earth_N2.ac Normal file

File diff suppressed because it is too large Load diff

50
Models/Astro/earth_N2.xml Normal file
View file

@ -0,0 +1,50 @@
<?xml version="1.0"?>
<PropertyList>
<path>earth_N2.ac</path>
<animation>
<type>scale</type>
<x-offset>58030</x-offset>
<y-offset>58030</y-offset>
<z-offset>58030</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<effect>
<inherits-from>Models/Astro/Effects/planet_N2</inherits-from>
<object-name>earth_N2</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_N2</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

17578
Models/Astro/earth_N3.ac Normal file

File diff suppressed because it is too large Load diff

44
Models/Astro/earth_N3.xml Normal file
View file

@ -0,0 +1,44 @@
<?xml version="1.0"?>
<PropertyList>
<path>earth_N3.ac</path>
<animation>
<type>scale</type>
<x-offset>58030</x-offset>
<y-offset>58030</y-offset>
<z-offset>58030</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<effect>
<inherits-from>Models/Astro/Effects/planet_N3</inherits-from>
<object-name>earth_N3</object-name>
</effect>
</PropertyList>

17578
Models/Astro/earth_N4.ac Normal file

File diff suppressed because it is too large Load diff

50
Models/Astro/earth_N4.xml Normal file
View file

@ -0,0 +1,50 @@
<?xml version="1.0"?>
<PropertyList>
<path>earth_N4.ac</path>
<animation>
<type>scale</type>
<x-offset>58030</x-offset>
<y-offset>58030</y-offset>
<z-offset>58030</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<effect>
<inherits-from>Models/Astro/Effects/planet_N4</inherits-from>
<object-name>earth_N4</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_N4</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

17578
Models/Astro/earth_S1.ac Normal file

File diff suppressed because it is too large Load diff

49
Models/Astro/earth_S1.xml Normal file
View file

@ -0,0 +1,49 @@
<?xml version="1.0"?>
<PropertyList>
<path>earth_S1.ac</path>
<animation>
<type>scale</type>
<x-offset>58030</x-offset>
<y-offset>58030</y-offset>
<z-offset>58030</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<effect>
<inherits-from>Models/Astro/Effects/planet_S1</inherits-from>
<object-name>earth_S1</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_S1</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

17578
Models/Astro/earth_S2.ac Normal file

File diff suppressed because it is too large Load diff

49
Models/Astro/earth_S2.xml Normal file
View file

@ -0,0 +1,49 @@
<?xml version="1.0"?>
<PropertyList>
<path>earth_S2.ac</path>
<animation>
<type>scale</type>
<x-offset>58030</x-offset>
<y-offset>58030</y-offset>
<z-offset>58030</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<effect>
<inherits-from>Models/Astro/Effects/planet_S2</inherits-from>
<object-name>earth_S2</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_S2</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

17578
Models/Astro/earth_S3.ac Normal file

File diff suppressed because it is too large Load diff

50
Models/Astro/earth_S3.xml Normal file
View file

@ -0,0 +1,50 @@
<?xml version="1.0"?>
<PropertyList>
<path>earth_S3.ac</path>
<animation>
<type>scale</type>
<x-offset>58030</x-offset>
<y-offset>58030</y-offset>
<z-offset>58030</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<effect>
<inherits-from>Models/Astro/Effects/planet_S3</inherits-from>
<object-name>earth_S3</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_S3</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

17578
Models/Astro/earth_S4.ac Normal file

File diff suppressed because it is too large Load diff

50
Models/Astro/earth_S4.xml Normal file
View file

@ -0,0 +1,50 @@
<?xml version="1.0"?>
<PropertyList>
<path>earth_S4.ac</path>
<animation>
<type>scale</type>
<x-offset>58030</x-offset>
<y-offset>58030</y-offset>
<z-offset>58030</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<effect>
<inherits-from>Models/Astro/Effects/planet_S4</inherits-from>
<object-name>earth_S4</object-name>
</effect>
<animation>
<type>select</type>
<object-name>dummy_S4</object-name>
<condition>
<property>/earthview/show-dummy</property>
</condition>
</animation>
</PropertyList>

View file

@ -11,6 +11,8 @@ earthview_running_flag = 1;
var lat = getprop("/position/latitude-deg"); var lat = getprop("/position/latitude-deg");
var lon = getprop("/position/longitude-deg"); var lon = getprop("/position/longitude-deg");
# define the tile centers # define the tile centers
@ -37,62 +39,52 @@ center_S4.set_latlon(-45.0, 135.0);
var shuttle_pos = geo.aircraft_position(); var shuttle_pos = geo.aircraft_position();
#print(shuttle_pos.distance_to(center_N1)); if (0==1){
#print(shuttle_pos.distance_to(center_N2)); print(shuttle_pos.distance_to(center_N1)/1000.0);
#print(shuttle_pos.distance_to(center_N3)); print(shuttle_pos.distance_to(center_N2)/1000.0);
#print(shuttle_pos.distance_to(center_N4)); print(shuttle_pos.distance_to(center_N3)/1000.0);
#print(shuttle_pos.distance_to(center_S1)); print(shuttle_pos.distance_to(center_N4)/1000.0);
#print(shuttle_pos.distance_to(center_S2)); print(shuttle_pos.distance_to(center_S1)/1000.0);
#print(shuttle_pos.distance_to(center_S3)); print(shuttle_pos.distance_to(center_S2)/1000.0);
#print(shuttle_pos.distance_to(center_S4)); print(shuttle_pos.distance_to(center_S3)/1000.0);
print(shuttle_pos.distance_to(center_S4)/1000.0);
}
if (shuttle_pos.distance_to(center_N1) > 8000000.0) setprop("/earthview/show-n1", 0);
{setprop("/earthview/show-n1", 0);} setprop("/earthview/show-n2", 0);
else {setprop("/earthview/show-n1", 1);} setprop("/earthview/show-n3", 0);
setprop("/earthview/show-n4", 0);
if (shuttle_pos.distance_to(center_N2) > 8000000.0) setprop("/earthview/show-s1", 0);
{setprop("/earthview/show-n2", 0);} setprop("/earthview/show-s2", 0);
else {setprop("/earthview/show-n2", 1);} setprop("/earthview/show-s3", 0);
setprop("/earthview/show-s4", 0);
if (shuttle_pos.distance_to(center_N3) > 8000000.0)
{setprop("/earthview/show-n3", 0);}
else {setprop("/earthview/show-n3", 1);}
if (shuttle_pos.distance_to(center_N4) > 8000000.0) aurora_model.node = earthview.place_earth_model("Models/Astro/aurora.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
{setprop("/earthview/show-n4", 0);}
else {setprop("/earthview/show-n4", 1);}
if (shuttle_pos.distance_to(center_S1) > 8000000.0)
{setprop("/earthview/show-s1", 0);}
else {setprop("/earthview/show-s1", 1);}
if (shuttle_pos.distance_to(center_S2) > 8000000.0)
{setprop("/earthview/show-s2", 0);}
else {setprop("/earthview/show-s2", 1);}
if (shuttle_pos.distance_to(center_S3) > 8000000.0)
{setprop("/earthview/show-s3", 0);}
else {setprop("/earthview/show-s3", 1);}
if (shuttle_pos.distance_to(center_S4) > 8000000.0)
{setprop("/earthview/show-s4", 0);}
else {setprop("/earthview/show-s4", 1);}
earth_model.node = earthview.place_earth_model("Models/Astro/earth.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
cloudsphere_model.node = earthview.place_earth_model("Models/Astro/cloudsphere.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
cloudsphere_model.node = earthview.place_earth_model("Models/Astro/aurora.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
# set Basic Weather off # set Basic Weather off
props.globals.getNode("/environment/config/enabled").setBoolValue(0); props.globals.getNode("/environment/config/enabled").setBoolValue(0);
props.globals.getNode("/environment/params/metar-updates-environment").setBoolValue(0); props.globals.getNode("/environment/params/metar-updates-environment").setBoolValue(0);
# set some reasonable defaults # set some reasonable defaults
setprop("/environment/visibility-m", 80000.0); setprop("/environment/visibility-m", 80000.0);
setprop("/sim/rendering/mie", 0.0); setprop("/sim/rendering/mie", 0.0);
setprop("/sim/rendering/rayleigh", 0.00002); setprop("/sim/rendering/rayleigh", 0.00002);
setprop("/sim/rendering/dome-density", 1.0); setprop("/sim/rendering/dome-density", 1.0);
setprop("/earthview/shade-effect", 1.5);
earth_model.l1 = setlistener("/earthview/show-n1", func(n) {load_sector (1, n);},0,0);
earth_model.l2 = setlistener("/earthview/show-n2", func(n) {load_sector (2, n);},0,0);
earth_model.l3 = setlistener("/earthview/show-n3", func(n) {load_sector (3, n);},0,0);
earth_model.l4 = setlistener("/earthview/show-n4", func(n) {load_sector (4, n);},0,0);
earth_model.l5 = setlistener("/earthview/show-s1", func(n) {load_sector (5, n);},0,0);
earth_model.l6 = setlistener("/earthview/show-s2", func(n) {load_sector (6, n);},0,0);
earth_model.l7 = setlistener("/earthview/show-s3", func(n) {load_sector (7, n);},0,0);
earth_model.l8 = setlistener("/earthview/show-s4", func(n) {load_sector (8, n);},0,0);
control_loop(); control_loop();
@ -101,10 +93,43 @@ control_loop();
var stop = func () { var stop = func () {
earth_model.node.remove(); #earth_model.node.remove();
cloudsphere_model.node.remove(); #cloudsphere_model.node.remove();
aurora_model.node.remove();
setprop("/earthview/control_loop_flag",0); setprop("/earthview/control_loop_flag",0);
# unload tiles not loaded via listeners
if (cloudsphere_rotated_flag == 1)
{clear_cloud_tiles();}
# unlock rotation flag to allow downloading of distance-managed tiles
cloudsphere_rotated_flag = 0;
setprop("/earthview/cloudsphere-angle",0.0);
setprop("/earthview/show-n1", 0);
setprop("/earthview/show-n2", 0);
setprop("/earthview/show-n3", 0);
setprop("/earthview/show-n4", 0);
setprop("/earthview/show-s1", 0);
setprop("/earthview/show-s2", 0);
setprop("/earthview/show-s3", 0);
setprop("/earthview/show-s4", 0);
settimer( func {
removelistener(earth_model.l1);
removelistener(earth_model.l2);
removelistener(earth_model.l3);
removelistener(earth_model.l4);
removelistener(earth_model.l5);
removelistener(earth_model.l6);
removelistener(earth_model.l7);
removelistener(earth_model.l8);
}, 1.0);
earthview_running_flag = 0; earthview_running_flag = 0;
} }
@ -163,13 +188,21 @@ return model;
var control_loop = func { var control_loop = func {
if (earthview_running_flag == 0) {return;}
var R1 = 5800000.0; var R1 = 5800000.0;
var R2 = 58000.0; var R2 = 58000.0;
var range_base = 7000000;
var altitude1 = getprop("/position/altitude-ft"); var altitude1 = getprop("/position/altitude-ft");
var altitude2 = R2/R1 * altitude1; var altitude2 = R2/R1 * altitude1;
var model_alt = altitude1 - altitude2 - R2 * m_to_ft; var model_alt = altitude1 - altitude2 - R2 * m_to_ft;
var horizon = math.sqrt(2.0 * R1 * altitude1 * ft_to_m );
if (horizon > 5000000.0) {horizon = 5000000.0;}
setprop("/earthview/horizon-km", horizon/1000.0);
setprop("/earthview/elevation-ft", model_alt); setprop("/earthview/elevation-ft", model_alt);
var lat = getprop("/position/latitude-deg"); var lat = getprop("/position/latitude-deg");
@ -183,35 +216,36 @@ setprop("/earthview/yaw-deg", -lon);
var shuttle_pos = geo.aircraft_position(); var shuttle_pos = geo.aircraft_position();
if (shuttle_pos.distance_to(center_N1) > 8000000.0)
if (shuttle_pos.distance_to(center_N1) > range_base + horizon)
{setprop("/earthview/show-n1", 0);} {setprop("/earthview/show-n1", 0);}
else {setprop("/earthview/show-n1", 1);} else {setprop("/earthview/show-n1", 1);}
if (shuttle_pos.distance_to(center_N2) > 8000000.0) if (shuttle_pos.distance_to(center_N2) > range_base + horizon)
{setprop("/earthview/show-n2", 0);} {setprop("/earthview/show-n2", 0);}
else {setprop("/earthview/show-n2", 1);} else {setprop("/earthview/show-n2", 1);}
if (shuttle_pos.distance_to(center_N3) > 8000000.0) if (shuttle_pos.distance_to(center_N3) > range_base + horizon)
{setprop("/earthview/show-n3", 0);} {setprop("/earthview/show-n3", 0);}
else {setprop("/earthview/show-n3", 1);} else {setprop("/earthview/show-n3", 1);}
if (shuttle_pos.distance_to(center_N4) > 8000000.0) if (shuttle_pos.distance_to(center_N4) > range_base + horizon)
{setprop("/earthview/show-n4", 0);} {setprop("/earthview/show-n4", 0);}
else {setprop("/earthview/show-n4", 1);} else {setprop("/earthview/show-n4", 1);}
if (shuttle_pos.distance_to(center_S1) > 8000000.0) if (shuttle_pos.distance_to(center_S1) > range_base + horizon)
{setprop("/earthview/show-s1", 0);} {setprop("/earthview/show-s1", 0);}
else {setprop("/earthview/show-s1", 1);} else {setprop("/earthview/show-s1", 1);}
if (shuttle_pos.distance_to(center_S2) > 8000000.0) if (shuttle_pos.distance_to(center_S2) > range_base + horizon)
{setprop("/earthview/show-s2", 0);} {setprop("/earthview/show-s2", 0);}
else {setprop("/earthview/show-s2", 1);} else {setprop("/earthview/show-s2", 1);}
if (shuttle_pos.distance_to(center_S3) > 8000000.0) if (shuttle_pos.distance_to(center_S3) > range_base + horizon)
{setprop("/earthview/show-s3", 0);} {setprop("/earthview/show-s3", 0);}
else {setprop("/earthview/show-s3", 1);} else {setprop("/earthview/show-s3", 1);}
if (shuttle_pos.distance_to(center_S4) > 8000000.0) if (shuttle_pos.distance_to(center_S4) > range_base + horizon)
{setprop("/earthview/show-s4", 0);} {setprop("/earthview/show-s4", 0);}
else {setprop("/earthview/show-s4", 1);} else {setprop("/earthview/show-s4", 1);}
@ -255,11 +289,204 @@ if (getprop("/earthview/control_loop_flag") ==1) {settimer( func {control_loop()
} }
# rotate position of cloud tiles
var adjust_cloud_tiles = func {
# we need to load all cloud tiles if we want to rotate the cloudsphere
if (getprop("/earthview/cloudsphere-angle") > 0.0)
{
if (cloudsphere_rotated_flag == 0)
{
var lat = getprop("/position/latitude-deg");
var lon = getprop("/position/longitude-deg");
if (getprop("/earthview/show-n1") == 0)
{cloudsphere_model.node1 = place_earth_model("Models/Astro/clouds_N1.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
if (getprop("/earthview/show-n2") == 0)
{cloudsphere_model.node2 = place_earth_model("Models/Astro/clouds_N2.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
if (getprop("/earthview/show-n3") == 0)
{cloudsphere_model.node3 = place_earth_model("Models/Astro/clouds_N3.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
if (getprop("/earthview/show-n4") == 0)
{cloudsphere_model.node4 = place_earth_model("Models/Astro/clouds_N4.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
if (getprop("/earthview/show-s1") == 0)
{cloudsphere_model.node5 = place_earth_model("Models/Astro/clouds_S1.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
if (getprop("/earthview/show-s2") == 0)
{cloudsphere_model.node6 = place_earth_model("Models/Astro/clouds_S2.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
if (getprop("/earthview/show-s3") == 0)
{cloudsphere_model.node7 = place_earth_model("Models/Astro/clouds_S3.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
if (getprop("/earthview/show-s4") == 0)
{cloudsphere_model.node8 = place_earth_model("Models/Astro/clouds_S4.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
cloudsphere_rotated_flag = 1;
}
}
else
{
clear_cloud_tiles();
cloudsphere_rotated_flag = 0;
}
}
var clear_cloud_tiles = func {
if (getprop("/earthview/show-n1") == 0)
{cloudsphere_model.node1.remove();}
if (getprop("/earthview/show-n2") == 0)
{cloudsphere_model.node2.remove();}
if (getprop("/earthview/show-n3") == 0)
{cloudsphere_model.node3.remove();}
if (getprop("/earthview/show-n4") == 0)
{cloudsphere_model.node4.remove();}
if (getprop("/earthview/show-s1") == 0)
{cloudsphere_model.node5.remove();}
if (getprop("/earthview/show-s2") == 0)
{cloudsphere_model.node6.remove();}
if (getprop("/earthview/show-s3") == 0)
{cloudsphere_model.node7.remove();}
if (getprop("/earthview/show-s4") == 0)
{cloudsphere_model.node8.remove();}
}
# load of individual tile
var load_sector = func (i, n) {
var action = n.getValue();
if (action)
{
var lat = getprop("/position/latitude-deg");
var lon = getprop("/position/longitude-deg");
if (i==1)
{
earth_model.node1 = place_earth_model("Models/Astro/earth_N1.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node1 = place_earth_model("Models/Astro/clouds_N1.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
}
else if (i==2)
{
earth_model.node2 = place_earth_model("Models/Astro/earth_N2.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node2 = place_earth_model("Models/Astro/clouds_N2.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
}
else if (i==3)
{
earth_model.node3 = place_earth_model("Models/Astro/earth_N3.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
cloudsphere_model.node3 = place_earth_model("Models/Astro/clouds_N3.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
}
else if (i==4)
{
earth_model.node4 = place_earth_model("Models/Astro/earth_N4.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node4 = place_earth_model("Models/Astro/clouds_N4.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
}
else if (i==5)
{
earth_model.node5 = place_earth_model("Models/Astro/earth_S1.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node5 = place_earth_model("Models/Astro/clouds_S1.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
}
else if (i==6)
{
earth_model.node6 = place_earth_model("Models/Astro/earth_S2.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node6 = place_earth_model("Models/Astro/clouds_S2.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
}
else if (i==7)
{
earth_model.node7 = place_earth_model("Models/Astro/earth_S3.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node7 = place_earth_model("Models/Astro/clouds_S3.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
}
else if (i==8)
{
earth_model.node8 = place_earth_model("Models/Astro/earth_S4.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node8 = place_earth_model("Models/Astro/clouds_S4.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);}
}
}
else
{
if (i==1)
{
earth_model.node1.remove();
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node1.remove();}
}
else if (i==2)
{
earth_model.node2.remove();
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node2.remove();}
}
else if (i==3)
{
earth_model.node3.remove();
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node3.remove();}
}
else if (i==4)
{
earth_model.node4.remove();
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node4.remove();}
}
else if (i==5)
{
earth_model.node5.remove();
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node5.remove();}
}
else if (i==6)
{
earth_model.node6.remove();
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node6.remove();}
}
else if (i==7)
{
earth_model.node7.remove();
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node7.remove();}
}
else if (i==8)
{
earth_model.node8.remove();
if (cloudsphere_rotated_flag == 0)
{cloudsphere_model.node8.remove();}
}
}
}
var ft_to_m = 0.30480; var ft_to_m = 0.30480;
var m_to_ft = 1.0/ft_to_m; var m_to_ft = 1.0/ft_to_m;
var earth_model = {}; var earth_model = {};
var cloudsphere_model = {}; var cloudsphere_model = {};
var aurora_model = {};
var earthview_running_flag = 0; var earthview_running_flag = 0;
var cloudsphere_rotated_flag = 0;
var center_N1 = {}; var center_N1 = {};
var center_N2 = {}; var center_N2 = {};
@ -269,3 +496,5 @@ var center_S1 = {};
var center_S2 = {}; var center_S2 = {};
var center_S3 = {}; var center_S3 = {};
var center_S4 = {}; var center_S4 = {};

View file

@ -8,74 +8,131 @@ varying vec3 normal;
varying vec3 ecViewDir; varying vec3 ecViewDir;
varying vec3 VTangent; varying vec3 VTangent;
uniform float shade_effect;
uniform float sun_angle;
uniform float air_pollution;
uniform bool use_overlay; uniform bool use_overlay;
uniform bool use_cloud_normals;
uniform sampler2D texture; uniform sampler2D texture;
uniform sampler2D structure_texture; uniform sampler2D structure_texture;
float Noise2D(in vec2 coord, in float wavelength); float Noise2D(in vec2 coord, in float wavelength);
vec3 filter_combined (in vec3 color) ;
float add_cosines (in float cos1, in float cos2, in float sign)
{
float sin1 = sqrt(1.0 - pow(cos1, 2.0));
float sin2 = sqrt(1.0 - pow(cos2, 2.0));
return cos1 * cos2 + sign * sin1 * sin2;
}
void main() void main()
{ {
vec3 n; vec3 n;
float NdotL, NdotHV; float NdotL, NdotHV, NdotLraw;
vec4 color = gl_Color; vec4 color = gl_Color;
vec3 lightDir = gl_LightSource[0].position.xyz; vec3 lightDir = gl_LightSource[0].position.xyz;
vec3 halfVector = normalize(normalize(lightDir) + normalize(ecViewDir)); vec3 halfVector = normalize(normalize(lightDir) + normalize(ecViewDir));
vec4 texel; vec4 texel;
vec4 ref_texel;
vec4 structureTexel; vec4 structureTexel;
vec4 fragColor; vec4 fragColor;
vec4 specular = vec4(0.0); vec4 specular = vec4(0.0, 0.0, 0.0, 0.0);
// If gl_Color.a == 0, this is a back-facing polygon and the n = normalize(normal);
// normal should be reversed.
n = (2.0 * gl_Color.a - 1.0) * normal;
n = normalize(n);
vec3 light_specular = vec3 (1.0, 1.0, 1.0); vec3 light_specular = vec3 (1.0, 1.0, 1.0);
NdotL = dot(n, lightDir); NdotL = dot(n, normalize(lightDir));
NdotLraw = NdotL;
NdotL = smoothstep(-0.2,0.2,NdotL); NdotL = smoothstep(-0.2,0.2,NdotL);
float intensity = length(diffuse_term); float intensity = length(diffuse_term.rgb);
vec4 dawn = intensity * normalize (vec4 (1.0,0.4,0.4,1.0));
vec4 diff_term = mix(dawn, diffuse_term, smoothstep(0.0, 0.2, NdotL));
if (NdotL > 0.0) { vec3 dawn_color = mix (vec3 (1.0,0.7,0.4), vec3 (1.0,0.4,0.2), air_pollution);
color += diffuse_term * NdotL ;
NdotHV = max(dot(n, halfVector), 0.0); vec3 dawn = intensity * 1.2 * normalize (dawn_color);
if (gl_FrontMaterial.shininess > 0.0)
specular.rgb = (gl_FrontMaterial.specular.rgb vec4 diff_term = mix(vec4(dawn, 1.0), diffuse_term, smoothstep(0.0, 0.45, NdotL));
* light_specular
* pow(NdotHV, gl_FrontMaterial.shininess));
} vec2 grad_dir = vec2 (1.0, 0.0);
vec3 tangent = normalize(VTangent);
vec3 binormal = cross(n, tangent);
float NdotL2 = 0.0;
if (use_cloud_normals)
{
vec2 sun2d = vec2 (0.0, 1.0);
float xOffset = -1.0 * dot(normalize(lightDir), tangent);
float yOffset = -1.0 * dot(normalize(lightDir), binormal);
grad_dir = normalize (vec2 (xOffset, yOffset));
vec4 comp_texel = texture2D(texture, gl_TexCoord[0].st - 0.0005 * grad_dir);
float slope = shade_effect * (comp_texel.a - ref_texel.a);
float sign = -1.0;
if (slope < 0.0) {sign = 1.0;}
vec2 snormal = normalize(vec2 (slope, 1.0));
NdotL2 = dot (snormal, sun2d);
NdotL = add_cosines(NdotL, NdotL2, sign );
}
color += diff_term * max(NdotL, 0.15) ;
color.rgb *= smoothstep(-0.2, -0.1, NdotLraw);
//
color.a = diffuse_term.a; color.a = diffuse_term.a;
// This shouldn't be necessary, but our lighting becomes very
// saturated. Clamping the color before modulating by the texture
// is closer to what the OpenGL fixed function pipeline does.
color = clamp(color, 0.0, 1.0); color = clamp(color, 0.0, 1.0);
texel = texture2D(texture, gl_TexCoord[0].st); texel = texture2D(texture, gl_TexCoord[0].st);
ref_texel = texel;
structureTexel = texture2D(structure_texture, 20.0 * gl_TexCoord[0].st); structureTexel = texture2D(structure_texture, 20.0 * gl_TexCoord[0].st);
float noise = Noise2D( gl_TexCoord[0].st, 0.01); float noise = Noise2D( gl_TexCoord[0].st, 0.01);
noise += Noise2D( gl_TexCoord[0].st, 0.005); noise += Noise2D( gl_TexCoord[0].st, 0.005);
noise += Noise2D( gl_TexCoord[0].st, 0.002); noise += Noise2D( gl_TexCoord[0].st, 0.002);
//vec4 noiseTexel = vec4 (1.0,1.0,1.0, smoothstep(0.3,1.2,noise) * texel.a);
vec4 noiseTexel = vec4 (1.0,1.0,1.0, 0.5* noise * texel.a); vec4 noiseTexel = vec4 (1.0,1.0,1.0, 0.5* noise * texel.a);
structureTexel = mix(structureTexel, noiseTexel,noiseTexel.a); structureTexel = mix(structureTexel, noiseTexel,noiseTexel.a);
if (use_overlay) if (use_overlay)
{ {
texel = vec4(structureTexel.rgb, texel.a * structureTexel.a); texel = vec4(structureTexel.rgb, smoothstep(0.0, 0.5,texel.a) * structureTexel.a);
} }
fragColor = color * texel;
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = clamp(fragColor, 0.0, 1.0);
fragColor = color * texel + specular;
gl_FragColor = fragColor;
} }

162
Shaders/planet-high.frag Normal file
View file

@ -0,0 +1,162 @@
// -*-C++-*-
// Ambient term comes in gl_Color.rgb.
#version 120
varying vec4 diffuse_term;
varying vec3 normal;
varying vec3 ecViewDir;
varying vec3 VTangent;
uniform float visibility;
uniform float sun_angle;
uniform bool use_clouds;
uniform bool use_cloud_shadows;
uniform bool use_overlay;
uniform sampler2D texture;
uniform sampler2D shadowtex;
uniform sampler2D grain_texture;
uniform sampler2D normal_texture;
float Noise2D(in vec2 coord, in float wavelength);
vec3 filter_combined (in vec3 color) ;
void main()
{
vec3 n;
float NdotL, NdotHV;
vec4 color = gl_Color;
vec3 lightDir = normalize(gl_LightSource[0].position.xyz);
vec3 halfVector = normalize(lightDir + normalize(ecViewDir));
vec4 texel;
vec4 shadowTexel;
vec4 grainTexel;
vec4 fragColor;
vec4 specular = vec4(0.0);
// If gl_Color.a == 0, this is a back-facing polygon and the
// normal should be reversed.
n = (2.0 * gl_Color.a - 1.0) * normal;
n = normalize(n);
vec4 nmap = texture2D(normal_texture, gl_TexCoord[0].st);
vec3 VBinormal;
VBinormal = normalize(cross(normal, VTangent));
vec3 N = nmap.rgb * 2.0 - 1.0;
N = normalize(N.x * normalize(VTangent) * 0.6 + N.y * VBinormal * 0.6 + N.z * n);
float xOffset = -0.005 * dot(lightDir, normalize(VTangent));
float yOffset = -0.005 * dot(lightDir, VBinormal);
if ((use_cloud_shadows)&&(use_clouds))
{shadowTexel = texture2D(shadowtex, vec2(gl_TexCoord[0].s-xOffset, gl_TexCoord[0].t-yOffset));}
else
{shadowTexel = vec4 (0.0,0.0,0.0,0.0);}
texel = texture2D(texture, gl_TexCoord[0].st);
float night_light = (1.0 -texel.a);
texel.a = 1.0;
grainTexel = texture2D(grain_texture, gl_TexCoord[0].st * 40.0);
float noise = Noise2D( gl_TexCoord[0].st, 0.00005);
noise += Noise2D( gl_TexCoord[0].st, 0.0002);
noise += Noise2D( gl_TexCoord[0].st, 0.0001);
noise= noise/3.0;
vec3 light_specular = vec3 (1.0, 1.0, 1.0);
NdotL = dot(N, lightDir);
float NdotLraw = NdotL;
// due to atmosphere scattering, we should make this harder
NdotL = smoothstep(-0.2,0.2,NdotL);
// fog does not feel normal map
float NdotLfog = smoothstep(-0.2, 0.2, dot(n, lightDir));
float intensity = length(diffuse_term);
vec4 dawn = intensity * normalize (vec4 (1.0,0.5,0.3,1.0));
vec4 diff_term = mix(dawn, diffuse_term, smoothstep(0.0, 0.3, NdotL));
intensity = length(light_specular);
light_specular = mix(dawn.rgb, light_specular, smoothstep(0.0, 0.4, NdotL));
float oceanness = smoothstep(0.0, 0.1,length(texel.rgb - vec3 (0.007,0.019, 0.078)));
float specular_enhancement = 4.0 * (1.0 - oceanness);
if (use_overlay) {
//texel.rgb = mix(texel.rgb, grainTexel.rgb, 0.4* grainTexel.a * oceanness);
texel.rgb = texel.rgb * (0.85 + 0.3 * noise);
texel.r = smoothstep(0.0, 0.95, texel.r);
texel.g = smoothstep(0.0, 0.95, texel.g);
texel.b = smoothstep(0.0, 0.95, texel.b);
float intensity = length(texel.rgb);
texel.rgb = mix(texel.rgb, intensity * vec3 (1.0,1.0,1.0), 0.3);
}
//texel.rgb = vec3 (0.5,0.5,0.5);
if (NdotL > 0.0) {
color += diff_term * NdotL * (1.0-shadowTexel.a);
NdotHV = max(dot(n, halfVector), 0.0);
if (gl_FrontMaterial.shininess > 0.0)
specular.rgb = (gl_FrontMaterial.specular.rgb * specular_enhancement
* light_specular * (1.0-shadowTexel.a)
* pow(NdotHV, gl_FrontMaterial.shininess));
}
color.a = diffuse_term.a;
// This shouldn't be necessary, but our lighting becomes very
// saturated. Clamping the color before modulating by the texture
// is closer to what the OpenGL fixed function pipeline does.
color = clamp(color, 0.0, 1.0);
fragColor = color * texel + specular;
float night_light_factor = night_light * (1.0 - smoothstep(-0.3, 0.0, NdotLraw));
float noise_factor = (0.4 + 0.6* smoothstep(0.7 - 0.4* night_light,0.9 - 0.4 * night_light,noise));
night_light_factor *= noise_factor;
vec3 light_color = vec3(1.0, 0.7, 0.3);
vec3 central_light_color = vec3 (1.0, 1.0, 1.0);
light_color = mix(light_color, central_light_color, smoothstep(0.3, 0.6,noise*noise * night_light));
fragColor.rgb += light_color * night_light_factor * 1.4;
float angle = dot(normalize(ecViewDir), normalize(normal));
float distance_through_atmosphere = min(10.0 / (abs(angle)+0.001),500.0);
float correction = smoothstep(-0.4, 0.0, dot(n, lightDir) - 0.45 ) ;
//correction = correction + (1.0 - correction) * (1.0 - smoothstep(1.40, 1.57, sun_angle));
float correction1 = 1.0 - smoothstep(1.4, 1.45, sun_angle);
correction1 = 1.0;
//vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * clamp(length(diffuse_term.rgb/1.73 * correction * clamp(NdotL + correction1,0.01, 0.99) ),0.0,1.0);
vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * clamp(smoothstep(0.4, 1.0,NdotLfog),0.0,1.0) * length(diff_term.rgb/1.73);
float fogFactor = exp(-distance_through_atmosphere/(visibility/1000.0));
fragColor = mix(fogColor, fragColor, fogFactor);
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = clamp(fragColor, 0.0, 1.0);
}

View file

@ -18,7 +18,7 @@ uniform sampler2D shadowtex;
uniform sampler2D grain_texture; uniform sampler2D grain_texture;
float Noise2D(in vec2 coord, in float wavelength); float Noise2D(in vec2 coord, in float wavelength);
vec3 filter_combined (in vec3 color) ;
void main() void main()
@ -70,12 +70,12 @@ void main()
NdotL = smoothstep(-0.2,0.2,NdotL); NdotL = smoothstep(-0.2,0.2,NdotL);
float intensity = length(diffuse_term); float intensity = length(diffuse_term);
vec4 dawn = intensity * normalize (vec4 (1.0,0.4,0.4,1.0)); vec4 dawn = intensity * normalize (vec4 (1.0,0.5,0.3,1.0));
vec4 diff_term = mix(dawn, diffuse_term, smoothstep(0.0, 0.2, NdotL)); vec4 diff_term = mix(dawn, diffuse_term, smoothstep(0.0, 0.3, NdotL));
intensity = length(light_specular); intensity = length(light_specular);
light_specular = mix(dawn.rgb, light_specular, smoothstep(0.0, 0.2, NdotL)); light_specular = mix(dawn.rgb, light_specular, smoothstep(0.0, 0.4, NdotL));
float oceanness = smoothstep(0.0, 0.1,length(texel.rgb - vec3 (0.007,0.019, 0.078))); float oceanness = smoothstep(0.0, 0.1,length(texel.rgb - vec3 (0.007,0.019, 0.078)));
float specular_enhancement = 4.0 * (1.0 - oceanness); float specular_enhancement = 4.0 * (1.0 - oceanness);
@ -96,7 +96,7 @@ void main()
if (NdotL > 0.0) { if (NdotL > 0.0) {
color += diffuse_term * NdotL * (1.0-shadowTexel.a); color += diff_term * NdotL * (1.0-shadowTexel.a);
NdotHV = max(dot(n, halfVector), 0.0); NdotHV = max(dot(n, halfVector), 0.0);
if (gl_FrontMaterial.shininess > 0.0) if (gl_FrontMaterial.shininess > 0.0)
specular.rgb = (gl_FrontMaterial.specular.rgb * specular_enhancement specular.rgb = (gl_FrontMaterial.specular.rgb * specular_enhancement
@ -113,15 +113,13 @@ void main()
color = clamp(color, 0.0, 1.0); color = clamp(color, 0.0, 1.0);
fragColor = color * texel + specular; fragColor = color * texel + specular;
//fragColor = fragColor * (1.0 - 0.5 * shadowTexel.a);
//fragColor = mix(fragColor, shadowTexel, shadowTexel.a);
float night_light_factor = night_light * (1.0 - smoothstep(-0.3, 0.0, NdotLraw)); float night_light_factor = night_light * (1.0 - smoothstep(-0.3, 0.0, NdotLraw));
float noise_factor = (0.4 + 0.6* smoothstep(0.7 - 0.4* night_light,0.9 - 0.4 * night_light,noise)); float noise_factor = (0.4 + 0.6* smoothstep(0.7 - 0.4* night_light,0.9 - 0.4 * night_light,noise));
night_light_factor *= noise_factor; night_light_factor *= noise_factor;
//night_light_factor *=smoothstep(0.1 + (0.3*night_light), 0.2 + (0.3*night_light), noise);
//night_light_factor = smoothstep(0.3, 0.4, night_light_factor);
vec3 light_color = vec3(1.0, 0.7, 0.3); vec3 light_color = vec3(1.0, 0.7, 0.3);
vec3 central_light_color = vec3 (1.0, 1.0, 1.0); vec3 central_light_color = vec3 (1.0, 1.0, 1.0);
@ -133,19 +131,22 @@ void main()
float distance_through_atmosphere = min(10.0 / (abs(angle)+0.001),500.0); float distance_through_atmosphere = min(10.0 / (abs(angle)+0.001),500.0);
float correction = smoothstep(-0.4, 0.0, dot(n, lightDir) - 0.45 ) ; float correction = smoothstep(-0.4, 0.0, dot(n, lightDir) - 0.45 ) ;
correction = correction + (1.0 - correction) * (1.0 - smoothstep(1.40, 1.57, sun_angle)); //correction = correction + (1.0 - correction) * (1.0 - smoothstep(1.40, 1.57, sun_angle));
float correction1 = 1.0 - smoothstep(1.4, 1.45, sun_angle); float correction1 = 1.0 - smoothstep(1.4, 1.45, sun_angle);
correction1 = 1.0;
//vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * clamp(length(diffuse_term.rgb/1.73 * correction * clamp(NdotL + correction1,0.01, 0.99) ),0.0,1.0);
vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * clamp(length(diffuse_term.rgb/1.73 * correction * clamp(NdotL + correction1,0.01, 0.99) ),0.0,1.0); vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * clamp(smoothstep(0.4, 1.0,NdotL),0.0,1.0) * length(diff_term.rgb/1.73);
float fogFactor = exp(-distance_through_atmosphere/(visibility/1000.0)); float fogFactor = exp(-distance_through_atmosphere/(visibility/1000.0));
fragColor = mix(fogColor, fragColor, fogFactor); fragColor = mix(fogColor, fragColor, fogFactor);
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = clamp(fragColor, 0.0, 1.0); gl_FragColor = clamp(fragColor, 0.0, 1.0);
//gl_FragColor = vec4 (NdotL - 0.5, NdotL - 0.5, NdotL - 0.5, 1.0);
} }

View file

@ -6,6 +6,7 @@
// Written by Lauri Peltonen (Zan) // Written by Lauri Peltonen (Zan)
// Implementation of O'Neil's algorithm // Implementation of O'Neil's algorithm
// Ground haze layer added by Thorsten Renk // Ground haze layer added by Thorsten Renk
// aurora and ice haze scattering Thorsten Renk 2016
varying vec3 rayleigh; varying vec3 rayleigh;
varying vec3 mie; varying vec3 mie;
@ -17,6 +18,7 @@ varying float cphi;
varying float delta_z; varying float delta_z;
varying float alt; varying float alt;
varying float earthShade; varying float earthShade;
uniform float overcast; uniform float overcast;
uniform float saturation; uniform float saturation;
@ -44,6 +46,7 @@ uniform int use_alt_landing_light;
const float EarthRadius = 5800000.0; const float EarthRadius = 5800000.0;
float Noise2D(in vec2 coord, in float wavelength); float Noise2D(in vec2 coord, in float wavelength);
float fog_backscatter(in float avisibility); float fog_backscatter(in float avisibility);
@ -103,14 +106,21 @@ void main()
// position of the horizon line // position of the horizon line
float lAltitude = alt + delta_z; float lAltitude = alt + delta_z;
float radiusEye = EarthRadius + alt; float radiusEye = (EarthRadius + alt);
float radiusLayer = EarthRadius + lAltitude; float radiusLayer = (EarthRadius + lAltitude);
float cthorizon; float cthorizon;
float ctterrain; float ctterrain;
//float ctsd;
float SkydomeRadius = (EarthRadius + 100000.0);
float rEye = (EarthRadius + alt);
if (radiusEye > radiusLayer) cthorizon = -sqrt(radiusEye * radiusEye - radiusLayer * radiusLayer)/radiusEye; if (radiusEye > radiusLayer) cthorizon = -sqrt(radiusEye * radiusEye - radiusLayer * radiusLayer)/radiusEye;
else cthorizon = sqrt(radiusLayer * radiusLayer - radiusEye * radiusEye)/radiusLayer; else cthorizon = sqrt(radiusLayer * radiusLayer - radiusEye * radiusEye)/radiusLayer;
//if (rEye > SkydomeRadius) ctsd = -sqrt(rEye * rEye - SkydomeRadius * SkydomeRadius)/rEye;
//else ctsd = 0.0;//sqrt(SkydomeRadius * SkydomeRadius - rEye * rEye)/SkydomeRadius;
ctterrain = -sqrt(radiusEye * radiusEye - EarthRadius * EarthRadius)/radiusEye; ctterrain = -sqrt(radiusEye * radiusEye - EarthRadius * EarthRadius)/radiusEye;
vec3 color = rayleigh * rayleighPhase(cosTheta); vec3 color = rayleigh * rayleighPhase(cosTheta);
@ -346,14 +356,22 @@ hColor = clamp(hColor,0.0,1.0);
color = mix(hColor+secondary_light * fog_backscatter(avisibility),color, transmission); color = mix(hColor+secondary_light * fog_backscatter(avisibility),color, transmission);
// blur the upper skydome edge when we're outside the atmosphere
float asf = smoothstep (75000.0, 90000.0, alt);
float asf_corr = clamp((alt-115000.0)/45000.0, 0.0,1.0) * 0.08;
color *= (1.0 - smoothstep( -0.12 -asf_corr, -0.06 - asf_corr, costheta) * asf);
color = filter_combined(color); color = filter_combined(color);
gl_FragColor = vec4(color, 1.0); gl_FragColor = vec4(color, 1.0);
gl_FragDepth = 0.1; gl_FragDepth = 0.1;
//gl_FragColor.rgb *= aurora_v * aurora_h;
//float test = dot (normalize(relVector), vec3 (0.0, 0.0, 1.0));
//gl_FragColor = vec4(test, test, test, 1.0);
} }

View file

@ -1,3 +1,5 @@
// -*-C++-*-
#version 120 #version 120
// Atmospheric scattering shader for flightgear // Atmospheric scattering shader for flightgear
@ -13,6 +15,7 @@ uniform float avisibility;
uniform float visibility; uniform float visibility;
uniform float terrain_alt; uniform float terrain_alt;
uniform float air_pollution; uniform float air_pollution;
uniform float radius_modifier;
varying vec3 rayleigh; varying vec3 rayleigh;
varying vec3 mie; varying vec3 mie;
@ -25,6 +28,7 @@ varying float delta_z;
varying float alt; varying float alt;
varying float earthShade; varying float earthShade;
// Dome parameters from FG and screen // Dome parameters from FG and screen
const float domeSize = 80000.0; const float domeSize = 80000.0;
const float realDomeSize = 100000.0; const float realDomeSize = 100000.0;
@ -118,7 +122,8 @@ void main()
// Calculate altitude as the distance from skydome center to camera // Calculate altitude as the distance from skydome center to camera
// Make it so that 0.0 is ground level and 1.0 is 100km (space) level // Make it so that 0.0 is ground level and 1.0 is 100km (space) level
float altitude = distance(groundPoint, vec4(0.0, 0.0, 0.0, 1.0)); // the correction ensures compatibility with Earthview for orbits farther out
float altitude = distance(groundPoint, vec4(0.0, 0.0, 0.0, 1.0)) * (1.0 -0.0013);
float scaledAltitude = altitude / realDomeSize; float scaledAltitude = altitude / realDomeSize;
// the local horizon angle // the local horizon angle

View file

@ -95,7 +95,26 @@
<command>dialog-apply</command> <command>dialog-apply</command>
</binding> </binding>
</checkbox> </checkbox>
<checkbox>
<row>4</row>
<col>1</col>
<label> Terrain normal mapping</label>
<halign>left</halign>
<property>/earthview/normal-flag</property>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox>
<checkbox>
<row>5</row>
<col>1</col>
<label> Cloud normal mapping</label>
<halign>left</halign>
<property>/earthview/cloud-normal-flag</property>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox>
</group> </group>
</group> </group>
@ -189,6 +208,10 @@
<command>dialog-apply</command> <command>dialog-apply</command>
<object-name>cloud-rotation-angle</object-name> <object-name>cloud-rotation-angle</object-name>
</binding> </binding>
<binding>
<command>nasal</command>
<script>earthview.adjust_cloud_tiles()</script>
</binding>
</slider> </slider>
<text> <text>
<label>12345678</label> <label>12345678</label>

View file

@ -1288,14 +1288,17 @@ Started September 2000 by David Megginson, david@megginson.com
<overlay-texture-flag type="bool" userarchive="y">true</overlay-texture-flag> <overlay-texture-flag type="bool" userarchive="y">true</overlay-texture-flag>
<mrd-flag type="bool" userarchive="y">true</mrd-flag> <mrd-flag type="bool" userarchive="y">true</mrd-flag>
<cloudsphere-angle type="double" userarchive="n">0.0</cloudsphere-angle> <cloudsphere-angle type="double" userarchive="n">0.0</cloudsphere-angle>
<show-n1 type="bool" userarchive="n">true</show-n1> <show-n1 type="bool" userarchive="n">false</show-n1>
<show-n2 type="bool" userarchive="n">true</show-n2> <show-n2 type="bool" userarchive="n">false</show-n2>
<show-n3 type="bool" userarchive="n">true</show-n3> <show-n3 type="bool" userarchive="n">false</show-n3>
<show-n4 type="bool" userarchive="n">true</show-n4> <show-n4 type="bool" userarchive="n">false</show-n4>
<show-s1 type="bool" userarchive="n">true</show-s1> <show-s1 type="bool" userarchive="n">true</show-s1>
<show-s2 type="bool" userarchive="n">true</show-s2> <show-s2 type="bool" userarchive="n">true</show-s2>
<show-s3 type="bool" userarchive="n">true</show-s3> <show-s3 type="bool" userarchive="n">true</show-s3>
<show-s4 type="bool" userarchive="n">true</show-s4> <show-s4 type="bool" userarchive="n">true</show-s4>
<show-dummy type="bool" userarchive="n">false</show-dummy>
<normal-flag type="bool" userarchive="y">false</normal-flag>
<cloud-normal-flag type="bool" userarchive="y">false</cloud-normal-flag>
</earthview> </earthview>
</PropertyList> </PropertyList>
<!-- end of preferences.xml --> <!-- end of preferences.xml -->