1
0
Fork 0

Merge branch 'master' of git://gitorious.org/fg/fgdata

This commit is contained in:
BARANGER Emmanuel 2011-12-02 15:10:24 +01:00
commit faec3b6a20
58 changed files with 6854 additions and 2352 deletions

555
Effects/bowwave.eff Normal file
View file

@ -0,0 +1,555 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/bowwave</name>
<inherits-from>Effects/model-default</inherits-from>
<parameters>
<texture n="0">
<image>/Textures/Water/water-reflection.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="2">
<image>/Textures/Water/perlin-noise-nm.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="3">
<image>/Textures/Water/waves-ver10-dudv.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="4">
<image>/Textures/Water/water-reflection-grey.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="5">
<image>/Textures/Water/sea_foam.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="6">
<image>/Textures/Water/bowwave3.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="7">
<image>/Textures/Water/bowwave_normal.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<saturation>
<use>/rendering/scene/saturation</use>
</saturation>
<status>
<use>/environment/config/enabled</use>
</status>
<overcast>
<use>/rendering/scene/overcast</use>
</overcast>
<cloud-cover0>
<use>/environment/clouds/layer[0]/coverage-type</use>
</cloud-cover0>
<cloud-cover1>
<use>/environment/clouds/layer[1]/coverage-type</use>
</cloud-cover1>
<cloud-cover2>
<use>/environment/clouds/layer[2]/coverage-type</use>
</cloud-cover2>
<cloud-cover3>
<use>/environment/clouds/layer[3]/coverage-type</use>
</cloud-cover3>
<cloud-cover4>
<use>/environment/clouds/layer[4]/coverage-type</use>
</cloud-cover4>
<windE>
<use>/environment/sea/surface/wind-from-east-fps</use>
</windE>
<windN>
<use>/environment/sea/surface/wind-from-north-fps</use>
</windN>
<speed-kt>
<use>/environment/Vinson/spd-kt</use>
</speed-kt>
<heading-deg>
<use>/environment/Vinson/hdg-deg</use>
</heading-deg>
<rendering-hint>transparent</rendering-hint>
<shade-model>smooth</shade-model>
<!-- fog include -->
<visibility>
<use>/environment/ground-visibility-m</use>
</visibility>
<avisibility>
<use>/environment/visibility-m</use>
</avisibility>
<lthickness>
<use>/environment/ground-haze-thickness-m</use>
</lthickness>
<scattering>
<use>/rendering/scene/scattering</use>
</scattering>
<terminator>
<use>/environment/terminator-relative-position-m</use>
</terminator>
<fogtype>
<use>/sim/rendering/scattering-shader</use>
</fogtype>
<!-- END fog include -->
</parameters>
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/shaders/water</property>
<!--<property>/sim/rendering/shader-effects</property>-->
<less-equal>
<value type="float">2.0</value>
<float-property>/sim/rendering/shaders/quality-level</float-property>
</less-equal>
<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>
</and>
</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>
<active>
<use>blend/active</use>
</active>
<source>
<use>blend/source</use>
</source>
<destination>
<use>blend/destination</use>
</destination>
</blend>
<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>
<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>
<internal-format>
<use>texture[0]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>2</unit>
<image>
<use>texture[2]/image</use>
</image>
<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>
<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>
<texture-unit>
<unit>4</unit>
<image>
<use>texture[4]/image</use>
</image>
<filter>
<use>texture[4]/filter</use>
</filter>
<wrap-s>
<use>texture[4]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[4]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[4]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>5</unit>
<image>
<use>texture[5]/image</use>
</image>
<filter>
<use>texture[5]/filter</use>
</filter>
<wrap-s>
<use>texture[5]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[5]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[5]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>6</unit>
<image>
<use>texture[6]/image</use>
</image>
<filter>
<use>texture[6]/filter</use>
</filter>
<wrap-s>
<use>texture[6]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[6]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[6]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>7</unit>
<image>
<use>texture[7]/image</use>
</image>
<filter>
<use>texture[7]/filter</use>
</filter>
<wrap-s>
<use>texture[7]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[7]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[7]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>9</unit>
<type>noise</type>
</texture-unit>
<program>
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
<vertex-shader>Shaders/wake.vert</vertex-shader>
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
<fragment-shader>Shaders/bowwave.frag</fragment-shader>
</program>
<uniform>
<name>water_reflection</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>water_normalmap</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>water_dudvmap</name>
<type>sampler-2d</type>
<value type="int">3</value>
</uniform>
<uniform>
<name>water_reflection_grey</name>
<type>sampler-2d</type>
<value type="int">4</value>
</uniform>
<uniform>
<name>sea_foam</name>
<type>sampler-2d</type>
<value type="int">5</value>
</uniform>
<uniform>
<name>alpha_tex</name>
<type>sampler-2d</type>
<value type="int">6</value>
</uniform>
<uniform>
<name>bowwave_nmap</name>
<type>sampler-2d</type>
<value type="int">7</value>
</uniform>
<uniform>
<name>saturation</name>
<type>float</type>
<!--<value>0.4</value>-->
<value>
<use>saturation</use>
</value>
</uniform>
<uniform>
<name>CloudCover0</name>
<type>float</type>
<value>
<use>cloud-cover0</use>
</value>
</uniform>
<uniform>
<name>CloudCover1</name>
<type>float</type>
<value>
<use>cloud-cover1</use>
</value>
</uniform>
<uniform>
<name>CloudCover2</name>
<type>float</type>
<value>
<use>cloud-cover2</use>
</value>
</uniform>
<uniform>
<name>CloudCover3</name>
<type>float</type>
<value>
<use>cloud-cover3</use>
</value>
</uniform>
<uniform>
<name>CloudCover4</name>
<type>float</type>
<value>
<use>cloud-cover4</use>
</value>
</uniform>
<uniform>
<name>Status</name>
<type>int</type>
<value>
<use>status</use>
</value>
<!--<value type="int">0</value> -->
</uniform>
<uniform>
<name>Overcast</name>
<type>float</type>
<value>
<use>overcast</use>
</value>
</uniform>
<uniform>
<name>WindE</name>
<type>float</type>
<value>
<use>windE</use>
</value>
</uniform>
<uniform>
<name>WindN</name>
<type>float</type>
<value>
<use>windN</use>
</value>
</uniform>
<uniform>
<name>spd</name>
<type>float</type>
<value><use>speed-kt</use></value>
</uniform>
<uniform>
<name>hdg</name>
<type>float</type>
<value>
<use>heading-deg</use>
</value>
</uniform>
<uniform>
<name>Noise</name>
<type>sampler-3d</type>
<value type="int">9</value>
</uniform>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
</pass>
</technique>
<technique n="10">
<predicate>
<and>
<property>/sim/rendering/shaders/water</property>
<property>/sim/rendering/shaders/quality-level</property>
<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>
</and>
</predicate>
<pass>
<lighting>true</lighting>
<material>
<ambient>
<use>material/ambient</use>
</ambient>
<diffuse>
<use>material/diffuse</use>
</diffuse>
<specular>
<use>material/specular</use>
</specular>
<color-mode>ambient-and-diffuse</color-mode>
</material>
<blend>
<use>transparent</use>
</blend>
<alpha-test>
<use>transparent</use>
</alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<!--<render-bin>
<bin-number>
<use>render-bin/bin-number</use>
</bin-number>
<bin-name>
<use>render-bin/bin-name</use>
</bin-name>
</render-bin>-->
<texture-unit>
<unit>0</unit>
<type>noise</type>
</texture-unit>
<program>
<vertex-shader>Shaders/water-orig.vert</vertex-shader>
<fragment-shader>Shaders/water-orig.frag</fragment-shader>
</program>
<uniform>
<name>texture</name>
<type>sampler-3d</type>
<value type="int">0</value>
</uniform>
</pass>
</technique>
</PropertyList>

View file

@ -59,7 +59,7 @@ in Aircraft/A320/Models/Effects/a320_bumpspec.eff ( or whatever, private to the
<filter><use>texture[0]/filter</use></filter> <filter><use>texture[0]/filter</use></filter>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s> <wrap-s><use>texture[0]/wrap-s</use></wrap-s>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t> <wrap-t><use>texture[0]/wrap-t</use></wrap-t>
<internal-format><use>texture[1]/internal-format</use></internal-format> <internal-format><use>texture[0]/internal-format</use></internal-format>
</texture-unit> </texture-unit>
<texture-unit> <texture-unit>
<unit>1</unit> <unit>1</unit>
@ -70,8 +70,8 @@ in Aircraft/A320/Models/Effects/a320_bumpspec.eff ( or whatever, private to the
<internal-format><use>texture[2]/internal-format</use></internal-format> <internal-format><use>texture[2]/internal-format</use></internal-format>
</texture-unit> </texture-unit>
<program> <program>
<vertex-shader n="0">Shaders/bumpspec.vert</vertex-shader> <vertex-shader n="1">Shaders/bumpspec.vert</vertex-shader>
<fragment-shader n="0">Shaders/bumpspec.frag</fragment-shader> <fragment-shader n="1">Shaders/bumpspec.frag</fragment-shader>
<attribute> <attribute>
<name>tangent</name> <name>tangent</name>
<index>6</index> <index>6</index>

View file

@ -10,7 +10,7 @@
<technique n="10"> <technique n="10">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/shader-effects</property> <property>/sim/rendering/shaders/quality-level</property>
<or> <or>
<less-equal> <less-equal>
<value type="float">2.0</value> <value type="float">2.0</value>

View file

@ -8,7 +8,7 @@
<technique n="10"> <technique n="10">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/shader-effects</property> <property>/sim/rendering/shaders/quality-level</property>
<less-equal> <less-equal>
<value type="float">1.0</value> <value type="float">1.0</value>
<shader-language/> <shader-language/>

View file

@ -8,7 +8,7 @@
<technique n="10"> <technique n="10">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/shader-effects</property> <property>/sim/rendering/shaders/quality-level</property>
<less-equal> <less-equal>
<value type="float">1.0</value> <value type="float">1.0</value>
<shader-language/> <shader-language/>

View file

@ -8,7 +8,7 @@
<technique n="10"> <technique n="10">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/shader-effects</property> <property>/sim/rendering/shaders/quality-level</property>
<less-equal> <less-equal>
<value type="float">1.0</value> <value type="float">1.0</value>
<shader-language/> <shader-language/>

View file

@ -8,7 +8,7 @@
<technique n="10"> <technique n="10">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/shader-effects</property> <property>/sim/rendering/shaders/quality-level</property>
<less-equal> <less-equal>
<value type="float">1.0</value> <value type="float">1.0</value>
<shader-language/> <shader-language/>

View file

@ -8,7 +8,7 @@
<technique n="10"> <technique n="10">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/shader-effects</property> <property>/sim/rendering/shaders/quality-level</property>
<less-equal> <less-equal>
<value type="float">1.0</value> <value type="float">1.0</value>
<shader-language/> <shader-language/>

View file

@ -16,13 +16,12 @@
<wrap-s>mirror</wrap-s> <wrap-s>mirror</wrap-s>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level> <snow-level><use>/environment/snow-level-m</use></snow-level>
</parameters> </parameters>
<technique n="9"> <technique n="9">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/crop-shader</property> <property>/sim/rendering/shaders/crop</property>
<property>/sim/rendering/shader-effects</property>
<or> <or>
<less-equal> <less-equal>
<value type="float">2.0</value> <value type="float">2.0</value>

View file

@ -16,6 +16,6 @@
<wrap-s>mirror</wrap-s> <wrap-s>mirror</wrap-s>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level> <snow-level><use>/environment/snow-level-m</use></snow-level>
</parameters> </parameters>
</PropertyList> </PropertyList>

View file

@ -15,11 +15,45 @@
</wind-speed> </wind-speed>
<offset>0.0</offset> <offset>0.0</offset>
<amplitude-factor>0.08</amplitude-factor> <amplitude-factor>0.08</amplitude-factor>
<windE>
<use>/environment/sea/surface/wind-from-east-fps</use>
</windE>
<windN>
<use>/environment/sea/surface/wind-from-north-fps</use>
</windN>
<speed-kt>0.0</speed-kt>
<heading-deg>0.0</heading-deg>
<!-- fog include -->
<visibility>
<use>/environment/ground-visibility-m</use>
</visibility>
<avisibility>
<use>/environment/visibility-m</use>
</avisibility>
<lthickness>
<use>/environment/ground-haze-thickness-m</use>
</lthickness>
<scattering>
<use>/rendering/scene/scattering</use>
</scattering>
<terminator>
<use>/environment/terminator-relative-position-m</use>
</terminator>
<fogtype>
<use>/sim/rendering/scattering-shader</use>
</fogtype>
<!-- END fog include -->
</parameters> </parameters>
<technique n="9"> <technique n="9">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/shader-effects</property> <!--<property>/sim/rendering/shader-effects</property>-->
<less-equal>
<value type="float">3.0</value>
<float-property>/sim/rendering/shaders/quality-level</float-property>
</less-equal>
<or> <or>
<less-equal> <less-equal>
<value type="float">2.0</value> <value type="float">2.0</value>
@ -114,7 +148,9 @@
<use>vertex-program-two-side</use> <use>vertex-program-two-side</use>
</vertex-program-two-side> </vertex-program-two-side>
<program> <program>
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
<vertex-shader>Shaders/flutter.vert</vertex-shader> <vertex-shader>Shaders/flutter.vert</vertex-shader>
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
<fragment-shader>Shaders/default.frag</fragment-shader> <fragment-shader>Shaders/default.frag</fragment-shader>
</program> </program>
<!--<uniform> <!--<uniform>
@ -155,6 +191,79 @@
<type>sampler-3d</type> <type>sampler-3d</type>
<value type="int">9</value> <value type="int">9</value>
</uniform> </uniform>
<uniform>
<name>WindE</name>
<type>float</type>
<value>
<use>windE</use>
</value>
</uniform>
<uniform>
<name>WindN</name>
<type>float</type>
<value>
<use>windN</use>
</value>
</uniform>
<uniform>
<name>spd</name>
<type>float</type>
<value>
<use>speed-kt</use>
</value>
</uniform>
<uniform>
<name>hdg</name>
<type>float</type>
<value>
<use>heading-deg</use>
</value>
</uniform>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
</pass> </pass>
</technique> </technique>

View file

@ -30,10 +30,10 @@
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level> <snow-level><use>/environment/snow-level-m</use></snow-level>
<depth-factor type="float">0.04</depth-factor> <depth-factor type="float">0.04</depth-factor>
<canopy-height type="float">15.0</canopy-height> <canopy-height type="float">15.0</canopy-height>
<quality-level><use>/sim/rendering/quality-level</use></quality-level> <quality-level><use>/sim/rendering/shaders/transition</use></quality-level>
<!-- sets the season color --> <!-- sets the season color -->
<season-red type="float">0.12</season-red> <season-red type="float">0.12</season-red>
@ -49,8 +49,7 @@
<technique n="9"> <technique n="9">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/transition-shader</property> <property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/shader-effects</property>
<or> <or>
<less-equal> <less-equal>
<value type="float">2.0</value> <value type="float">2.0</value>

View file

@ -30,10 +30,10 @@
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level> <snow-level><use>/environment/snow-level-m</use></snow-level>
<depth-factor type="float">0.01</depth-factor> <depth-factor type="float">0.01</depth-factor>
<canopy-height type="float">15.0</canopy-height> <canopy-height type="float">15.0</canopy-height>
<quality-level><use>/sim/rendering/quality-level</use></quality-level> <quality-level><use>/sim/rendering/shaders/transition</use></quality-level>
<!-- sets the season color --> <!-- sets the season color -->
<season-red type="float">0.12</season-red> <season-red type="float">0.12</season-red>
@ -49,8 +49,7 @@
<technique n="9"> <technique n="9">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/transition-shader</property> <property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/shader-effects</property>
<or> <or>
<less-equal> <less-equal>
<value type="float">2.0</value> <value type="float">2.0</value>

View file

@ -30,7 +30,7 @@
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level> <snow-level><use>/environment/snow-level-m</use></snow-level>
<depth-factor type="float">0.01</depth-factor> <depth-factor type="float">0.01</depth-factor>
<canopy-height type="float">15.0</canopy-height> <canopy-height type="float">15.0</canopy-height>
@ -40,7 +40,7 @@
<season-blue type="float">0.22</season-blue> <season-blue type="float">0.22</season-blue>
<!-- end season color --> <!-- end season color -->
<quality-level><use>/sim/rendering/quality-level</use></quality-level> <quality-level><use>/sim/rendering/shaders/transition</use></quality-level>
</parameters> </parameters>
<generate> <generate>
<tangent type="int">6</tangent> <tangent type="int">6</tangent>
@ -49,8 +49,7 @@
<technique n="9"> <technique n="9">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/transition-shader</property> <property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/shader-effects</property>
<or> <or>
<less-equal> <less-equal>
<value type="float">2.0</value> <value type="float">2.0</value>

View file

@ -1,299 +1,556 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PropertyList> <PropertyList>
<name>Effects/landmass</name> <name>Effects/landmass</name>
<inherits-from>Effects/terrain-default</inherits-from> <inherits-from>Effects/terrain-default</inherits-from>
<parameters> <parameters>
<texture n="2"> <texture n="2">
<image>Textures.high/Terrain/forest-relief.png</image> <image>Textures.high/Terrain/forest-relief.png</image>
<filter>linear-mipmap-linear</filter> <filter>linear-mipmap-linear</filter>
<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>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level> <snow-level>
<depth-factor type="float">0.01</depth-factor> <use>/environment/snow-level-m</use>
<canopy-height type="float">15.0</canopy-height> </snow-level>
<quality-level><use>/sim/rendering/quality-level</use></quality-level> <depth-factor type="float">0.01</depth-factor>
</parameters> <canopy-height type="float">15.0</canopy-height>
<generate> <quality-level>
<tangent type="int">6</tangent> <use>/sim/rendering/shaders/quality-level</use>
<binormal type="int">7</binormal> </quality-level>
</generate> </parameters>
<technique n="8">
<predicate> <!--fog include-->
<and> <visibility>
<property>/sim/rendering/landmass-shader</property> <use>/environment/ground-visibility-m</use>
<property>/sim/rendering/shader-effects</property> </visibility>
<less-equal> <avisibility>
<value type="float">4.5</value> <use>/environment/visibility-m</use>
<float-property>/sim/rendering/quality-level</float-property> </avisibility>
</less-equal> <lthickness>
<or> <use>/environment/ground-haze-thickness-m</use>
<less-equal> </lthickness>
<value type="float">2.0</value> <scattering>
<glversion/> <use>/rendering/scene/scattering</use>
</less-equal> </scattering>
<and> <terminator>
<extension-supported>GL_ARB_shader_objects</extension-supported> <use>/environment/terminator-relative-position-m</use>
<extension-supported>GL_ARB_shading_language_100</extension-supported> </terminator>
<extension-supported>GL_ARB_vertex_shader</extension-supported> <fogtype>
<extension-supported>GL_ARB_fragment_shader</extension-supported> <use>/sim/rendering/scattering-shader</use>
</and> </fogtype>
</or> <!-- END fog include -->
<extension-supported>GL_EXT_geometry_shader4</extension-supported>
</and> <generate>
</predicate> <tangent type="int">6</tangent>
<pass> <binormal type="int">7</binormal>
<lighting>true</lighting> </generate>
<material> <technique n="8">
<ambient><use>material/ambient</use></ambient> <predicate>
<diffuse><use>material/diffuse</use></diffuse> <and>
<specular><use>material/specular</use></specular> <property>/sim/rendering/shaders/landmass</property>
<color-mode>ambient-and-diffuse</color-mode> <less-equal>
</material> <value type="float">4.5</value>
<alpha-test><use>transparent</use></alpha-test> <float-property>/sim/rendering/shaders/quality-level</float-property>
<shade-model>smooth</shade-model> </less-equal>
<cull-face>back</cull-face> <or>
<render-bin> <less-equal>
<bin-number>-1</bin-number> <value type="float">2.0</value>
<bin-name>RenderBin</bin-name> <glversion/>
</render-bin> </less-equal>
<texture-unit> <and>
<unit>1</unit> <extension-supported>GL_ARB_shader_objects</extension-supported>
<image><use>texture[0]/image</use></image> <extension-supported>GL_ARB_shading_language_100</extension-supported>
<filter><use>texture[0]/filter</use></filter> <extension-supported>GL_ARB_vertex_shader</extension-supported>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s> <extension-supported>GL_ARB_fragment_shader</extension-supported>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t> </and>
<internal-format> </or>
<use>texture[0]/internal-format</use> <extension-supported>GL_EXT_geometry_shader4</extension-supported>
</internal-format> </and>
</texture-unit> </predicate>
<program> <pass>
<vertex-shader>Shaders/landmass-g.vert</vertex-shader> <lighting>true</lighting>
<geometry-shader>Shaders/landmass.geom</geometry-shader> <material>
<fragment-shader>Shaders/terrain-nocolor.frag</fragment-shader> <ambient>
<geometry-vertices-out type="int">18</geometry-vertices-out> <use>material/ambient</use>
<geometry-input-type>triangles</geometry-input-type> </ambient>
<geometry-output-type>triangle-strip</geometry-output-type> <diffuse>
<attribute> <use>material/diffuse</use>
<name>tangent</name> </diffuse>
<index>6</index> <specular>
</attribute> <use>material/specular</use>
<attribute> </specular>
<name>binormal</name> <color-mode>ambient-and-diffuse</color-mode>
<index>7</index> </material>
</attribute> <alpha-test>
</program> <use>transparent</use>
<uniform> </alpha-test>
<name>texture</name> <shade-model>smooth</shade-model>
<type>sampler-2d</type> <cull-face>back</cull-face>
<value type="int">1</value> <render-bin>
</uniform> <bin-number>-1</bin-number>
<uniform> <bin-name>RenderBin</bin-name>
<name>canopy_height</name> </render-bin>
<type>float</type> <texture-unit>
<value><use>canopy-height</use></value> <unit>1</unit>
</uniform> <image>
<color-mask type="vec4d">0 0 0 0</color-mask> <use>texture[0]/image</use>
</pass> </image>
<pass> <filter>
<lighting>true</lighting> <use>texture[0]/filter</use>
<material> </filter>
<ambient><use>material/ambient</use></ambient> <wrap-s>
<diffuse><use>material/diffuse</use></diffuse> <use>texture[0]/wrap-s</use>
<specular><use>material/specular</use></specular> </wrap-s>
<color-mode>ambient-and-diffuse</color-mode> <wrap-t>
</material> <use>texture[0]/wrap-t</use>
<blend><use>transparent</use></blend> </wrap-t>
<alpha-test><use>transparent</use></alpha-test> <internal-format>
<shade-model>smooth</shade-model> <use>texture[0]/internal-format</use>
<cull-face>back</cull-face> </internal-format>
<render-bin> </texture-unit>
<bin-number><use>render-bin/bin-number</use></bin-number> <program>
<bin-name><use>render-bin/bin-name</use></bin-name> <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
</render-bin> <vertex-shader n="1">Shaders/landmass-g.vert</vertex-shader>
<texture-unit> <geometry-shader>Shaders/landmass.geom</geometry-shader>
<unit>0</unit> <fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<type>noise</type> <fragment-shader n="1">Shaders/terrain-nocolor.frag</fragment-shader>
</texture-unit> <geometry-vertices-out type="int">18</geometry-vertices-out>
<texture-unit> <geometry-input-type>triangles</geometry-input-type>
<unit>1</unit> <geometry-output-type>triangle-strip</geometry-output-type>
<image><use>texture[0]/image</use></image> <attribute>
<filter><use>texture[0]/filter</use></filter> <name>tangent</name>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s> <index>6</index>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t> </attribute>
<internal-format> <attribute>
<use>texture[0]/internal-format</use> <name>binormal</name>
</internal-format> <index>7</index>
</texture-unit> </attribute>
<texture-unit> </program>
<unit>2</unit> <uniform>
<image><use>texture[2]/image</use></image> <name>texture</name>
<filter><use>texture[2]/filter</use></filter> <type>sampler-2d</type>
<wrap-s><use>texture[2]/wrap-s</use></wrap-s> <value type="int">1</value>
<wrap-t><use>texture[2]/wrap-t</use></wrap-t> </uniform>
<internal-format> <uniform>
<use>texture[2]/internal-format</use> <name>canopy_height</name>
</internal-format> <type>float</type>
</texture-unit> <value>
<program> <use>canopy-height</use>
<vertex-shader>Shaders/landmass-g.vert</vertex-shader> </value>
<geometry-shader>Shaders/landmass.geom</geometry-shader> </uniform>
<fragment-shader>Shaders/landmass.frag</fragment-shader> <color-mask type="vec4d">0 0 0 0</color-mask>
<geometry-vertices-out type="int">18</geometry-vertices-out>
<geometry-input-type>triangles</geometry-input-type> <!-- BEGIN fog include -->
<geometry-output-type>triangle-strip</geometry-output-type> <uniform>
<attribute> <name>visibility</name>
<name>tangent</name> <type>float</type>
<index>6</index> <value>
</attribute> <use>visibility</use>
<attribute> </value>
<name>binormal</name> </uniform>
<index>7</index> <uniform>
</attribute> <name>avisibility</name>
</program> <type>float</type>
<uniform> <value>
<name>NoiseTex</name> <use>avisibility</use>
<type>sampler-3d</type> </value>
<value type="int">0</value> </uniform>
</uniform> <uniform>
<uniform> <name>hazeLayerAltitude</name>
<name>BaseTex</name> <type>float</type>
<type>sampler-2d</type> <value>
<value type="int">1</value> <use>lthickness</use>
</uniform> </value>
<uniform> </uniform>
<name>NormalTex</name> <uniform>
<type>sampler-2d</type> <name>scattering</name>
<value type="int">2</value> <type>float</type>
</uniform> <value>
<uniform> <use>scattering</use>
<name>depth_factor</name> </value>
<type>float</type> </uniform>
<value><use>depth-factor</use></value> <uniform>
</uniform> <name>terminator</name>
<uniform> <type>float</type>
<name>snowlevel</name> <value>
<type>float</type> <use>terminator</use>
<value><use>snow-level</use></value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>canopy_height</name> <name>fogType</name>
<type>float</type> <type>int</type>
<value><use>canopy-height</use></value> <value>
</uniform> <use>fogtype</use>
<uniform> </value>
<name>quality_level</name> </uniform>
<type>float</type> <!-- END fog include -->
<value><use>quality-level</use></value>
</uniform> </pass>
<depth> <pass>
<function>lequal</function> <lighting>true</lighting>
<write-mask type="bool">false</write-mask> <material>
</depth> <ambient>
</pass> <use>material/ambient</use>
</technique> </ambient>
<technique n="9"> <diffuse>
<predicate> <use>material/diffuse</use>
<and> </diffuse>
<property>/sim/rendering/landmass-shader</property> <specular>
<property>/sim/rendering/shader-effects</property> <use>material/specular</use>
<or> </specular>
<less-equal> <color-mode>ambient-and-diffuse</color-mode>
<value type="float">2.0</value> </material>
<glversion/> <blend>
</less-equal> <use>transparent</use>
<and> </blend>
<extension-supported>GL_ARB_shader_objects</extension-supported> <alpha-test>
<extension-supported>GL_ARB_shading_language_100</extension-supported> <use>transparent</use>
<extension-supported>GL_ARB_vertex_shader</extension-supported> </alpha-test>
<extension-supported>GL_ARB_fragment_shader</extension-supported> <shade-model>smooth</shade-model>
</and> <cull-face>back</cull-face>
</or> <render-bin>
</and> <bin-number>
</predicate> <use>render-bin/bin-number</use>
<pass> </bin-number>
<lighting>true</lighting> <bin-name>
<material> <use>render-bin/bin-name</use>
<ambient><use>material/ambient</use></ambient> </bin-name>
<diffuse><use>material/diffuse</use></diffuse> </render-bin>
<specular><use>material/specular</use></specular> <texture-unit>
<color-mode>ambient-and-diffuse</color-mode> <unit>0</unit>
</material> <type>noise</type>
<blend><use>transparent</use></blend> </texture-unit>
<alpha-test><use>transparent</use></alpha-test> <texture-unit>
<shade-model>smooth</shade-model> <unit>1</unit>
<cull-face>back</cull-face> <image>
<render-bin> <use>texture[0]/image</use>
<bin-number><use>render-bin/bin-number</use></bin-number> </image>
<bin-name><use>render-bin/bin-name</use></bin-name> <filter>
</render-bin> <use>texture[0]/filter</use>
<texture-unit> </filter>
<unit>0</unit> <wrap-s>
<type>noise</type> <use>texture[0]/wrap-s</use>
</texture-unit> </wrap-s>
<texture-unit> <wrap-t>
<unit>1</unit> <use>texture[0]/wrap-t</use>
<image><use>texture[0]/image</use></image> </wrap-t>
<filter><use>texture[0]/filter</use></filter> <internal-format>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s> <use>texture[0]/internal-format</use>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t> </internal-format>
<internal-format> </texture-unit>
<use>texture[0]/internal-format</use> <texture-unit>
</internal-format> <unit>2</unit>
</texture-unit> <image>
<texture-unit> <use>texture[2]/image</use>
<unit>2</unit> </image>
<image><use>texture[2]/image</use></image> <filter>
<filter><use>texture[2]/filter</use></filter> <use>texture[2]/filter</use>
<wrap-s><use>texture[2]/wrap-s</use></wrap-s> </filter>
<wrap-t><use>texture[2]/wrap-t</use></wrap-t> <wrap-s>
<internal-format> <use>texture[2]/wrap-s</use>
<use>texture[2]/internal-format</use> </wrap-s>
</internal-format> <wrap-t>
</texture-unit> <use>texture[2]/wrap-t</use>
<program> </wrap-t>
<vertex-shader>Shaders/landmass.vert</vertex-shader> <internal-format>
<fragment-shader>Shaders/landmass.frag</fragment-shader> <use>texture[2]/internal-format</use>
<attribute> </internal-format>
<name>tangent</name> </texture-unit>
<index>6</index> <program>
</attribute> <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<attribute> <vertex-shader n="1">Shaders/landmass-g.vert</vertex-shader>
<name>binormal</name> <geometry-shader>Shaders/landmass.geom</geometry-shader>
<index>7</index> <fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
</attribute> <fragment-shader n="1">Shaders/landmass.frag</fragment-shader>
</program> <geometry-vertices-out type="int">18</geometry-vertices-out>
<uniform> <geometry-input-type>triangles</geometry-input-type>
<name>NoiseTex</name> <geometry-output-type>triangle-strip</geometry-output-type>
<type>sampler-3d</type> <attribute>
<value type="int">0</value> <name>tangent</name>
</uniform> <index>6</index>
<uniform> </attribute>
<name>BaseTex</name> <attribute>
<type>sampler-2d</type> <name>binormal</name>
<value type="int">1</value> <index>7</index>
</uniform> </attribute>
<uniform> </program>
<name>NormalTex</name> <uniform>
<type>sampler-2d</type> <name>NoiseTex</name>
<value type="int">2</value> <type>sampler-3d</type>
</uniform> <value type="int">0</value>
<uniform> </uniform>
<name>depth_factor</name> <uniform>
<type>float</type> <name>BaseTex</name>
<value><use>depth-factor</use></value> <type>sampler-2d</type>
</uniform> <value type="int">1</value>
<uniform> </uniform>
<name>snowlevel</name> <uniform>
<type>float</type> <name>NormalTex</name>
<value><use>snow-level</use></value> <type>sampler-2d</type>
</uniform> <value type="int">2</value>
<uniform> </uniform>
<name>quality_level</name> <uniform>
<type>float</type> <name>depth_factor</name>
<value><use>quality-level</use></value> <type>float</type>
</uniform> <value>
</pass> <use>depth-factor</use>
</technique> </value>
</uniform>
<uniform>
<name>snowlevel</name>
<type>float</type>
<value>
<use>snow-level</use>
</value>
</uniform>
<uniform>
<name>canopy_height</name>
<type>float</type>
<value>
<use>canopy-height</use>
</value>
</uniform>
<uniform>
<name>quality_level</name>
<type>float</type>
<value>
<use>quality-level</use>
</value>
</uniform>
<depth>
<function>lequal</function>
<write-mask type="bool">false</write-mask>
</depth>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
</pass>
</technique>
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/shaders/landmass</property>
<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>
</and>
</predicate>
<pass>
<lighting>true</lighting>
<material>
<ambient>
<use>material/ambient</use>
</ambient>
<diffuse>
<use>material/diffuse</use>
</diffuse>
<specular>
<use>material/specular</use>
</specular>
<color-mode>ambient-and-diffuse</color-mode>
</material>
<blend>
<use>transparent</use>
</blend>
<alpha-test>
<use>transparent</use>
</alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number>
<use>render-bin/bin-number</use>
</bin-number>
<bin-name>
<use>render-bin/bin-name</use>
</bin-name>
</render-bin>
<texture-unit>
<unit>0</unit>
<type>noise</type>
</texture-unit>
<texture-unit>
<unit>1</unit>
<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>
<internal-format>
<use>texture[0]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>2</unit>
<image>
<use>texture[2]/image</use>
</image>
<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>
<program>
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<vertex-shader n="1">Shaders/landmass.vert</vertex-shader>
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/landmass.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>
</attribute>
<attribute>
<name>binormal</name>
<index>7</index>
</attribute>
</program>
<uniform>
<name>NoiseTex</name>
<type>sampler-3d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>BaseTex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>NormalTex</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>depth_factor</name>
<type>float</type>
<value>
<use>depth-factor</use>
</value>
</uniform>
<uniform>
<name>snowlevel</name>
<type>float</type>
<value>
<use>snow-level</use>
</value>
</uniform>
<uniform>
<name>quality_level</name>
<type>float</type>
<value>
<use>quality-level</use>
</value>
</uniform>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
</pass>
</technique>
</PropertyList> </PropertyList>

654
Effects/model-combined.eff Normal file
View file

@ -0,0 +1,654 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Reflections + Bumpmapping + specular + Lightmap
please see Docs/README.model-combined.eff for documentation
-->
<PropertyList>
<name>Effects/model-combined</name>
<inherits-from>Effects/model-default</inherits-from>
<parameters>
<!-- Diffuse Texture -->
<texture n ="0">
<type>white</type>
</texture>
<!-- Normal Map -->
<normalmap_enabled type="int">0</normalmap_enabled>
<normalmap_dds type="int">0</normalmap_dds>
<texture n="2">
<image>Aircraft/Generic/Effects/null_bumpspec.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<!-- Light Map -->
<lightmap_enabled type="int">0</lightmap_enabled>
<lightmap_multi type="int">0</lightmap_multi>
<lightmap_factor type="float" n="0">1.0</lightmap_factor>
<lightmap_color type="vec3d" n="0"> 1.0 1.0 1.0 </lightmap_color>
<lightmap_factor type="float" n="1">1.0</lightmap_factor>
<lightmap_color type="vec3d" n="1"> 1.0 1.0 1.0 </lightmap_color>
<lightmap_factor type="float" n="2">1.0</lightmap_factor>
<lightmap_color type="vec3d" n="2"> 1.0 1.0 1.0 </lightmap_color>
<lightmap_factor type="float" n="3">1.0</lightmap_factor>
<lightmap_color type="vec3d" n="3"> 1.0 1.0 1.0 </lightmap_color>
<texture n="3">
<image>Aircraft/Generic/Effects/greymap.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<!-- Reflection -->
<reflection_enabled type="int">0</reflection_enabled>
<reflection_correction type="float">0.0</reflection_correction>
<reflect_map_enabled type="int">0</reflect_map_enabled>
<reflection_dynamic type="int">0</reflection_dynamic>
<texture n="4">
<image>Aircraft/Generic/Effects/ReflectMaps/reflectmap.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<!-- Reflection environment -->
<texture n="5">
<type>cubemap</type>
<!-- use this form for a cube cross -->
<!--<image>Aircraft/Generic/Effects/CubeCrosses/blue_sky_big.jpg</image>-->
<!-- END CubeCross -->
<!-- use this form for a 6 image cube map -->
<images>
<positive-x>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_px.png</positive-x>
<negative-x>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nx.png</negative-x>
<positive-y>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_py.png</positive-y>
<negative-y>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_ny.png</negative-y>
<positive-z>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_pz.png</positive-z>
<negative-z>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nz.png</negative-z>
</images>
<!-- END 6 image cube map -->
</texture>
<!-- Reflection fresnel -->
<reflection_fresnel type="float">0.1</reflection_fresnel>
<texture n="6">
<image>Aircraft/Generic/Effects/FresnelLookUp.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<!-- Reflection rainbow -->
<reflection_rainbow type="float">0.01</reflection_rainbow>
<texture n="7">
<image>Aircraft/Generic/Effects/Rainbow.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<reflection_noise type="float">0.25</reflection_noise>
<!-- END Reflection -->
<!-- ambient correction -->
<ambient_correction type="float">0.05</ambient_correction>
<!-- quality slider -->
<shader_quality type="int">2</shader_quality>
<!--<use>/sim/rendering/shaders/model/quality</use>
</shader_quality>-->
<vertex-program-two-side type="bool">false</vertex-program-two-side>
<cull-face>back</cull-face>
<!-- INTERNAL USE -->
<rendering-hint>transparent</rendering-hint>
<shade-model>smooth</shade-model>
<model_hdg>
<use>orientation/model/heading-deg</use>
</model_hdg>
<model_pitch>
<use>orientation/model/pitch-deg</use>
</model_pitch>
<model_roll>
<use>orientation/model/roll-deg</use>
</model_roll>
<!-- fog include -->
<visibility>
<use>/environment/ground-visibility-m</use>
</visibility>
<avisibility>
<use>/environment/visibility-m</use>
</avisibility>
<lthickness>
<use>/environment/ground-haze-thickness-m</use>
</lthickness>
<scattering>
<use>/rendering/scene/scattering</use>
</scattering>
<terminator>
<use>/environment/terminator-relative-position-m</use>
</terminator>
<fogtype>
<use>/sim/rendering/scattering-shader</use>
</fogtype>
<!-- END fog include -->
</parameters>
<!--<generate>
<tangent type="int">6</tangent>
<binormal type="int">7</binormal>
</generate>-->
<technique n="10">
<predicate>
<and>
<property>/sim/rendering/shaders/model</property>
<property>/sim/rendering/shaders/quality-level</property>
<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>
</and>
</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>
<active>
<use>blend/active</use>
</active>
<source>
<use>blend/source</use>
</source>
<destination>
<use>blend/destination</use>
</destination>
</blend>
<shade-model>
<use>shade-model</use>
</shade-model>
<vertex-program-two-side>
<use>vertex-program-two-side</use>
</vertex-program-two-side>
<cull-face>
<use>cull-face</use>
</cull-face>
<rendering-hint>
<use>rendering-hint</use>
</rendering-hint>
<!-- Diffuse texture unit-->
<texture-unit>
<unit>0</unit>
<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>
<internal-format>
<use>texture[0]/internal-format</use>
</internal-format>
</texture-unit>
<!-- NormalMap texture unit-->
<texture-unit>
<unit>2</unit>
<image>
<use>texture[2]/image</use>
</image>
<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>
<!-- LightMap texture unit-->
<texture-unit>
<unit>3</unit>
<image>
<use>texture[3]/image</use>
</image>
<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>
<!-- ReflectMap texture unit-->
<texture-unit>
<unit>4</unit>
<image>
<use>texture[4]/image</use>
</image>
<filter>
<use>texture[4]/filter</use>
</filter>
<wrap-s>
<use>texture[4]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[4]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[4]/internal-format</use>
</internal-format>
</texture-unit>
<!-- Reflection CubeMap texture unit-->
<texture-unit>
<unit>5</unit>
<type>
<use>texture[5]/type</use>
</type>
<!-- use this form for a cube cross -->
<!--<image><use>texture[5]/image</use></image>-->
<!-- END CubeCross -->
<!-- use this form for a 6 image cube map -->
<images>
<use>texture[5]/images</use>
</images>
<!-- END 6 image cube map -->
</texture-unit>
<!-- Reflection fresnel texture unit-->
<texture-unit>
<unit>6</unit>
<image>
<use>texture[6]/image</use>
</image>
<filter>
<use>texture[6]/filter</use>
</filter>
<wrap-s>
<use>texture[6]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[6]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[6]/internal-format</use>
</internal-format>
</texture-unit>
<!-- Reflection rainbow texture unit-->
<texture-unit>
<unit>7</unit>
<image>
<use>texture[7]/image</use>
</image>
<filter>
<use>texture[7]/filter</use>
</filter>
<wrap-s>
<use>texture[7]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[7]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[7]/internal-format</use>
</internal-format>
</texture-unit>
<!-- Reflection Noise texture unit-->
<texture-unit>
<unit>9</unit>
<type>noise</type>
</texture-unit>
<program>
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<vertex-shader n="1">Shaders/ubershader.vert</vertex-shader>
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/ubershader.frag</fragment-shader>
<!--<attribute>
<name>tangent</name>
<index>6</index>
</attribute>
<attribute>
<name>binormal</name>
<index>7</index>
</attribute>-->
</program>
<uniform>
<name>BaseTex</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>NormalTex</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>LightMapTex</name>
<type>sampler-2d</type>
<value type="int">3</value>
</uniform>
<uniform>
<name>ReflMapTex</name>
<type>sampler-2d</type>
<value type="int">4</value>
</uniform>
<uniform>
<name>Environment</name>
<type>sampler-cube</type>
<value type="int">5</value>
</uniform>
<uniform>
<name>ReflFresnelTex</name>
<type>sampler-2d</type>
<value type="int">6</value>
</uniform>
<uniform>
<name>ReflRainbowTex</name>
<type>sampler-2d</type>
<value type="int">7</value>
</uniform>
<uniform>
<name>ReflNoiseTex</name>
<type>sampler-3d</type>
<value type="int">9</value>
</uniform>
<!-- NORMAL MAP -->
<!-- normalmap is used-->
<uniform>
<name>nmap_enabled</name>
<type>int</type>
<value>
<use>normalmap_enabled</use>
</value>
</uniform>
<!-- normalmap is .dds-->
<uniform>
<name>nmap_dds</name>
<type>int</type>
<value>
<use>normalmap_dds</use>
</value>
</uniform>
<!-- LIGHTMAP -->
<!-- lightmap is used -->
<uniform>
<name>lightmap_enabled</name>
<type>int</type>
<value>
<use>lightmap_enabled</use>
</value>
</uniform>
<!-- lightmap is multichannel -->
<uniform>
<name>lightmap_multi</name>
<type>int</type>
<value>
<use>lightmap_multi</use>
</value>
</uniform>
<uniform>
<name>lightmap_r_factor</name>
<type>float</type>
<value>
<use>lightmap_factor[0]</use>
</value>
</uniform>
<uniform>
<name>lightmap_r_color</name>
<type>float-vec3</type>
<value>
<use>lightmap_color[0]</use>
</value>
</uniform>
<uniform>
<name>lightmap_g_factor</name>
<type>float</type>
<value>
<use>lightmap_factor[1]</use>
</value>
</uniform>
<uniform>
<name>lightmap_g_color</name>
<type>float-vec3</type>
<value>
<use>lightmap_color[1]</use>
</value>
</uniform>
<uniform>
<name>lightmap_b_factor</name>
<type>float</type>
<value>
<use>lightmap_factor[2]</use>
</value>
</uniform>
<uniform>
<name>lightmap_b_color</name>
<type>float-vec3</type>
<value>
<use>lightmap_color[2]</use>
</value>
</uniform>
<uniform>
<name>lightmap_a_factor</name>
<type>float</type>
<value>
<use>lightmap_factor[3]</use>
</value>
</uniform>
<uniform>
<name>lightmap_a_color</name>
<type>float-vec3</type>
<value>
<use>lightmap_color[3]</use>
</value>
</uniform>
<!-- reflection is used -->
<uniform>
<name>refl_enabled</name>
<type>int</type>
<value>
<use>reflection_enabled</use>
</value>
</uniform>
<!-- reflection correction -->
<uniform>
<name>refl_correction</name>
<type>float</type>
<value>
<use>reflection_correction</use>
</value>
</uniform>
<!-- use a reflection map-->
<uniform>
<name>refl_map</name>
<type>int</type>
<value>
<use>reflect_map_enabled</use>
</value>
</uniform>
<!-- reflection is dynamic -->
<uniform>
<name>refl_dynamic</name>
<type>int</type>
<value>
<use>reflection_dynamic</use>
</value>
</uniform>
<!-- set the amount of fringing colour 0.0 - 1.0 -->
<uniform>
<name>refl_rainbow</name>
<type>float</type>
<value>
<use>reflection_rainbow</use>
</value>
</uniform>
<!-- set the amount of fresnel effect colour 0.0 - 1.0 -->
<uniform>
<name>refl_fresnel</name>
<type>float</type>
<value>
<use>reflection_fresnel</use>
</value>
</uniform>
<!-- set the amount of noisiness 0.0 - 1.0 -->
<uniform>
<name>refl_noise</name>
<type>float</type>
<value>
<use>reflection_noise</use>
</value>
</uniform>
<!-- set the amount of ambient light correction 0.0 - 1.0 -->
<uniform>
<name>amb_correction</name>
<type>float</type>
<value>
<use>ambient_correction</use>
</value>
</uniform>
<!-- shader quality -->
<uniform>
<name>shader_qual</name>
<type>int</type>
<value>
<use>shader_quality</use>
</value>
</uniform>
<uniform>
<name>hdg</name>
<type>float</type>
<value>
<use>model_hdg</use>
</value>
</uniform>
<uniform>
<name>pitch</name>
<type>float</type>
<value>
<use>model_pitch</use>
</value>
</uniform>
<uniform>
<name>roll</name>
<type>float</type>
<value>
<use>model_roll</use>
</value>
</uniform>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
</pass>
</technique>
</PropertyList>

View file

@ -1,128 +1,272 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PropertyList> <PropertyList>
<name>Effects/model-default</name> <name>Effects/model-default</name>
<parameters> <!-- <inherits-from>Effects/shadow</inherits-from> -->
<texture n ="0"> <parameters>
<type>white</type> <texture n ="0">
</texture> <type>white</type>
<vertex-program-two-side type="bool">false</vertex-program-two-side> </texture>
<material> <vertex-program-two-side type="bool">false</vertex-program-two-side>
<color-mode-uniform>1</color-mode-uniform> <!-- DIFFUSE --> <material>
</material> <color-mode-uniform>1</color-mode-uniform>
</parameters> <!-- DIFFUSE -->
<technique n="10"> </material>
<predicate> <!-- BEGIN fog include -->
<and> <visibility>
<property>/sim/rendering/shader-effects</property> <use>/environment/ground-visibility-m</use>
<or> </visibility>
<less-equal> <avisibility>
<value type="float">2.0</value> <use>/environment/visibility-m</use>
<glversion/> </avisibility>
</less-equal> <lthickness>
<and> <use>/environment/ground-haze-thickness-m</use>
<extension-supported>GL_ARB_shader_objects</extension-supported> </lthickness>
<extension-supported>GL_ARB_shading_language_100</extension-supported> <scattering>
<extension-supported>GL_ARB_vertex_shader</extension-supported> <use>/rendering/scene/scattering</use>
<extension-supported>GL_ARB_fragment_shader</extension-supported> </scattering>
</and> <terminator>
</or> <use>/environment/terminator-relative-position-m</use>
</and> </terminator>
</predicate> <fogtype>
<pass> <use>/sim/rendering/scattering-shader</use>
<lighting>true</lighting> </fogtype>
<material> <!-- END fog include -->
<active><use>material/active</use></active> </parameters>
<ambient><use>material/ambient</use></ambient> <technique n="10">
<diffuse><use>material/diffuse</use></diffuse> <predicate>
<specular><use>material/specular</use></specular> <and>
<emissive><use>material/emissive</use></emissive> <property>/sim/rendering/shader-effects</property>
<shininess><use>material/shininess</use></shininess> <or>
<color-mode><use>material/color-mode</use></color-mode> <less-equal>
</material> <value type="float">2.0</value>
<blend> <glversion/>
<active><use>blend/active</use></active> </less-equal>
<source><use>blend/source</use></source> <and>
<destination><use>blend/destination</use></destination> <extension-supported>GL_ARB_shader_objects</extension-supported>
</blend> <extension-supported>GL_ARB_shading_language_100</extension-supported>
<shade-model><use>shade-model</use></shade-model> <extension-supported>GL_ARB_vertex_shader</extension-supported>
<cull-face><use>cull-face</use></cull-face> <extension-supported>GL_ARB_fragment_shader</extension-supported>
<rendering-hint><use>rendering-hint</use></rendering-hint> </and>
<texture-unit> </or>
<!-- The texture unit is always active because the shaders expect </and>
</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>
<active>
<use>blend/active</use>
</active>
<source>
<use>blend/source</use>
</source>
<destination>
<use>blend/destination</use>
</destination>
</blend>
<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>
<!-- The texture unit is always active because the shaders expect
that. --> that. -->
<unit>0</unit> <unit>0</unit>
<!-- If there is a texture, the type in the derived effect <!-- If there is a texture, the type in the derived effect
will be "2d". --> will be "2d". -->
<type><use>texture[0]/type</use></type> <type>
<image><use>texture[0]/image</use></image> <use>texture[0]/type</use>
<filter><use>texture[0]/filter</use></filter> </type>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s> <image>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t> <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>
<!--
<internal-format> <internal-format>
<use>texture[0]/internal-format</use> <use>texture[0]/internal-format</use>
</internal-format> </internal-format>
--> -->
</texture-unit> </texture-unit>
<vertex-program-two-side> <vertex-program-two-side>
<use>vertex-program-two-side</use> <use>vertex-program-two-side</use>
</vertex-program-two-side> </vertex-program-two-side>
<program> <program>
<vertex-shader>Shaders/default.vert</vertex-shader> <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<fragment-shader>Shaders/default.frag</fragment-shader> <!--fog include-->
</program> <vertex-shader n="1">Shaders/default.vert</vertex-shader>
<uniform> <fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<name>texture</name> <!--fog include-->
<type>sampler-2d</type> <fragment-shader n="1">Shaders/default.frag</fragment-shader>
<value type="int">0</value> </program>
</uniform> <!-- BEGIN fog include -->
<uniform> <uniform>
<name>colorMode</name> <name>visibility</name>
<type>int</type> <type>float</type>
<value><use>material/color-mode-uniform</use></value> <value>
</uniform> <use>visibility</use>
</pass> </value>
</technique> </uniform>
<technique n="11"> <uniform>
<pass> <name>avisibility</name>
<lighting>true</lighting> <type>float</type>
<material> <value>
<active><use>material/active</use></active> <use>avisibility</use>
<ambient><use>material/ambient</use></ambient> </value>
<diffuse><use>material/diffuse</use></diffuse> </uniform>
<specular><use>material/specular</use></specular> <uniform>
<emissive><use>material/emissive</use></emissive> <name>hazeLayerAltitude</name>
<shininess><use>material/shininess</use></shininess> <type>float</type>
<color-mode><use>material/color-mode</use></color-mode> <value>
</material> <use>lthickness</use>
<blend> </value>
<active><use>blend/active</use></active> </uniform>
<source><use>blend/source</use></source> <uniform>
<destination><use>blend/destination</use></destination> <name>scattering</name>
</blend> <type>float</type>
<shade-model><use>shade-model</use></shade-model> <value>
<cull-face><use>cull-face</use></cull-face> <use>scattering</use>
<rendering-hint><use>rendering-hint</use></rendering-hint> </value>
<texture-unit> </uniform>
<active><use>texture[0]/active</use></active> <uniform>
<unit>0</unit> <name>terminator</name>
<image><use>texture[0]/image</use></image> <type>float</type>
<filter><use>texture[0]/filter</use></filter> <value>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s> <use>terminator</use>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t> </value>
<!-- </uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
<uniform>
<name>texture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>colorMode</name>
<type>int</type>
<value>
<use>material/color-mode-uniform</use>
</value>
</uniform>
</pass>
</technique>
<technique n="11">
<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>
<active>
<use>blend/active</use>
</active>
<source>
<use>blend/source</use>
</source>
<destination>
<use>blend/destination</use>
</destination>
</blend>
<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>
<active>
<use>texture[0]/active</use>
</active>
<unit>0</unit>
<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>
<!--
<internal-format> <internal-format>
<use>texture[0]/internal-format</use> <use>texture[0]/internal-format</use>
</internal-format> </internal-format>
--> -->
<environment> <environment>
<mode>modulate</mode> <mode>modulate</mode>
</environment> </environment>
</texture-unit> </texture-unit>
<!-- A two-sided lighting model is set by default near the root <!-- A two-sided lighting model is set by default near the root
of the scene graph. Perhaps that ought to be set in this of the scene graph. Perhaps that ought to be set in this
effect? effect?
--> -->
</pass> </pass>
</technique> </technique>
</PropertyList> </PropertyList>

View file

@ -1,21 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PropertyList> <PropertyList>
<name>Effects/runway</name> <name>Effects/runway</name>
<inherits-from>Effects/terrain-default</inherits-from> <inherits-from>Effects/terrain-default</inherits-from>
<parameters> <parameters>
<texture n="4"> <texture n="4">
<image>Textures.high/Runway/rwy-normalmap.dds</image> <image>Textures.high/Runway/rwy-normalmap.dds</image>
<filter>linear-mipmap-linear</filter> <filter>linear-mipmap-linear</filter>
<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="5"> <texture n="5">
<type>cubemap</type> <type>cubemap</type>
<!-- use this form for a cube cross --> <!-- use this form for a cube cross -->
<!--<image>Aircraft/Generic/Effects/CubeCrosses/blue_sky_big.jpg</image>--> <!--<image>Aircraft/Generic/Effects/CubeCrosses/blue_sky_big.jpg</image>-->
<!-- use this form for a 6 image cube map --> <!-- use this form for a 6 image cube map -->
<images> <images>
<positive-x>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_px.png</positive-x> <positive-x>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_px.png</positive-x>
<negative-x>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nx.png</negative-x> <negative-x>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nx.png</negative-x>
@ -25,41 +25,43 @@
<negative-z>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nz.png</negative-z> <negative-z>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nz.png</negative-z>
</images> </images>
</texture> </texture>
<texture n="6"> <texture n="6">
<image>Aircraft/Generic/Effects/Rainbow.png</image> <image>Aircraft/Generic/Effects/Rainbow.png</image>
<filter>linear-mipmap-linear</filter> <filter>linear-mipmap-linear</filter>
<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="7"> <texture n="7">
<image>Aircraft/Generic/Effects/FresnelLookUp.png</image> <image>Aircraft/Generic/Effects/FresnelLookUp.png</image>
<filter>linear-mipmap-linear</filter> <filter>linear-mipmap-linear</filter>
<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="8"> <texture n="8">
<image>Textures.high/Runway/rwy-reflect.png</image> <image>Textures.high/Runway/rwy-reflect.png</image>
<filter>linear-mipmap-linear</filter> <filter>linear-mipmap-linear</filter>
<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>
<rendering-hint>transparent</rendering-hint> <rendering-hint>transparent</rendering-hint>
<shade-model>smooth</shade-model> <shade-model>smooth</shade-model>
<rainbowiness type="float">0.01</rainbowiness> <rainbowiness type="float">0.01</rainbowiness>
<fresneliness>0.01</fresneliness> <fresneliness>0.01</fresneliness>
<noisiness>0.01</noisiness> <noisiness>0.01</noisiness>
<!-- <refl_correction>0.0</refl_correction> --> <!-- <refl_correction>0.0</refl_correction> -->
<ambient_correction>0.01</ambient_correction> <ambient_correction>0.01</ambient_correction>
<reflect_map>1</reflect_map> <reflect_map>1</reflect_map>
<normalmap_dds>1</normalmap_dds> <normalmap_dds>1</normalmap_dds>
<vertex-program-two-side type="bool">false</vertex-program-two-side> <vertex-program-two-side type="bool">false</vertex-program-two-side>
<cull-face>back</cull-face>
<wetness> <wetness>
<use>/environment/rain-norm</use> <use>/environment/rain-norm</use>
</wetness> </wetness>
<!-- BEGIN fog include --> <!-- BEGIN fog include -->
<visibility> <visibility>
<use>/environment/ground-visibility-m</use> <use>/environment/ground-visibility-m</use>
@ -80,38 +82,48 @@
<use>/sim/rendering/scattering-shader</use> <use>/sim/rendering/scattering-shader</use>
</fogtype> </fogtype>
<!-- END fog include --> <!-- END fog include -->
</parameters> </parameters>
<generate> <generate>
<tangent type="int">6</tangent> <tangent type="int">6</tangent>
<binormal type="int">7</binormal> <binormal type="int">7</binormal>
</generate> </generate>
<technique n="9"> <technique n="9">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/shader-effects</property> <property>/sim/rendering/shader-effects</property>
<or> <or>
<less-equal> <less-equal>
<value type="float">2.0</value> <value type="float">2.0</value>
<glversion/> <glversion/>
</less-equal> </less-equal>
<and> <and>
<extension-supported>GL_ARB_shader_objects</extension-supported> <extension-supported>GL_ARB_shader_objects</extension-supported>
<extension-supported>GL_ARB_shading_language_100</extension-supported> <extension-supported>GL_ARB_shading_language_100</extension-supported>
<extension-supported>GL_ARB_vertex_shader</extension-supported> <extension-supported>GL_ARB_vertex_shader</extension-supported>
<extension-supported>GL_ARB_fragment_shader</extension-supported> <extension-supported>GL_ARB_fragment_shader</extension-supported>
</and> </and>
</or> </or>
</and> </and>
</predicate> </predicate>
<pass> <pass>
<texture-unit> <texture-unit>
<unit>0</unit> <unit>0</unit>
<image><use>texture[0]/image</use></image> <image>
<filter><use>texture[0]/filter</use></filter> <use>texture[0]/image</use>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s> </image>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t> <filter>
<internal-format><use>texture[1]/internal-format</use></internal-format> <use>texture[0]/filter</use>
</texture-unit> </filter>
<wrap-s>
<use>texture[0]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[0]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[1]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit> <texture-unit>
<unit>4</unit> <unit>4</unit>
<image> <image>
@ -209,23 +221,27 @@
<unit>9</unit> <unit>9</unit>
<type>noise</type> <type>noise</type>
</texture-unit> </texture-unit>
<vertex-program-two-side> <vertex-program-two-side>
<use>vertex-program-two-side</use> <use>vertex-program-two-side</use>
</vertex-program-two-side> </vertex-program-two-side>
<program> <cull-face>
<use>cull-face</use>
</cull-face>
<program>
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<vertex-shader n="1">Shaders/reflect-bump-spec.vert</vertex-shader> <vertex-shader n="1">Shaders/reflect-bump-spec.vert</vertex-shader>
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader> <fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/runway-reflect-bump-spec.frag</fragment-shader> <fragment-shader n="1">Shaders/runway-reflect-bump-spec.frag</fragment-shader>
<attribute> <attribute>
<name>tangent</name> <name>tangent</name>
<index>6</index> <index>6</index>
</attribute> </attribute>
<attribute> <attribute>
<name>binormal</name> <name>binormal</name>
<index>7</index> <index>7</index>
</attribute> </attribute>
</program> </program>
<uniform> <uniform>
<name>BaseTex</name> <name>BaseTex</name>
@ -299,83 +315,83 @@
<!-- The reflection is set proportional to the shininess of the material. <!-- The reflection is set proportional to the shininess of the material.
The amount of reflection may be adjusted by the use of this correction The amount of reflection may be adjusted by the use of this correction
-1.0 (fully transparent)- 1.0 (fully opaque) --> -1.0 (fully transparent)- 1.0 (fully opaque) -->
<uniform> <uniform>
<name>spec_adjust</name> <name>spec_adjust</name>
<type>float</type> <type>float</type>
<value> <value>
<use>wetness</use> <use>wetness</use>
</value> </value>
</uniform> </uniform>
<!-- set the amount of ambient light correction 0.0 - 1.0 --> <!-- set the amount of ambient light correction 0.0 - 1.0 -->
<uniform> <uniform>
<name>ambient_correction</name> <name>ambient_correction</name>
<type>float</type> <type>float</type>
<value> <value>
<use>ambient_correction</use> <use>ambient_correction</use>
</value> </value>
</uniform> </uniform>
<!-- use a reflection map--> <!-- use a reflection map-->
<uniform> <uniform>
<name>reflect_map</name> <name>reflect_map</name>
<type>float</type> <type>float</type>
<value> <value>
<use>reflect_map</use> <use>reflect_map</use>
</value> </value>
</uniform> </uniform>
<!-- normalmap is .dds--> <!-- normalmap is .dds-->
<uniform> <uniform>
<name>normalmap_dds</name> <name>normalmap_dds</name>
<type>float</type> <type>float</type>
<value> <value>
<use>normalmap_dds</use> <use>normalmap_dds</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>visibility</name> <name>visibility</name>
<type>float</type> <type>float</type>
<value> <value>
<use>visibility</use> <use>visibility</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>avisibility</name> <name>avisibility</name>
<type>float</type> <type>float</type>
<value> <value>
<use>avisibility</use> <use>avisibility</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>hazeLayerAltitude</name> <name>hazeLayerAltitude</name>
<type>float</type> <type>float</type>
<value> <value>
<use>lthickness</use> <use>lthickness</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>scattering</name> <name>scattering</name>
<type>float</type> <type>float</type>
<value> <value>
<use>scattering</use> <use>scattering</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>terminator</name> <name>terminator</name>
<type>float</type> <type>float</type>
<value> <value>
<use>terminator</use> <use>terminator</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>fogType</name> <name>fogType</name>
<type>int</type> <type>int</type>
<value> <value>
<use>fogtype</use> <use>fogtype</use>
</value> </value>
</uniform> </uniform>
</pass> </pass>
</technique> </technique>
</PropertyList> </PropertyList>

View file

@ -1,64 +1,146 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PropertyList> <PropertyList>
<name>Effects/skydome</name> <name>Effects/skydome</name>
<parameters> <parameters>
<mie><use>/sim/rendering/mie</use></mie> <mie>
<rayleigh><use>/sim/rendering/rayleigh</use></rayleigh> <use>/sim/rendering/mie</use>
<density><use>/sim/rendering/dome-density</use></density> </mie>
</parameters> <rayleigh>
<technique n="8"> <use>/sim/rendering/rayleigh</use>
<predicate> </rayleigh>
<and> <density>
<property>/sim/rendering/shader-effects</property> <use>/sim/rendering/dome-density</use>
<property>/sim/rendering/scattering-shader</property> </density>
<or> <overcast>
<less-equal> <use>/rendering/scene/overcast</use>
<value type="float">2.0</value> </overcast>
<glversion/> <saturation>
</less-equal> <use>/rendering/scene/saturation</use>
<and> </saturation>
<extension-supported>GL_ARB_shader_objects</extension-supported> <scattering>
<extension-supported>GL_ARB_shading_language_100</extension-supported> <use>/rendering/scene/scattering</use>
<extension-supported>GL_ARB_vertex_shader</extension-supported> </scattering>
<extension-supported>GL_ARB_fragment_shader</extension-supported> <visibility>
</and> <use>/environment/ground-visibility-m</use>
</or> </visibility>
</and> <avisibility>
</predicate> <use>/environment/visibility-m</use>
</avisibility>
<pass> <lthickness>
<lighting>true</lighting> <use>/environment/ground-haze-thickness-m</use>
<shade-model>smooth</shade-model> </lthickness>
<cull-face>back</cull-face> <terminator>
<program> <use>/environment/terminator-relative-position-m</use>
<vertex-shader>Shaders/skydome.vert</vertex-shader> </terminator>
<fragment-shader>Shaders/skydome.frag</fragment-shader> </parameters>
</program> <technique n="8">
<uniform> <predicate>
<name>mK</name> <and>
<type>float</type> <property>/sim/rendering/shaders/quality-level</property>
<value><use>mie</use></value> <property>/sim/rendering/shaders/skydome</property>
</uniform> <or>
<uniform> <less-equal>
<name>rK</name> <value type="float">2.0</value>
<type>float</type> <glversion/>
<value><use>rayleigh</use></value> </less-equal>
</uniform> <and>
<uniform> <extension-supported>GL_ARB_shader_objects</extension-supported>
<name>density</name> <extension-supported>GL_ARB_shading_language_100</extension-supported>
<type>float</type> <extension-supported>GL_ARB_vertex_shader</extension-supported>
<value><use>density</use></value> <extension-supported>GL_ARB_fragment_shader</extension-supported>
</uniform> </and>
</pass> </or>
</technique> </and>
</predicate>
<!-- fall back without shaders -->
<technique n="11"> <pass>
<pass> <lighting>true</lighting>
<lighting>false</lighting> <shade-model>smooth</shade-model>
<shade-model>smooth</shade-model> <cull-face>back</cull-face>
<cull-face>back</cull-face> <program>
</pass> <vertex-shader>Shaders/skydome.vert</vertex-shader>
</technique> <fragment-shader>Shaders/skydome.frag</fragment-shader>
</program>
</PropertyList> <uniform>
<name>mK</name>
<type>float</type>
<value>
<use>mie</use>
</value>
</uniform>
<uniform>
<name>rK</name>
<type>float</type>
<value>
<use>rayleigh</use>
</value>
</uniform>
<uniform>
<name>density</name>
<type>float</type>
<value>
<use>density</use>
</value>
</uniform>
<uniform>
<name>overcast</name>
<type>float</type>
<value>
<use>overcast</use>
</value>
</uniform>
<uniform>
<name>saturation</name>
<type>float</type>
<value>
<use>saturation</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
</pass>
</technique>
<!-- fall back without shaders -->
<technique n="11">
<pass>
<lighting>false</lighting>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
</pass>
</technique>
</PropertyList>

View file

@ -1,180 +1,317 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PropertyList> <PropertyList>
<name>Effects/terrain-default</name> <name>Effects/terrain-default</name>
<!-- <inherits-from>another-effect</inherits-from> --> <!-- <inherits-from>another-effect</inherits-from> -->
<parameters> <parameters>
<material> <material>
<ambient type="vec4d"> <ambient type="vec4d">
0.2 .2 0.2 1.0 0.2 .2 0.2 1.0
</ambient> </ambient>
<diffuse type="vec4d"> <diffuse type="vec4d">
.8 .8 .8 1.0 .8 .8 .8 1.0
</diffuse> </diffuse>
<specular type="vec4d"> <specular type="vec4d">
0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0
</specular> </specular>
<emissive type="vec4d"> <emissive type="vec4d">
0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0
</emissive> </emissive>
<shininess>1.2</shininess> <shininess>1.2</shininess>
</material> </material>
<texture n="0"> <texture n="0">
<image>Textures/Terrain/unknown.png</image> <image>Textures/Terrain/unknown.png</image>
<filter>linear-mipmap-linear</filter> <filter>linear-mipmap-linear</filter>
<!-- also repeat --> <!-- also repeat -->
<wrap-s>repeat</wrap-s> <wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
<!-- <!--
<wrap-r>clamp-to-border</wrap-r> <wrap-r>clamp-to-border</wrap-r>
--> -->
<!-- float, signed-integer, integer --> <!-- float, signed-integer, integer -->
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<transparent>false</transparent> <transparent>false</transparent>
<render-bin> <render-bin>
<bin-number>0</bin-number> <bin-number>0</bin-number>
<bin-name>RenderBin</bin-name> <bin-name>RenderBin</bin-name>
</render-bin> </render-bin>
</parameters> <visibility>
<!-- put techniques at a "high" index to allow derived effects to <use>/environment/ground-visibility-m</use>
</visibility>
<avisibility>
<use>/environment/visibility-m</use>
</avisibility>
<lthickness>
<use>/environment/ground-haze-thickness-m</use>
</lthickness>
<scattering>
<use>/rendering/scene/scattering</use>
</scattering>
<terminator>
<use>/environment/terminator-relative-position-m</use>
</terminator>
<fogtype>
<use>/sim/rendering/scattering-shader</use>
</fogtype>
</parameters>
<!-- put techniques at a "high" index to allow derived effects to
insert their own techniques first. --> insert their own techniques first. -->
<technique n="10"> <technique n="10">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/shader-effects</property> <property>/sim/rendering/shader-effects</property>
<or> <or>
<less-equal> <less-equal>
<value type="float">2.0</value> <value type="float">2.0</value>
<glversion/> <glversion/>
</less-equal> </less-equal>
<and> <and>
<extension-supported>GL_ARB_shader_objects</extension-supported> <extension-supported>GL_ARB_shader_objects</extension-supported>
<extension-supported>GL_ARB_shading_language_100</extension-supported> <extension-supported>GL_ARB_shading_language_100</extension-supported>
<extension-supported>GL_ARB_vertex_shader</extension-supported> <extension-supported>GL_ARB_vertex_shader</extension-supported>
<extension-supported>GL_ARB_fragment_shader</extension-supported> <extension-supported>GL_ARB_fragment_shader</extension-supported>
</and> </and>
</or> </or>
</and> </and>
</predicate> </predicate>
<pass> <pass>
<lighting>true</lighting> <lighting>true</lighting>
<material> <material>
<ambient><use>material/ambient</use></ambient> <ambient>
<diffuse><use>material/diffuse</use></diffuse> <use>material/ambient</use>
<specular><use>material/specular</use></specular> </ambient>
<emissive><use>material/emissive</use></emissive> <diffuse>
<shininess><use>material/shininess</use></shininess> <use>material/diffuse</use>
<color-mode>ambient-and-diffuse</color-mode> </diffuse>
</material> <specular>
<alpha-test><use>transparent</use></alpha-test> <use>material/specular</use>
<shade-model>smooth</shade-model> </specular>
<cull-face>back</cull-face> <emissive>
<render-bin> <use>material/emissive</use>
<bin-number>-1</bin-number> </emissive>
<bin-name>RenderBin</bin-name> <shininess>
</render-bin> <use>material/shininess</use>
<texture-unit> </shininess>
<unit>0</unit> <color-mode>ambient-and-diffuse</color-mode>
<image><use>texture[0]/image</use></image> </material>
<filter><use>texture[0]/filter</use></filter> <alpha-test>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s> <use>transparent</use>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t> </alpha-test>
<internal-format> <shade-model>smooth</shade-model>
<use>texture[0]/internal-format</use> <cull-face>back</cull-face>
</internal-format> <render-bin>
</texture-unit> <bin-number>-1</bin-number>
<program> <bin-name>RenderBin</bin-name>
<vertex-shader>Shaders/default.vert</vertex-shader> </render-bin>
<fragment-shader>Shaders/terrain-nocolor.frag</fragment-shader> <texture-unit>
</program> <unit>0</unit>
<uniform> <image>
<name>texture</name> <use>texture[0]/image</use>
<type>sampler-2d</type> </image>
<value type="int">0</value> <filter>
</uniform> <use>texture[0]/filter</use>
<color-mask type="vec4d">0 0 0 0</color-mask> </filter>
</pass> <wrap-s>
<pass> <use>texture[0]/wrap-s</use>
<lighting>true</lighting> </wrap-s>
<material> <wrap-t>
<ambient><use>material/ambient</use></ambient> <use>texture[0]/wrap-t</use>
<diffuse><use>material/diffuse</use></diffuse> </wrap-t>
<specular><use>material/specular</use></specular> <internal-format>
<emissive><use>material/emissive</use></emissive> <use>texture[0]/internal-format</use>
<shininess><use>material/shininess</use></shininess> </internal-format>
<color-mode>ambient-and-diffuse</color-mode> </texture-unit>
</material> <program>
<blend><use>transparent</use></blend> <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<alpha-test><use>transparent</use></alpha-test> <vertex-shader n="1">Shaders/default.vert</vertex-shader>
<shade-model>smooth</shade-model> <vertex-shader n="0">Shaders/include_fog.frag</vertex-shader>
<cull-face>back</cull-face> <fragment-shader n="1">Shaders/terrain-nocolor.frag</fragment-shader>
<render-bin> </program>
<bin-number><use>render-bin/bin-number</use></bin-number> <uniform>
<bin-name><use>render-bin/bin-name</use></bin-name> <name>texture</name>
</render-bin> <type>sampler-2d</type>
<texture-unit> <value type="int">0</value>
<unit>0</unit> </uniform>
<image><use>texture[0]/image</use></image> <color-mask type="vec4d">0 0 0 0</color-mask>
<filter><use>texture[0]/filter</use></filter> </pass>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s> <pass>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t> <lighting>true</lighting>
<internal-format> <material>
<use>texture[0]/internal-format</use> <ambient>
</internal-format> <use>material/ambient</use>
</texture-unit> </ambient>
<program> <diffuse>
<vertex-shader>Shaders/default.vert</vertex-shader> <use>material/diffuse</use>
<fragment-shader>Shaders/default.frag</fragment-shader> </diffuse>
</program> <specular>
<uniform> <use>material/specular</use>
<name>texture</name> </specular>
<type>sampler-2d</type> <emissive>
<value type="int">0</value> <use>material/emissive</use>
</uniform> </emissive>
<uniform> <shininess>
<name>colorMode</name> <use>material/shininess</use>
<type>int</type> </shininess>
<value>2</value> <!-- AMBIENT_AND_DIFFUSE --> <color-mode>ambient-and-diffuse</color-mode>
</uniform> </material>
<depth> <blend>
<function>lequal</function> <use>transparent</use>
<write-mask type="bool">false</write-mask> </blend>
</depth> <alpha-test>
</pass> <use>transparent</use>
</technique> </alpha-test>
<technique n="11"> <shade-model>smooth</shade-model>
<pass> <cull-face>back</cull-face>
<lighting>true</lighting> <render-bin>
<material> <bin-number>
<ambient><use>material/ambient</use></ambient> <use>render-bin/bin-number</use>
<diffuse><use>material/diffuse</use></diffuse> </bin-number>
<specular><use>material/specular</use></specular> <bin-name>
<emissive><use>material/emissive</use></emissive> <use>render-bin/bin-name</use>
<shininess><use>material/shininess</use></shininess> </bin-name>
<color-mode>ambient-and-diffuse</color-mode> </render-bin>
</material> <texture-unit>
<blend><use>transparent</use></blend> <unit>0</unit>
<alpha-test><use>transparent</use></alpha-test> <image>
<shade-model>smooth</shade-model> <use>texture[0]/image</use>
<cull-face>back</cull-face> </image>
<render-bin> <filter>
<bin-number><use>render-bin/bin-number</use></bin-number> <use>texture[0]/filter</use>
<bin-name><use>render-bin/bin-name</use></bin-name> </filter>
</render-bin> <wrap-s>
<texture-unit> <use>texture[0]/wrap-s</use>
<unit>0</unit> </wrap-s>
<image><use>texture[0]/image</use></image> <wrap-t>
<filter><use>texture[0]/filter</use></filter> <use>texture[0]/wrap-t</use>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s> </wrap-t>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t> <internal-format>
<internal-format> <use>texture[0]/internal-format</use>
<use>texture[0]/internal-format</use> </internal-format>
</internal-format> </texture-unit>
<environment> <program>
<mode>modulate</mode> <vertex-shader>Shaders/include_fog.vert</vertex-shader>
</environment> <vertex-shader>Shaders/default.vert</vertex-shader>
</texture-unit> <fragment-shader>Shaders/default.frag</fragment-shader>
</pass> <fragment-shader>Shaders/include_fog.frag</fragment-shader>
</technique> </program>
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<uniform>
<name>texture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>colorMode</name>
<type>int</type>
<value>2</value>
<!-- AMBIENT_AND_DIFFUSE -->
</uniform>
<depth>
<function>lequal</function>
<write-mask type="bool">false</write-mask>
</depth>
</pass>
</technique>
<technique n="11">
<pass>
<lighting>true</lighting>
<material>
<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>ambient-and-diffuse</color-mode>
</material>
<blend>
<use>transparent</use>
</blend>
<alpha-test>
<use>transparent</use>
</alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number>
<use>render-bin/bin-number</use>
</bin-number>
<bin-name>
<use>render-bin/bin-name</use>
</bin-name>
</render-bin>
<texture-unit>
<unit>0</unit>
<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>
<internal-format>
<use>texture[0]/internal-format</use>
</internal-format>
<environment>
<mode>modulate</mode>
</environment>
</texture-unit>
</pass>
</technique>
</PropertyList> </PropertyList>

View file

@ -1,62 +1,72 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PropertyList> <PropertyList>
<name>Effects/test</name> <name>Effects/test</name>
<parameters> <parameters>
<texture n ="0"> <texture n ="0">
</texture> </texture>
</parameters> </parameters>
<technique n="10"> <technique n="10">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/shader-effects</property> <property>/sim/rendering/shader-effects</property>
<less-equal> <less-equal>
<value type="float">1.0</value> <value type="float">1.0</value>
<shader-language/> <shader-language/>
</less-equal> </less-equal>
</and> </and>
</predicate> </predicate>
<pass n="0"> <pass n="0">
<!-- This is apparently not used, so maybe we'll blow it way soon. --> <!-- This is apparently not used, so maybe we'll blow it way soon. -->
<lighting>true</lighting> <lighting>true</lighting>
<material> <material>
<ambient type="vec4d">0.5 0.5 0.5 1.0</ambient> <ambient type="vec4d">0.5 0.5 0.5 1.0</ambient>
<diffuse type="vec4d">0.5 0.5 0.5 1.0</diffuse> <diffuse type="vec4d">0.5 0.5 0.5 1.0</diffuse>
<color-mode>off</color-mode> <color-mode>off</color-mode>
</material> </material>
<alpha-test> <alpha-test>
<comparison>greater</comparison> <comparison>greater</comparison>
<reference type="float">0.01</reference> <reference type="float">0.01</reference>
</alpha-test> </alpha-test>
<shade-model>smooth</shade-model> <shade-model>smooth</shade-model>
<blend> <blend>
<source>src-alpha</source> <source>src-alpha</source>
<destination>one-minus-src-alpha</destination> <destination>one-minus-src-alpha</destination>
</blend> </blend>
<depth> <depth>
<write-mask>false</write-mask> <write-mask>false</write-mask>
</depth> </depth>
<render-bin> <render-bin>
<bin-number>10</bin-number> <bin-number>10</bin-number>
<bin-name>DepthSortedBin</bin-name> <bin-name>DepthSortedBin</bin-name>
</render-bin> </render-bin>
<texture-unit> <texture-unit>
<unit>0</unit> <unit>0</unit>
<type><use>texture[0]/type</use></type> <type>
<image><use>texture[0]/image</use></image> <use>texture[0]/type</use>
<filter><use>texture[0]/filter</use></filter> </type>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s> <image>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t> <use>texture[0]/image</use>
<!--<wrap-s>clamp</wrap-s> </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>
<!--<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>--> <wrap-t>clamp</wrap-t>-->
</texture-unit> </texture-unit>
<!--<attribute> <!--<attribute>
<mypars type="vec3">0 0 0</mypars> <mypars type="vec3">0 0 0</mypars>
<value type="int">10</value> <value type="int">10</value>
</attribute>--> </attribute>-->
<program> <program>
<vertex-shader>Shaders/test.vert</vertex-shader> <vertex-shader>Shaders/test.vert</vertex-shader>
<fragment-shader>Shaders/test.frag</fragment-shader> <fragment-shader>Shaders/test.frag</fragment-shader>
<!--<attribute> <!--<attribute>
<name>usrAttr3</name> <name>usrAttr3</name>
<index>10</index> <index>10</index>
</attribute> </attribute>
@ -64,18 +74,18 @@
<name>usrAttr4</name> <name>usrAttr4</name>
<index>11</index> <index>11</index>
</attribute>--> </attribute>-->
</program> </program>
<uniform> <uniform>
<name>baseTexture</name> <name>baseTexture</name>
<type>sampler-2d</type> <type>sampler-2d</type>
<value type="int">0</value> <value type="int">0</value>
</uniform> </uniform>
<uniform> <uniform>
<name>shading</name> <name>shading</name>
<type>float</type> <type>float</type>
<value type="float">0.5</value> <value type="float">0.5</value>
</uniform> </uniform>
<vertex-program-two-side>true</vertex-program-two-side> <vertex-program-two-side>true</vertex-program-two-side>
</pass> </pass>
</technique> </technique>
</PropertyList> </PropertyList>

View file

@ -8,312 +8,380 @@ parameters :
texture[4] -> snow texture you want applied above snow-limit (I recommend using the corespondent winter texture for the base texture that you can find in terrain.winter) texture[4] -> snow texture you want applied above snow-limit (I recommend using the corespondent winter texture for the base texture that you can find in terrain.winter)
transitions -> transitions number can be set to 1 or 2 (if set to 2 will allow for an intermediate step) transitions -> transitions number can be set to 1 or 2 (if set to 2 will allow for an intermediate step)
inverse -> if this is se to 1 will keep the base texture on steep slopes and transition to the texture you want (useful to add some grass patches in rocky areas) inverse -> if this is set to 1 will keep the base texture on steep slopes and transition to the texture you want (useful to add some grass patches in rocky areas)
--> -->
<PropertyList> <PropertyList>
<name>Effects/transition</name> <name>Effects/transition</name>
<inherits-from>Effects/terrain-default</inherits-from> <inherits-from>Effects/terrain-default</inherits-from>
<parameters> <parameters>
<texture n="2"> <texture n="2">
<image>Textures.high/Terrain/transition1.dds</image> <image>Textures.high/Terrain/transition1.dds</image>
<filter>linear-mipmap-linear</filter> <filter>linear-mipmap-linear</filter>
<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"> <texture n="3">
<image>Textures.high/Terrain/transition2.dds</image> <image>Textures.high/Terrain/transition2.dds</image>
<filter>linear-mipmap-linear</filter> <filter>linear-mipmap-linear</filter>
<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="4"> <texture n="4">
<image>Textures.high/Terrain/snow3.dds</image> <image>Textures.high/Terrain/snow3.dds</image>
<filter>linear-mipmap-linear</filter> <filter>linear-mipmap-linear</filter>
<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>
<rain-norm> <rain-norm>
<use>/environment/rain-norm</use> <use>/environment/rain-norm</use>
</rain-norm> </rain-norm>
<snow-level> <snow-level>
<use>/sim/rendering/snow-level-m</use> <use>/sim/rendering/snow-level-m</use>
</snow-level> </snow-level>
<cloud-cover0> <cloud-cover0>
<use>/environment/clouds/layer[0]/coverage-type</use> <use>/environment/clouds/layer[0]/coverage-type</use>
</cloud-cover0> </cloud-cover0>
<cloud-cover1> <cloud-cover1>
<use>/environment/clouds/layer[1]/coverage-type</use> <use>/environment/clouds/layer[1]/coverage-type</use>
</cloud-cover1> </cloud-cover1>
<cloud-cover2> <cloud-cover2>
<use>/environment/clouds/layer[2]/coverage-type</use> <use>/environment/clouds/layer[2]/coverage-type</use>
</cloud-cover2> </cloud-cover2>
<cloud-cover3> <cloud-cover3>
<use>/environment/clouds/layer[3]/coverage-type</use> <use>/environment/clouds/layer[3]/coverage-type</use>
</cloud-cover3> </cloud-cover3>
<cloud-cover4> <cloud-cover4>
<use>/environment/clouds/layer[4]/coverage-type</use> <use>/environment/clouds/layer[4]/coverage-type</use>
</cloud-cover4> </cloud-cover4>
<transitions type="float">2.0</transitions> <transitions type="float">2.0</transitions>
<inverse type="float">0.0</inverse> <inverse type="float">0.0</inverse>
</parameters>
<!--<generate> <!-- fog include -->
<visibility>
<use>/environment/ground-visibility-m</use>
</visibility>
<avisibility>
<use>/environment/visibility-m</use>
</avisibility>
<lthickness>
<use>/environment/ground-haze-thickness-m</use>
</lthickness>
<scattering>
<use>/rendering/scene/scattering</use>
</scattering>
<terminator>
<use>/environment/terminator-relative-position-m</use>
</terminator>
<fogtype>
<use>/sim/rendering/scattering-shader</use>
</fogtype>
<!-- END fog include -->
</parameters>
<!--<generate>
<tangent type="int">6</tangent> <tangent type="int">6</tangent>
<binormal type="int">7</binormal> <binormal type="int">7</binormal>
</generate>--> </generate>-->
<technique n="9"> <technique n="9">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/transition-shader</property> <property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/shader-effects</property> <property>/sim/rendering/shaders/quality-level</property>
<or> <or>
<less-equal> <less-equal>
<value type="float">2.0</value> <value type="float">2.0</value>
<glversion/> <glversion/>
</less-equal> </less-equal>
<and> <and>
<extension-supported>GL_ARB_shader_objects</extension-supported> <extension-supported>GL_ARB_shader_objects</extension-supported>
<extension-supported>GL_ARB_shading_language_100</extension-supported> <extension-supported>GL_ARB_shading_language_100</extension-supported>
<extension-supported>GL_ARB_vertex_shader</extension-supported> <extension-supported>GL_ARB_vertex_shader</extension-supported>
<extension-supported>GL_ARB_fragment_shader</extension-supported> <extension-supported>GL_ARB_fragment_shader</extension-supported>
</and> </and>
</or> </or>
</and> </and>
</predicate> </predicate>
<pass> <pass>
<lighting>true</lighting> <lighting>true</lighting>
<!-- Use material values that are either inherited from the <!-- Use material values that are either inherited from the
terrain-default effect or supplied by an effect derived terrain-default effect or supplied by an effect derived
from this one e.g., one created in the materials library. --> from this one e.g., one created in the materials library. -->
<material> <material>
<ambient> <ambient>
<use>material/ambient</use> <use>material/ambient</use>
</ambient> </ambient>
<diffuse> <diffuse>
<use>material/diffuse</use> <use>material/diffuse</use>
</diffuse> </diffuse>
<specular> <specular>
<use>material/specular</use> <use>material/specular</use>
</specular> </specular>
<color-mode>ambient-and-diffuse</color-mode> <color-mode>ambient-and-diffuse</color-mode>
</material> </material>
<blend> <blend>
<use>transparent</use> <use>transparent</use>
</blend> </blend>
<alpha-test> <alpha-test>
<use>transparent</use> <use>transparent</use>
</alpha-test> </alpha-test>
<shade-model>smooth</shade-model> <shade-model>smooth</shade-model>
<cull-face>back</cull-face> <cull-face>back</cull-face>
<render-bin> <render-bin>
<bin-number> <bin-number>
<use>render-bin/bin-number</use> <use>render-bin/bin-number</use>
</bin-number> </bin-number>
<bin-name> <bin-name>
<use>render-bin/bin-name</use> <use>render-bin/bin-name</use>
</bin-name> </bin-name>
</render-bin> </render-bin>
<texture-unit> <texture-unit>
<unit>0</unit> <unit>0</unit>
<image> <image>
<use>texture[0]/image</use> <use>texture[0]/image</use>
</image> </image>
<filter> <filter>
<use>texture[0]/filter</use> <use>texture[0]/filter</use>
</filter> </filter>
<wrap-s> <wrap-s>
<use>texture[0]/wrap-s</use> <use>texture[0]/wrap-s</use>
</wrap-s> </wrap-s>
<wrap-t> <wrap-t>
<use>texture[0]/wrap-t</use> <use>texture[0]/wrap-t</use>
</wrap-t> </wrap-t>
<internal-format> <internal-format>
<use>texture[0]/internal-format</use> <use>texture[0]/internal-format</use>
</internal-format> </internal-format>
</texture-unit> </texture-unit>
<texture-unit> <texture-unit>
<unit>1</unit> <unit>1</unit>
<image> <image>
<use>texture[2]/image</use> <use>texture[2]/image</use>
</image> </image>
<filter> <filter>
<use>texture[2]/filter</use> <use>texture[2]/filter</use>
</filter> </filter>
<wrap-s> <wrap-s>
<use>texture[2]/wrap-s</use> <use>texture[2]/wrap-s</use>
</wrap-s> </wrap-s>
<wrap-t> <wrap-t>
<use>texture[2]/wrap-t</use> <use>texture[2]/wrap-t</use>
</wrap-t> </wrap-t>
<internal-format> <internal-format>
<use>texture[2]/internal-format</use> <use>texture[2]/internal-format</use>
</internal-format> </internal-format>
</texture-unit> </texture-unit>
<texture-unit> <texture-unit>
<unit>2</unit> <unit>2</unit>
<image> <image>
<use>texture[3]/image</use> <use>texture[3]/image</use>
</image> </image>
<filter> <filter>
<use>texture[3]/filter</use> <use>texture[3]/filter</use>
</filter> </filter>
<wrap-s> <wrap-s>
<use>texture[3]/wrap-s</use> <use>texture[3]/wrap-s</use>
</wrap-s> </wrap-s>
<wrap-t> <wrap-t>
<use>texture[3]/wrap-t</use> <use>texture[3]/wrap-t</use>
</wrap-t> </wrap-t>
<internal-format> <internal-format>
<use>texture[3]/internal-format</use> <use>texture[3]/internal-format</use>
</internal-format> </internal-format>
</texture-unit> </texture-unit>
<texture-unit> <texture-unit>
<unit>3</unit> <unit>3</unit>
<image> <image>
<use>texture[4]/image</use> <use>texture[4]/image</use>
</image> </image>
<filter> <filter>
<use>texture[4]/filter</use> <use>texture[4]/filter</use>
</filter> </filter>
<wrap-s> <wrap-s>
<use>texture[4]/wrap-s</use> <use>texture[4]/wrap-s</use>
</wrap-s> </wrap-s>
<wrap-t> <wrap-t>
<use>texture[4]/wrap-t</use> <use>texture[4]/wrap-t</use>
</wrap-t> </wrap-t>
<internal-format> <internal-format>
<use>texture[4]/internal-format</use> <use>texture[4]/internal-format</use>
</internal-format> </internal-format>
</texture-unit> </texture-unit>
<texture-unit> <texture-unit>
<unit>4</unit> <unit>4</unit>
<type>noise</type> <type>noise</type>
</texture-unit> </texture-unit>
<program> <program>
<vertex-shader>Shaders/transition.vert</vertex-shader> <vertex-shader>Shaders/include_fog.vert</vertex-shader>
<fragment-shader>Shaders/transition.frag</fragment-shader> <vertex-shader>Shaders/transition.vert</vertex-shader>
</program> <fragment-shader>Shaders/include_fog.frag</fragment-shader>
<fragment-shader>Shaders/transition.frag</fragment-shader>
</program>
<uniform> <uniform>
<name>BaseTex</name> <name>BaseTex</name>
<type>sampler-2d</type> <type>sampler-2d</type>
<value type="int">0</value> <value type="int">0</value>
</uniform> </uniform>
<uniform> <uniform>
<name>SecondTex</name> <name>SecondTex</name>
<type>sampler-2d</type> <type>sampler-2d</type>
<value type="int">1</value> <value type="int">1</value>
</uniform> </uniform>
<uniform> <uniform>
<name>ThirdTex</name> <name>ThirdTex</name>
<type>sampler-2d</type> <type>sampler-2d</type>
<value type="int">2</value> <value type="int">2</value>
</uniform> </uniform>
<uniform> <uniform>
<name>SnowTex</name> <name>SnowTex</name>
<type>sampler-2d</type> <type>sampler-2d</type>
<value type="int">3</value> <value type="int">3</value>
</uniform> </uniform>
<uniform> <uniform>
<name>NoiseTex</name> <name>NoiseTex</name>
<type>sampler-3d</type> <type>sampler-3d</type>
<value type="int">4</value> <value type="int">4</value>
</uniform> </uniform>
<uniform> <uniform>
<name>RainNorm</name> <name>RainNorm</name>
<type>float</type> <type>float</type>
<value> <value>
<use>rain-norm</use> <use>rain-norm</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>SnowLevel</name> <name>SnowLevel</name>
<type>float</type> <type>float</type>
<value> <value>
<use>snow-level</use> <use>snow-level</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>Transitions</name> <name>Transitions</name>
<type>float</type> <type>float</type>
<value> <value>
<use>transitions</use> <use>transitions</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>InverseSlope</name> <name>InverseSlope</name>
<type>float</type> <type>float</type>
<value> <value>
<use>inverse</use> <use>inverse</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>CloudCover0</name> <name>CloudCover0</name>
<type>float</type> <type>float</type>
<value> <value>
<use>cloud-cover0</use> <use>cloud-cover0</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>CloudCover1</name> <name>CloudCover1</name>
<type>float</type> <type>float</type>
<value> <value>
<use>cloud-cover1</use> <use>cloud-cover1</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>CloudCover2</name> <name>CloudCover2</name>
<type>float</type> <type>float</type>
<value> <value>
<use>cloud-cover2</use> <use>cloud-cover2</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>CloudCover3</name> <name>CloudCover3</name>
<type>float</type> <type>float</type>
<value> <value>
<use>cloud-cover3</use> <use>cloud-cover3</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>CloudCover4</name> <name>CloudCover4</name>
<type>float</type> <type>float</type>
<value> <value>
<use>cloud-cover4</use> <use>cloud-cover4</use>
</value> </value>
</uniform> </uniform>
</pass>
</technique> <!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
</pass>
</technique>
</PropertyList> </PropertyList>

View file

@ -12,87 +12,205 @@
Note: no sorting needed! --> Note: no sorting needed! -->
<PropertyList> <PropertyList>
<name>Effects/tree</name> <name>Effects/tree</name>
<parameters> <parameters>
<texture n ="0"> <texture n ="0">
</texture> </texture>
</parameters> <!-- fog include -->
<technique n="10"> <visibility>
<predicate> <use>/environment/ground-visibility-m</use>
<and> </visibility>
<property>/sim/rendering/random-vegetation</property> <avisibility>
<less-equal> <use>/environment/visibility-m</use>
<value type="float">1.0</value> </avisibility>
<shader-language/> <lthickness>
</less-equal> <use>/environment/ground-haze-thickness-m</use>
</and> </lthickness>
</predicate> <scattering>
<pass n="0"> <use>/rendering/scene/scattering</use>
<lighting>true</lighting> </scattering>
<material> <terminator>
<ambient type="vec4d">1.0 1.0 1.0 1.0</ambient> <use>/environment/terminator-relative-position-m</use>
<diffuse type="vec4d">1.0 1.0 1.0 1.0</diffuse> </terminator>
<color-mode>off</color-mode> <fogtype>
</material> <use>/sim/rendering/scattering-shader</use>
<alpha-test> </fogtype>
<comparison>gequal</comparison> <!-- END fog include -->
<reference type="float">0.33</reference> </parameters>
</alpha-test> <technique n="10">
<texture-unit> <predicate>
<unit>0</unit> <and>
<type>2d</type> <!--<property>/sim/rendering/shader-effects</property>-->
<image><use>texture[0]/image</use></image> <property>/sim/rendering/random-vegetation</property>
<wrap-s>clamp</wrap-s> <less-equal>
<wrap-t>clamp</wrap-t> <value type="float">1.0</value>
</texture-unit> <shader-language/>
<program> </less-equal>
<vertex-shader>Shaders/tree.vert</vertex-shader> </and>
<fragment-shader>Shaders/tree.frag</fragment-shader> </predicate>
</program> <pass n="0">
<uniform> <lighting>true</lighting>
<name>baseTexture</name> <material>
<type>sampler-2d</type> <ambient type="vec4d">1.0 1.0 1.0 1.0</ambient>
<value type="int">0</value> <diffuse type="vec4d">1.0 1.0 1.0 1.0</diffuse>
</uniform> <color-mode>off</color-mode>
</pass> </material>
<pass n="1"> <alpha-test>
<lighting>true</lighting> <comparison>gequal</comparison>
<material> <reference type="float">0.33</reference>
<ambient type="vec4d">1.0 1.0 1.0 1.0</ambient> </alpha-test>
<diffuse type="vec4d">1.0 1.0 1.0 1.0</diffuse> <texture-unit>
<color-mode>off</color-mode> <unit>0</unit>
</material> <type>2d</type>
<render-bin> <image>
<bin-number>2</bin-number> <!-- RANDOM_OBJECTS_BIN --> <use>texture[0]/image</use>
<bin-name>RenderBin</bin-name> </image>
</render-bin> <wrap-s>clamp</wrap-s>
<alpha-test> <wrap-t>clamp</wrap-t>
<comparison>less</comparison> </texture-unit>
<reference type="float">0.33</reference> <program>
</alpha-test> <!-- <vertex-shader>Shaders/include_fog.vert</vertex-shader> -->
<blend> <vertex-shader>Shaders/tree.vert</vertex-shader>
<source>src-alpha</source> <fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<destination>one-minus-src-alpha</destination> <fragment-shader n="1">Shaders/tree.frag</fragment-shader>
</blend> </program>
<depth> <uniform>
<write-mask>false</write-mask> <name>baseTexture</name>
</depth> <type>sampler-2d</type>
<texture-unit> <value type="int">0</value>
<unit>0</unit> </uniform>
<type>2d</type> <!-- BEGIN fog include -->
<image><use>texture[0]/image</use></image> <uniform>
<wrap-s>clamp</wrap-s> <name>visibility</name>
<wrap-t>clamp</wrap-t> <type>float</type>
</texture-unit> <value>
<program> <use>visibility</use>
<vertex-shader>Shaders/tree.vert</vertex-shader> </value>
<fragment-shader>Shaders/tree.frag</fragment-shader> </uniform>
</program> <uniform>
<uniform> <name>avisibility</name>
<name>baseTexture</name> <type>float</type>
<type>sampler-2d</type> <value>
<value type="int">0</value> <use>avisibility</use>
</uniform> </value>
</pass> </uniform>
</technique> <uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
</pass>
<pass n="1">
<lighting>true</lighting>
<material>
<ambient type="vec4d">1.0 1.0 1.0 1.0</ambient>
<diffuse type="vec4d">1.0 1.0 1.0 1.0</diffuse>
<color-mode>off</color-mode>
</material>
<render-bin>
<bin-number>2</bin-number>
<!-- RANDOM_OBJECTS_BIN -->
<bin-name>RenderBin</bin-name>
</render-bin>
<alpha-test>
<comparison>less</comparison>
<reference type="float">0.33</reference>
</alpha-test>
<blend>
<source>src-alpha</source>
<destination>one-minus-src-alpha</destination>
</blend>
<depth>
<write-mask>false</write-mask>
</depth>
<texture-unit>
<unit>0</unit>
<type>2d</type>
<image>
<use>texture[0]/image</use>
</image>
<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>
</texture-unit>
<program>
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<vertex-shader n="1">Shaders/tree.vert</vertex-shader>
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/tree.frag</fragment-shader>
</program>
<uniform>
<name>baseTexture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
</pass>
</technique>
</PropertyList> </PropertyList>

View file

@ -1,280 +1,492 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PropertyList> <PropertyList>
<name>Effects/urban</name> <name>Effects/urban</name>
<inherits-from>Effects/terrain-default</inherits-from> <inherits-from>Effects/terrain-default</inherits-from>
<parameters> <parameters>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level> <snow-level>
<depth-factor type="float">0.008</depth-factor> <use>/sim/rendering/snow-level-m</use>
<night-color type="vec3d">0.75 0.59 0.05</night-color> </snow-level>
<quality-level><use>/sim/rendering/quality-level</use></quality-level> <depth-factor type="float">0.008</depth-factor>
</parameters> <night-color type="vec3d">0.75 0.59 0.05</night-color>
<generate> <quality-level>
<normal type="int">15</normal> <use>/sim/rendering/shaders/quality-level</use>
<tangent type="int">6</tangent> </quality-level>
<binormal type="int">7</binormal>
</generate> <!--fog include-->
<technique n="8"> <visibility>
<predicate> <use>/environment/ground-visibility-m</use>
<and> </visibility>
<property>/sim/rendering/urban-shader</property> <avisibility>
<property>/sim/rendering/shader-effects</property> <use>/environment/visibility-m</use>
<less-equal> </avisibility>
<value type="float">4.0</value> <lthickness>
<float-property>/sim/rendering/quality-level</float-property> <use>/environment/ground-haze-thickness-m</use>
</less-equal> </lthickness>
<or> <scattering>
<less-equal> <use>/rendering/scene/scattering</use>
<value type="float">2.0</value> </scattering>
<glversion/> <terminator>
</less-equal> <use>/environment/terminator-relative-position-m</use>
<and> </terminator>
<extension-supported>GL_ARB_shader_objects</extension-supported> <fogtype>
<extension-supported>GL_ARB_shading_language_100</extension-supported> <use>/sim/rendering/scattering-shader</use>
<extension-supported>GL_ARB_vertex_shader</extension-supported> </fogtype>
<extension-supported>GL_ARB_fragment_shader</extension-supported> <!-- END fog include -->
</and>
</or> </parameters>
</and> <generate>
</predicate> <normal type="int">15</normal>
<pass> <tangent type="int">6</tangent>
<lighting>true</lighting> <binormal type="int">7</binormal>
<material> </generate>
<ambient><use>material/ambient</use></ambient> <technique n="8">
<diffuse><use>material/diffuse</use></diffuse> <predicate>
<specular><use>material/specular</use></specular> <and>
<color-mode>ambient-and-diffuse</color-mode> <property>/sim/rendering/shaders/urban</property>
</material> <property>/sim/rendering/shaders/quality-level</property>
<blend><use>transparent</use></blend> <less-equal>
<alpha-test><use>transparent</use></alpha-test> <value type="float">4.0</value>
<shade-model>smooth</shade-model> <float-property>/sim/rendering/shaders/quality-level</float-property>
<cull-face>back</cull-face> </less-equal>
<render-bin> <or>
<bin-number><use>render-bin/bin-number</use></bin-number> <less-equal>
<bin-name><use>render-bin/bin-name</use></bin-name> <value type="float">2.0</value>
</render-bin> <glversion/>
<texture-unit> </less-equal>
<unit>0</unit> <and>
<image><use>texture[0]/image</use></image> <extension-supported>GL_ARB_shader_objects</extension-supported>
<filter><use>texture[0]/filter</use></filter> <extension-supported>GL_ARB_shading_language_100</extension-supported>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s> <extension-supported>GL_ARB_vertex_shader</extension-supported>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t> <extension-supported>GL_ARB_fragment_shader</extension-supported>
<internal-format> </and>
<use>texture[0]/internal-format</use> </or>
</internal-format> </and>
</texture-unit> </predicate>
<texture-unit> <pass>
<unit>1</unit> <lighting>true</lighting>
<image><use>texture[2]/image</use></image> <material>
<filter><use>texture[2]/filter</use></filter> <ambient>
<wrap-s><use>texture[2]/wrap-s</use></wrap-s> <use>material/ambient</use>
<wrap-t><use>texture[2]/wrap-t</use></wrap-t> </ambient>
<internal-format><use>texture[2]/internal-format</use></internal-format> <diffuse>
</texture-unit> <use>material/diffuse</use>
<texture-unit> </diffuse>
<unit>2</unit> <specular>
<image><use>texture[2]/image</use></image> <use>material/specular</use>
<filter>nearest-mipmap-nearest</filter> </specular>
<wrap-s><use>texture[2]/wrap-s</use></wrap-s> <color-mode>ambient-and-diffuse</color-mode>
<wrap-t><use>texture[2]/wrap-t</use></wrap-t> </material>
<internal-format><use>texture[2]/internal-format</use></internal-format> <blend>
<mipmap-control> <use>transparent</use>
<function-r>average</function-r> </blend>
<function-g>average</function-g> <alpha-test>
<function-b>average</function-b> <use>transparent</use>
<function-a>min</function-a> </alpha-test>
</mipmap-control> <shade-model>smooth</shade-model>
</texture-unit> <cull-face>back</cull-face>
<texture-unit> <render-bin>
<unit>3</unit> <bin-number>
<type>noise</type> <use>render-bin/bin-number</use>
</texture-unit> </bin-number>
<program> <bin-name>
<vertex-shader>Shaders/urban.vert</vertex-shader> <use>render-bin/bin-name</use>
<fragment-shader>Shaders/urban.frag</fragment-shader> </bin-name>
<attribute> </render-bin>
<name>tangent</name> <texture-unit>
<index>6</index> <unit>0</unit>
</attribute> <image>
<attribute> <use>texture[0]/image</use>
<name>binormal</name> </image>
<index>7</index> <filter>
</attribute> <use>texture[0]/filter</use>
<attribute> </filter>
<name>normal</name> <wrap-s>
<index>15</index> <use>texture[0]/wrap-s</use>
</attribute> </wrap-s>
</program> <wrap-t>
<uniform> <use>texture[0]/wrap-t</use>
<name>BaseTex</name> </wrap-t>
<type>sampler-2d</type> <internal-format>
<value type="int">0</value> <use>texture[0]/internal-format</use>
</uniform> </internal-format>
<uniform> </texture-unit>
<name>NormalTex</name> <texture-unit>
<type>sampler-2d</type> <unit>1</unit>
<value type="int">1</value> <image>
</uniform> <use>texture[2]/image</use>
<uniform> </image>
<name>QDMTex</name> <filter>
<type>sampler-2d</type> <use>texture[2]/filter</use>
<value type="int">2</value> </filter>
</uniform> <wrap-s>
<uniform> <use>texture[2]/wrap-s</use>
<name>NoiseTex</name> </wrap-s>
<type>sampler-3d</type> <wrap-t>
<value type="int">3</value> <use>texture[2]/wrap-t</use>
</uniform> </wrap-t>
<uniform> <internal-format>
<name>depth_factor</name> <use>texture[2]/internal-format</use>
<type>float</type> </internal-format>
<value><use>depth-factor</use></value> </texture-unit>
</uniform> <texture-unit>
<uniform> <unit>2</unit>
<name>tile_size</name> <image>
<type>float</type> <use>texture[2]/image</use>
<value><use>xsize</use></value> </image>
</uniform> <filter>nearest-mipmap-nearest</filter>
<uniform> <wrap-s>
<name>night_color</name> <use>texture[2]/wrap-s</use>
<type>float-vec3</type> </wrap-s>
<value><use>night-color</use></value> <wrap-t>
</uniform> <use>texture[2]/wrap-t</use>
<uniform> </wrap-t>
<name>quality_level</name> <internal-format>
<type>float</type> <use>texture[2]/internal-format</use>
<value><use>quality-level</use></value> </internal-format>
</uniform> <mipmap-control>
<uniform> <function-r>average</function-r>
<name>snowlevel</name> <function-g>average</function-g>
<type>float</type> <function-b>average</function-b>
<value><use>snow-level</use></value> <function-a>min</function-a>
</uniform> </mipmap-control>
<uniform> </texture-unit>
<name>max_lod_level</name> <texture-unit>
<type>float</type> <unit>3</unit>
<value><use>max-lod-level</use></value> <type>noise</type>
</uniform> </texture-unit>
</pass> <program>
</technique> <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<technique n="9"> <vertex-shader n="1">Shaders/urban.vert</vertex-shader>
<predicate> <fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<and> <fragment-shader n="1">Shaders/urban.frag</fragment-shader>
<property>/sim/rendering/urban-shader</property> <attribute>
<property>/sim/rendering/shader-effects</property> <name>tangent</name>
<less-equal> <index>6</index>
<value type="float">2.0</value> </attribute>
<float-property>/sim/rendering/quality-level</float-property> <attribute>
</less-equal> <name>binormal</name>
<or> <index>7</index>
<less-equal> </attribute>
<value type="float">2.0</value> <attribute>
<glversion/> <name>normal</name>
</less-equal> <index>15</index>
<and> </attribute>
<extension-supported>GL_ARB_shader_objects</extension-supported> </program>
<extension-supported>GL_ARB_shading_language_100</extension-supported> <uniform>
<extension-supported>GL_ARB_vertex_shader</extension-supported> <name>BaseTex</name>
<extension-supported>GL_ARB_fragment_shader</extension-supported> <type>sampler-2d</type>
</and> <value type="int">0</value>
</or> </uniform>
</and> <uniform>
</predicate> <name>NormalTex</name>
<pass> <type>sampler-2d</type>
<lighting>true</lighting> <value type="int">1</value>
<material> </uniform>
<ambient><use>material/ambient</use></ambient> <uniform>
<diffuse><use>material/diffuse</use></diffuse> <name>QDMTex</name>
<specular><use>material/specular</use></specular> <type>sampler-2d</type>
<color-mode>ambient-and-diffuse</color-mode> <value type="int">2</value>
</material> </uniform>
<blend><use>transparent</use></blend> <uniform>
<alpha-test><use>transparent</use></alpha-test> <name>NoiseTex</name>
<shade-model>smooth</shade-model> <type>sampler-3d</type>
<cull-face>back</cull-face> <value type="int">3</value>
<render-bin> </uniform>
<bin-number><use>render-bin/bin-number</use></bin-number> <uniform>
<bin-name><use>render-bin/bin-name</use></bin-name> <name>depth_factor</name>
</render-bin> <type>float</type>
<texture-unit> <value>
<unit>0</unit> <use>depth-factor</use>
<image><use>texture[0]/image</use></image> </value>
<filter><use>texture[0]/filter</use></filter> </uniform>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s> <uniform>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t> <name>tile_size</name>
<internal-format> <type>float</type>
<use>texture[0]/internal-format</use> <value>
</internal-format> <use>xsize</use>
</texture-unit> </value>
<texture-unit> </uniform>
<unit>1</unit> <uniform>
<image><use>texture[2]/image</use></image> <name>night_color</name>
<filter><use>texture[2]/filter</use></filter> <type>float-vec3</type>
<wrap-s><use>texture[2]/wrap-s</use></wrap-s> <value>
<wrap-t><use>texture[2]/wrap-t</use></wrap-t> <use>night-color</use>
<internal-format> </value>
<use>texture[2]/internal-format</use> </uniform>
</internal-format> <uniform>
</texture-unit> <name>quality_level</name>
<texture-unit> <type>float</type>
<unit>2</unit> <value>
<type>noise</type> <use>quality-level</use>
</texture-unit> </value>
<program> </uniform>
<vertex-shader>Shaders/urban.vert</vertex-shader> <uniform>
<fragment-shader>Shaders/urban.frag</fragment-shader> <name>snowlevel</name>
<attribute> <type>float</type>
<name>tangent</name> <value>
<index>6</index> <use>snow-level</use>
</attribute> </value>
<attribute> </uniform>
<name>binormal</name> <uniform>
<index>7</index> <name>max_lod_level</name>
</attribute> <type>float</type>
<attribute> <value>
<name>normal</name> <use>max-lod-level</use>
<index>15</index> </value>
</attribute> </uniform>
</program> <!-- BEGIN fog include -->
<uniform> <uniform>
<name>BaseTex</name> <name>visibility</name>
<type>sampler-2d</type> <type>float</type>
<value type="int">0</value> <value>
</uniform> <use>visibility</use>
<uniform> </value>
<name>NormalTex</name> </uniform>
<type>sampler-2d</type> <uniform>
<value type="int">1</value> <name>avisibility</name>
</uniform> <type>float</type>
<uniform> <value>
<name>NoiseTex</name> <use>avisibility</use>
<type>sampler-3d</type> </value>
<value type="int">2</value> </uniform>
</uniform> <uniform>
<uniform> <name>hazeLayerAltitude</name>
<name>depth_factor</name> <type>float</type>
<type>float</type> <value>
<value><use>depth-factor</use></value> <use>lthickness</use>
</uniform> </value>
<uniform> </uniform>
<name>tile_size</name> <uniform>
<type>float</type> <name>scattering</name>
<value><use>xsize</use></value> <type>float</type>
</uniform> <value>
<uniform> <use>scattering</use>
<name>night_color</name> </value>
<type>float-vec3</type> </uniform>
<value><use>night-color</use></value> <uniform>
</uniform> <name>terminator</name>
<uniform> <type>float</type>
<name>quality_level</name> <value>
<type>float</type> <use>terminator</use>
<value><use>quality-level</use></value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>snowlevel</name> <name>fogType</name>
<type>float</type> <type>int</type>
<value><use>snow-level</use></value> <value>
</uniform> <use>fogtype</use>
</pass> </value>
</technique> </uniform>
<!-- END fog include -->
</pass>
</technique>
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/shaders/urban</property>
<!--<property>/sim/rendering/shader-effects</property>-->
<less-equal>
<value type="float">2.0</value>
<float-property>/sim/rendering/shaders/quality-level</float-property>
</less-equal>
<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>
</and>
</predicate>
<pass>
<lighting>true</lighting>
<material>
<ambient>
<use>material/ambient</use>
</ambient>
<diffuse>
<use>material/diffuse</use>
</diffuse>
<specular>
<use>material/specular</use>
</specular>
<color-mode>ambient-and-diffuse</color-mode>
</material>
<blend>
<use>transparent</use>
</blend>
<alpha-test>
<use>transparent</use>
</alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number>
<use>render-bin/bin-number</use>
</bin-number>
<bin-name>
<use>render-bin/bin-name</use>
</bin-name>
</render-bin>
<texture-unit>
<unit>0</unit>
<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>
<internal-format>
<use>texture[0]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>1</unit>
<image>
<use>texture[2]/image</use>
</image>
<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>2</unit>
<type>noise</type>
</texture-unit>
<program>
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<vertex-shader n="1">Shaders/urban.vert</vertex-shader>
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/urban.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>
</attribute>
<attribute>
<name>binormal</name>
<index>7</index>
</attribute>
<attribute>
<name>normal</name>
<index>15</index>
</attribute>
</program>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
<uniform>
<name>BaseTex</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>NormalTex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>NoiseTex</name>
<type>sampler-3d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>depth_factor</name>
<type>float</type>
<value>
<use>depth-factor</use>
</value>
</uniform>
<uniform>
<name>tile_size</name>
<type>float</type>
<value>
<use>xsize</use>
</value>
</uniform>
<uniform>
<name>night_color</name>
<type>float-vec3</type>
<value>
<use>night-color</use>
</value>
</uniform>
<uniform>
<name>quality_level</name>
<type>float</type>
<value>
<use>quality-level</use>
</value>
</uniform>
<uniform>
<name>snowlevel</name>
<type>float</type>
<value>
<use>snow-level</use>
</value>
</uniform>
</pass>
</technique>
</PropertyList> </PropertyList>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PropertyList> <PropertyList>
<name>Effects/water-inland</name> <name>Effects/water</name>
<inherits-from>Effects/terrain-default</inherits-from> <inherits-from>Effects/terrain-default</inherits-from>
<parameters> <parameters>
<texture n="0"> <texture n="0">
@ -49,6 +49,26 @@
<cloud-cover4> <cloud-cover4>
<use>/environment/clouds/layer[4]/coverage-type</use> <use>/environment/clouds/layer[4]/coverage-type</use>
</cloud-cover4> </cloud-cover4>
<!-- fog include -->
<visibility>
<use>/environment/ground-visibility-m</use>
</visibility>
<avisibility>
<use>/environment/visibility-m</use>
</avisibility>
<lthickness>
<use>/environment/ground-haze-thickness-m</use>
</lthickness>
<scattering>
<use>/rendering/scene/scattering</use>
</scattering>
<terminator>
<use>/environment/terminator-relative-position-m</use>
</terminator>
<fogtype>
<use>/sim/rendering/scattering-shader</use>
</fogtype>
<!-- END fog include -->
</parameters> </parameters>
<technique n="8"> <technique n="8">
<predicate> <predicate>
@ -176,6 +196,7 @@
</internal-format> </internal-format>
</texture-unit> </texture-unit>
<program> <program>
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
<vertex-shader>Shaders/water.vert</vertex-shader> <vertex-shader>Shaders/water.vert</vertex-shader>
<fragment-shader>Shaders/water-inland.frag</fragment-shader> <fragment-shader>Shaders/water-inland.frag</fragment-shader>
</program> </program>
@ -240,6 +261,50 @@
<use>cloud-cover4</use> <use>cloud-cover4</use>
</value> </value>
</uniform> </uniform>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
</pass> </pass>
</technique> </technique>
<technique n="9"> <technique n="9">

View file

@ -13,8 +13,8 @@
<texture n="2"> <texture n="2">
<!--<image>Textures/Water/water-normalmap.png</image>--> <!--<image>Textures/Water/water-normalmap.png</image>-->
<!--<image>Textures/Water/water-normalmap2.dds</image>--> <!--<image>Textures/Water/water-normalmap2.dds</image>-->
<!--<image>Textures/Water/water_sine_nmap.dds</image>-->
<image>Textures/Water/waves-ver10-nm.dds</image> <image>Textures/Water/waves-ver10-nm.dds</image>
<!--<image>Textures/Water/caustic-nm.png</image>-->
<filter>linear-mipmap-linear</filter> <filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s> <wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
@ -23,8 +23,9 @@
<texture n="3"> <texture n="3">
<!--<image>Textures/Water/water-dudv.png</image>--> <!--<image>Textures/Water/water-dudv.png</image>-->
<!--<image>Textures/Water/dudvmap2.png</image>--> <!--<image>Textures/Water/dudvmap2.png</image>-->
<image>Textures/Water/waves-ver10-dudv.dds</image> <!--<image>Textures/Water/waves-ver10-dudv.dds</image>-->
<!--<image>Textures/Water/water-reflection-grey.png</image>--> <!--<image>Textures/Water/water-reflection-grey.png</image>-->
<image>Textures/Water/water_sine_nmap.dds</image>
<filter>linear-mipmap-linear</filter> <filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s> <wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
@ -46,6 +47,7 @@
</texture> </texture>
<texture n="6"> <texture n="6">
<image>Textures/Water/perlin-noise-nm.dds</image> <image>Textures/Water/perlin-noise-nm.dds</image>
<!-- <image>Textures/Water/water_sine_nmap.dds</image> -->
<filter>linear-mipmap-linear</filter> <filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s> <wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t> <wrap-t>repeat</wrap-t>
@ -60,44 +62,80 @@
<overcast> <overcast>
<use>/rendering/scene/overcast</use> <use>/rendering/scene/overcast</use>
</overcast> </overcast>
<cloud-cover0> <cloud-cover n="0">
<use>/environment/clouds/layer[0]/coverage-type</use> <use>/environment/clouds/layer[0]/coverage-type</use>
</cloud-cover0> </cloud-cover>
<cloud-cover1> <cloud-cover n="1">
<use>/environment/clouds/layer[1]/coverage-type</use> <use>/environment/clouds/layer[1]/coverage-type</use>
</cloud-cover1> </cloud-cover>
<cloud-cover2> <cloud-cover n="2" >
<use>/environment/clouds/layer[2]/coverage-type</use> <use>/environment/clouds/layer[2]/coverage-type</use>
</cloud-cover2> </cloud-cover>
<cloud-cover3> <cloud-cover n="3">
<use>/environment/clouds/layer[3]/coverage-type</use> <use>/environment/clouds/layer[3]/coverage-type</use>
</cloud-cover3> </cloud-cover>
<cloud-cover4> <cloud-cover n="4">
<use>/environment/clouds/layer[4]/coverage-type</use> <use>/environment/clouds/layer[4]/coverage-type</use>
</cloud-cover4> </cloud-cover>
<!--<wind> <!--<wind>
<use>/environment/wind-speed-kt</use> <use>/environment/wind-speed-kt</use>
</wind>--> </wind>-->
<windE> <windE>
<use>/environment/config/boundary/entry[0]/wind-from-east-fps</use> <use>/environment/sea/surface/wind-from-east-fps</use>
</windE> </windE>
<windN> <windN>
<use>/environment/config/boundary/entry[0]/wind-from-north-fps</use> <use>/environment/sea/surface/wind-from-north-fps</use>
</windN> </windN>
<wind-from> <wind-from>
<use>/environment/config/boundary/entry[0]/wind-from-heading-deg</use> <use>/environment/config/boundary/entry[0]/wind-from-heading-deg</use>
</wind-from> </wind-from>
<WaveFreq>
<use>/environment/wave/freq</use>
</WaveFreq>
<WaveAmp>
<use>/environment/wave/amp</use>
</WaveAmp>
<WaveSharp>
<use>/environment/wave/sharp</use>
</WaveSharp>
<WaveAngle>
<use>/environment/wave/angle</use>
</WaveAngle>
<WaveFactor>
<use>/environment/wave/factor</use>
</WaveFactor>
<WaveDAngle>
<use>/environment/wave/dangle</use>
</WaveDAngle>
<!-- fog include -->
<visibility>
<use>/environment/ground-visibility-m</use>
</visibility>
<avisibility>
<use>/environment/visibility-m</use>
</avisibility>
<lthickness>
<use>/environment/ground-haze-thickness-m</use>
</lthickness>
<scattering>
<use>/rendering/scene/scattering</use>
</scattering>
<terminator>
<use>/environment/terminator-relative-position-m</use>
</terminator>
<fogtype>
<use>/sim/rendering/scattering-shader</use>
</fogtype>
<!-- END fog include -->
</parameters> </parameters>
<technique n="8"> <technique n="8">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/water-shader</property> <property>/sim/rendering/shaders/water</property>
<property>/sim/rendering/shader-effects</property>
<less-equal> <less-equal>
<value type="float">2.0</value> <value type="float">4.0</value>
<float-property>/sim/rendering/quality-level</float-property> <float-property>/sim/rendering/shaders/water</float-property>
</less-equal> </less-equal>
<or> <or>
<less-equal> <less-equal>
@ -251,9 +289,15 @@
<use>texture[6]/internal-format</use> <use>texture[6]/internal-format</use>
</internal-format> </internal-format>
</texture-unit> </texture-unit>
<texture-unit>
<unit>9</unit>
<type>noise</type>
</texture-unit>
<program> <program>
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
<vertex-shader>Shaders/water.vert</vertex-shader> <vertex-shader>Shaders/water.vert</vertex-shader>
<fragment-shader>Shaders/water.frag</fragment-shader> <fragment-shader>Shaders/include_fog.frag</fragment-shader>
<fragment-shader>Shaders/water_sine.frag</fragment-shader>
</program> </program>
<uniform> <uniform>
<name>water_reflection</name> <name>water_reflection</name>
@ -295,35 +339,35 @@
<name>CloudCover0</name> <name>CloudCover0</name>
<type>float</type> <type>float</type>
<value> <value>
<use>cloud-cover0</use> <use>cloud-cover[0]</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>CloudCover1</name> <name>CloudCover1</name>
<type>float</type> <type>float</type>
<value> <value>
<use>cloud-cover1</use> <use>cloud-cover[1]</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>CloudCover2</name> <name>CloudCover2</name>
<type>float</type> <type>float</type>
<value> <value>
<use>cloud-cover2</use> <use>cloud-cover[2]</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>CloudCover3</name> <name>CloudCover3</name>
<type>float</type> <type>float</type>
<value> <value>
<use>cloud-cover3</use> <use>cloud-cover[3]</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>CloudCover4</name> <name>CloudCover4</name>
<type>float</type> <type>float</type>
<value> <value>
<use>cloud-cover4</use> <use>cloud-cover[4]</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
@ -362,13 +406,109 @@
<use>wind-from</use> <use>wind-from</use>
</value> </value>
</uniform> </uniform>
<uniform>
<name>WaveFreq</name>
<type>float</type>
<value>
<use>WaveFreq</use>
</value>
</uniform>
<uniform>
<name>WaveAmp</name>
<type>float</type>
<value>
<use>WaveAmp</use>
</value>
</uniform>
<uniform>
<name>WaveSharp</name>
<type>float</type>
<value>
<use>WaveSharp</use>
</value>
</uniform>
<uniform>
<name>WaveAngle</name>
<type>float</type>
<value>
<use>WaveAngle</use>
</value>
</uniform>
<uniform>
<name>WaveFactor</name>
<type>float</type>
<value>
<use>WaveFactor</use>
</value>
</uniform>
<uniform>
<name>WaveDAngle</name>
<type>float</type>
<value>
<use>WaveDAngle</use>
</value>
</uniform>
<uniform>
<name>Noise</name>
<type>sampler-3d</type>
<value type="int">9</value>
</uniform>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
</pass> </pass>
</technique> </technique>
<technique n="9"> <technique n="9">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/water-shader</property> <property>/sim/rendering/shaders/water</property>
<property>/sim/rendering/shader-effects</property> <less-equal>
<value type="float">2.0</value>
<float-property>/sim/rendering/shaders/water</float-property>
</less-equal>
<or> <or>
<less-equal> <less-equal>
<value type="float">2.0</value> <value type="float">2.0</value>
@ -415,17 +555,323 @@
</render-bin> </render-bin>
<texture-unit> <texture-unit>
<unit>0</unit> <unit>0</unit>
<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>
<internal-format>
<use>texture[0]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>2</unit>
<image>
<use>texture[2]/image</use>
</image>
<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>
<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>
<texture-unit>
<unit>4</unit>
<image>
<use>texture[4]/image</use>
</image>
<filter>
<use>texture[4]/filter</use>
</filter>
<wrap-s>
<use>texture[4]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[4]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[4]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>5</unit>
<image>
<use>texture[5]/image</use>
</image>
<filter>
<use>texture[5]/filter</use>
</filter>
<wrap-s>
<use>texture[5]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[5]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[5]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>6</unit>
<image>
<use>texture[6]/image</use>
</image>
<filter>
<use>texture[6]/filter</use>
</filter>
<wrap-s>
<use>texture[6]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[6]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[6]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>9</unit>
<type>noise</type> <type>noise</type>
</texture-unit> </texture-unit>
<program> <program>
<vertex-shader>Shaders/water-orig.vert</vertex-shader> <vertex-shader>Shaders/include_fog.vert</vertex-shader>
<fragment-shader>Shaders/water-orig.frag</fragment-shader> <vertex-shader>Shaders/water.vert</vertex-shader>
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
<fragment-shader>Shaders/water.frag</fragment-shader>
</program> </program>
<uniform> <uniform>
<name>texture</name> <name>water_reflection</name>
<type>sampler-3d</type> <type>sampler-2d</type>
<value type="int">0</value> <value type="int">0</value>
</uniform> </uniform>
<uniform>
<name>water_normalmap</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>water_dudvmap</name>
<type>sampler-2d</type>
<value type="int">3</value>
</uniform>
<uniform>
<name>water_reflection_grey</name>
<type>sampler-2d</type>
<value type="int">4</value>
</uniform>
<uniform>
<name>sea_foam</name>
<type>sampler-2d</type>
<value type="int">5</value>
</uniform>
<uniform>
<name>perlin_normalmap</name>
<type>sampler-2d</type>
<value type="int">6</value>
</uniform>
<uniform>
<name>saturation</name>
<type>float</type>
<!--<value>0.4</value>-->
<value>
<use>saturation</use>
</value>
</uniform>
<uniform>
<name>CloudCover0</name>
<type>float</type>
<value>
<use>cloud-cover[0]</use>
</value>
</uniform>
<uniform>
<name>CloudCover1</name>
<type>float</type>
<value>
<use>cloud-cover[1]</use>
</value>
</uniform>
<uniform>
<name>CloudCover2</name>
<type>float</type>
<value>
<use>cloud-cover[2]</use>
</value>
</uniform>
<uniform>
<name>CloudCover3</name>
<type>float</type>
<value>
<use>cloud-cover[3]</use>
</value>
</uniform>
<uniform>
<name>CloudCover4</name>
<type>float</type>
<value>
<use>cloud-cover[4]</use>
</value>
</uniform>
<uniform>
<name>Status</name>
<type>int</type>
<value>
<use>status</use>
</value>
<!--<value type="int">0</value> -->
</uniform>
<uniform>
<name>Overcast</name>
<type>float</type>
<value>
<use>overcast</use>
</value>
</uniform>
<uniform>
<name>WindE</name>
<type>float</type>
<value>
<use>windE</use>
</value>
</uniform>
<uniform>
<name>WindN</name>
<type>float</type>
<value>
<use>windN</use>
</value>
</uniform>
<uniform>
<name>WindFrom</name>
<type>float</type>
<value>
<use>wind-from</use>
</value>
</uniform>
<uniform>
<name>WaveFreq</name>
<type>float</type>
<value>
<use>WaveFreq</use>
</value>
</uniform>
<uniform>
<name>WaveAmp</name>
<type>float</type>
<value>
<use>WaveAmp</use>
</value>
</uniform>
<uniform>
<name>WaveSharp</name>
<type>float</type>
<value>
<use>WaveSharp</use>
</value>
</uniform>
<uniform>
<name>WaveAngle</name>
<type>float</type>
<value>
<use>WaveAngle</use>
</value>
</uniform>
<uniform>
<name>WaveFactor</name>
<type>float</type>
<value>
<use>WaveFactor</use>
</value>
</uniform>
<uniform>
<name>WaveDAngle</name>
<type>float</type>
<value>
<use>WaveDAngle</use>
</value>
</uniform>
<uniform>
<name>Noise</name>
<type>sampler-3d</type>
<value type="int">9</value>
</uniform>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
</pass> </pass>
</technique> </technique>
</PropertyList> </PropertyList>

159
Nasal/weather-utility.nas Normal file
View file

@ -0,0 +1,159 @@
##########
#this utility is a workaround for the fact that a shader uses listeners which cannot
# be used with a tied property
#
#does what it says on the tin
var clamp = func(v, min, max) { v < min ? min : v > max ? max : v }
#set global variables
var Amp = 1.0;
var Angle = 35.0;
var DAngle = 20.0;
var Freq = 0.01;
var Factor = 0.0004;
var Sharp = 1.0;
#add control properies for waves
wave_amp_Node = props.globals.getNode("/environment/wave/amp" , 1);
wave_amp_Node.setDoubleValue(Amp);
wave_freq_Node = props.globals.getNode("/environment/wave/freq" , 1);
wave_freq_Node.setDoubleValue(Freq);
wave_sharp_Node = props.globals.getNode("/environment/wave/sharp" , 1);
wave_sharp_Node.setDoubleValue(Sharp);
wave_angle_Node = props.globals.getNode("/environment/wave/angle" , 1);
wave_angle_Node.setDoubleValue(Angle);
wave_factor_Node = props.globals.getNode("/environment/wave/factor" , 1);
wave_factor_Node.setDoubleValue(Factor);
wave_factor_Node = props.globals.getNode("/environment/wave/dangle" , 1);
wave_factor_Node.setDoubleValue(DAngle);
props.globals.initNode("/environment/sea/surface/wind-speed-kt", 0, "DOUBLE");
props.globals.initNode("/environment/sea/surface/wind-from-east-fps", 0, "DOUBLE");
props.globals.initNode("/environment/sea/surface/wind-from-north-fps", 0, "DOUBLE");
props.globals.initNode("/environment/sea/surface/wind-from-deg", 0, "DOUBLE");
props.globals.initNode("/environment/sea/surface/config/enabled", 0, "DOUBLE");
#object rotation values
props.globals.initNode("/orientation/model/heading-deg", 0, "DOUBLE");
props.globals.initNode("/orientation/model/pitch-deg", 0, "DOUBLE");
props.globals.initNode("/orientation/model/roll-deg", 0, "DOUBLE");
var initialize = func {
wind_from_east_Node = props.globals.getNode("/environment/config/boundary/entry[0]/wind-from-east-fps", 1);
wind_from_east_Node.setDoubleValue(0);
wind_from_north_Node = props.globals.getNode("/environment/config/boundary/entry[0]/wind-from-north-fps", 1);
wind_from_north_Node.setDoubleValue(0);
wind_from_Node = props.globals.getNode("/environment/config/boundary/entry[0]/wind-from-heading-deg", 1);
wind_from_Node.setDoubleValue(0);
wind_speed_Node = props.globals.getNode("/environment/config/boundary/entry[0]/wind-speed-kt", 1);
wind_speed_Node.setDoubleValue(0);
wind_status_Node = props.globals.getNode("/environment/config/enabled", 1);
wind_status_Node.setBoolValue(1);
ground_vis_Node = props.globals.getNode("/environment/ground-visibility-m", 1);
ground_vis_Node.setDoubleValue(500);
ground_thick_Node = props.globals.getNode("/environment/ground-haze-thickness-m" , 1);
ground_thick_Node.setDoubleValue(300);
ground_term_Node = props.globals.getNode("/environment/terminator-relative-position-m" , 1);
ground_term_Node.setDoubleValue(60000);
# ################## listeners ####################
#
setlistener("/environment/sea/surface/wind-speed-kt", func (n) {
var wind = 0;
var amp = 0;
var angle = 0;
var dangle = 0;
var freq = 0;
var factor = 0;
var sharp = 0;
wind = n.getValue();
amp = Amp + 0.02 * wind;
amp = clamp(amp, 1.0, 2.0);
setprop("/environment/wave/amp", amp);
angle = Angle + 0.2 * wind;
setprop("/environment/wave/angle", angle);
dangle = DAngle - 0.4 * wind;
setprop("/environment/wave/dangle", dangle);
freq = Freq + 0.0008 * wind;
freq = clamp(freq, 0.01, 0.015);
setprop("/environment/wave/freq", freq);
factor = Factor - 0.00001 * wind;
factor = clamp(factor, 0.0001, 0.0004);
setprop("/environment/wave/factor", factor);
sharp = Sharp + 0.02 * wind;
sharp = clamp(sharp, 1.0, 2.0);
setprop("/environment/wave/sharp", sharp);
},
1,
0);# end listener
print("weather util initialized ...");
loop();
}# end init
var loop = func {
var value = getprop("/environment/config/boundary/entry[0]/wind-from-east-fps");
setprop("/environment/sea/surface/wind-from-east-fps", value);
# print("wind-from-east-fps ", getprop("/environment/sea/surface/wind-from-east-fps"));
value = getprop("/environment/config/boundary/entry[0]/wind-from-north-fps");
setprop("/environment/sea/surface/wind-from-north-fps", value);
# print("wind-from-north-fps ", getprop("/environment/sea/surface/wind-from-north-fps"));
value = getprop("/environment/config/boundary/entry[0]/wind-from-heading-deg");
setprop("/environment/sea/surface/wind-from-deg", value);
# print("wind-from-deg ", getprop("/environment/sea/surface/wind-from-deg"));
value = getprop("/environment/config/boundary/entry[0]/wind-speed-kt");
setprop("/environment/sea/surface/wind-speed-kt", value);
# print("wind-speed-kt ", getprop("/environment/sea/surface/wind-speed-kt"));
value = getprop("/environment/config/enabled");
setprop("/environment/sea/config/enabled", value);
# print("wind-speed-kt ", getprop("/environment/config/enabled"));
# orientation fix
#orientation
value = getprop("/orientation/heading-deg") or 0.0;
setprop("/orientation/model/heading-deg", value);
value = getprop("/orientation/pitch-deg") or 0.0;
setprop("/orientation/model/pitch-deg", value);
value = getprop("/orientation/roll-deg") or 0.0;
setprop("/orientation/model/roll-deg", value);
settimer(loop,0);
}
# Fire it up
setlistener("sim/signals/fdm-initialized", initialize);
# end

224
Shaders/bowwave.frag Normal file
View file

@ -0,0 +1,224 @@
// This shader is mostly an adaptation of the shader found at
// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion
// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10
// © Michael Horsch - 2005
#version 120
#define fps2kts 0.5925
uniform sampler2D water_normalmap;
uniform sampler2D water_reflection;
uniform sampler2D water_dudvmap;
uniform sampler2D water_reflection_grey;
uniform sampler2D sea_foam;
uniform sampler2D alpha_tex;
uniform sampler2D bowwave_nmap;
uniform float saturation, Overcast, WindE, WindN, spd, hdg;
uniform float CloudCover0, CloudCover1, CloudCover2, CloudCover3, CloudCover4;
uniform int Status;
varying vec4 waterTex1; //moving texcoords
varying vec4 waterTex2; //moving texcoords
varying vec4 waterTex4; //viewts
varying vec4 ecPosition;
varying vec3 viewerdir;
varying vec3 lightdir;
varying vec3 normal;
////fog "include" /////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
/////// functions /////////
float normalize_range(float _val)
{
if (_val > 180.0)
return _val - 360.0;
else
return _val;
}
void relWind(out float rel_wind_speed_kts, out float rel_wind_from_rad)
{
//calculate the carrier speed north and east in kts
float speed_north_kts = cos(radians(hdg)) * spd ;
float speed_east_kts = sin(radians(hdg)) * spd ;
//calculate the relative wind speed north and east in kts
float rel_wind_speed_from_east_kts = WindE*fps2kts + speed_east_kts;
float rel_wind_speed_from_north_kts = WindN*fps2kts + speed_north_kts;
//combine relative speeds north and east to get relative windspeed in kts
rel_wind_speed_kts = sqrt(pow(abs(rel_wind_speed_from_east_kts), 2)
+ pow(abs(rel_wind_speed_from_north_kts), 2));
//calculate the relative wind direction
float rel_wind_from_deg = degrees(atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts));
// rel_wind_from_rad = atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts);
float rel_wind = rel_wind_from_deg - hdg;
rel_wind = normalize_range(rel_wind);
rel_wind_from_rad = radians(rel_wind);
}
void rotationmatrix(in float angle, out mat4 rotmat)
{
rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0,
sin( angle ), cos( angle ), 0.0, 0.0,
0.0 , 0.0 , 1.0, 0.0,
0.0 , 0.0 , 0.0, 1.0 );
}
//////////////////////
void main(void)
{
const vec4 sca = vec4(0.005, 0.005, 0.005, 0.005);
const vec4 sca2 = vec4(0.02, 0.02, 0.02, 0.02);
const vec4 tscale = vec4(0.25, 0.25, 0.25, 0.25);
mat4 RotationMatrix;
float relWindspd=0;
float relWinddir=0;
// compute relative wind speed and direction
relWind (relWindspd, relWinddir);
rotationmatrix(relWinddir, RotationMatrix);
// compute direction to viewer
vec3 E = normalize(viewerdir);
// compute direction to light source
vec3 L = normalize(lightdir);
// half vector
vec3 H = normalize(L + E);
const float water_shininess = 240.0;
// approximate cloud cover
float cover = 0.0;
//bool Status = true;
float windEffect = relWindspd; //wind speed in kt
// float windEffect = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.6; //wind speed in kt
float windScale = 15.0/(5.0 + windEffect); //wave scale
float waveRoughness = 0.05 + smoothstep(0.0, 50.0, windEffect); //wave roughness filter
if (Status == 1){
cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4);
} else {
// hack to allow for Overcast not to be set by Local Weather
if (Overcast == 0){
cover = 5;
} else {
cover = Overcast * 5;
}
}
vec4 viewt = normalize(waterTex4);
vec4 disdis = texture2D(water_dudvmap, vec2(waterTex2 * tscale)* windScale * 2.0) * 2.0 - 1.0;
vec4 dist = texture2D(water_dudvmap, vec2(waterTex1 + disdis*sca2)* windScale * 2.0) * 2.0 - 1.0;
vec4 fdist = normalize(dist);
fdist = -fdist;
fdist *= sca;
//normalmap
rotationmatrix(-relWinddir, RotationMatrix);
vec4 nmap0 = texture2D(water_normalmap, vec2((waterTex1 + disdis*sca2) * RotationMatrix ) * windScale * 2.0) * 2.0 - 1.0;
vec4 nmap2 = texture2D(water_normalmap, vec2(waterTex2 * tscale * RotationMatrix ) * windScale * 2.0) * 2.0 - 1.0;
vec4 nmap3 = texture2D(bowwave_nmap, gl_TexCoord[0].st) * 2.0 - 1.0;
vec4 vNorm = normalize(mix(nmap3, nmap0 + nmap2, 0.3 )* waveRoughness);
vNorm = -vNorm;
//load reflection
vec4 tmp = vec4(lightdir, 0.0);
vec4 refTex = texture2D(water_reflection, vec2(tmp)) ;
vec4 refTexGrey = texture2D(water_reflection_grey, vec2(tmp)) ;
vec4 refl ;
// cover = 0;
if(cover >= 1.5){
refl= normalize(refTex);
}
else
{
refl = normalize(refTexGrey);
refl.r *= (0.75 + 0.15 * cover);
refl.g *= (0.80 + 0.15 * cover);
refl.b *= (0.875 + 0.125 * cover);
refl.a *= 1.0;
}
vec3 N0 = vec3(texture2D(water_normalmap, vec2((waterTex1 + disdis*sca2)* RotationMatrix) * windScale * 2.0) * 2.0 - 1.0);
vec3 N1 = vec3(texture2D(water_normalmap, vec2(waterTex2 * tscale * RotationMatrix ) * windScale * 2.0) * 2.0 - 1.0);
vec3 N2 = vec3(texture2D(bowwave_nmap, gl_TexCoord[0].st)*2.0-1.0);
//vec3 Nf = normalize((normal+N0+N1)*waveRoughness);
vec3 N = normalize(mix(normal+N2, normal+N0+N1, 0.3)* waveRoughness);
N = -N;
// specular
vec3 specular_color = vec3(gl_LightSource[0].diffuse)
* pow(max(0.0, dot(N, H)), water_shininess) * 6.0;
vec4 specular = vec4(specular_color, 0.5);
specular = specular * saturation * 0.3;
//calculate fresnel
vec4 invfres = vec4( dot(vNorm, viewt) );
vec4 fres = vec4(1.0) + invfres;
refl *= fres;
vec4 alpha0 = texture2D(alpha_tex, gl_TexCoord[0].st);
//refl.a *= alpha0.a;
////calculate the fog factor
//float fogFactor;
//float fogCoord = ecPosition.z;
//const float LOG2 = 1.442695;
//fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
//if(gl_Fog.density == 1.0)
// fogFactor=1.0;
//calculate final colour
vec4 ambient_light = gl_LightSource[0].diffuse;
vec4 finalColor;
// cover = 0;
if(cover >= 1.5){
finalColor = refl + specular;
} else {
finalColor = refl;
}
//add foam
float foamSlope = 0.05 + 0.01 * windScale;
//float waveSlope = mix(N0.g, N1.g, 0.25);
vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 50.0);
float waveSlope = N.g;
if (windEffect >= 12.0)
if (waveSlope >= foamSlope){
finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(foamSlope, 0.5, N.g));
}
//generate final colour
finalColor *= ambient_light+ alpha0 * 0.35;
finalColor.rgb = fog_Func(finalColor.rgb, fogType);
gl_FragColor = vec4(finalColor.rgb, alpha0.a * 1.35);
}

View file

@ -1,12 +1,19 @@
// -*-C++-*- // -*-C++-*-
// Ambient term comes in gl_Color.rgb. // Ambient term comes in gl_Color.rgb.
#version 120
varying vec4 diffuse_term; varying vec4 diffuse_term;
varying vec3 normal; varying vec3 normal;
varying float fogCoord;
uniform sampler2D texture; uniform sampler2D texture;
////fog "include" /////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
float luminance(vec3 color) float luminance(vec3 color)
{ {
return dot(vec3(0.212671, 0.715160, 0.072169), color); return dot(vec3(0.212671, 0.715160, 0.072169), color);
@ -44,6 +51,7 @@ void main()
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);
fragColor = color * texel + specular; fragColor = color * texel + specular;
fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor); fragColor.rgb = fog_Func(fragColor.rgb, fogType);
} gl_FragColor = fragColor;
}

View file

@ -7,7 +7,7 @@
// //
// Diffuse colors come from the gl_Color, ambient from the material. This is // Diffuse colors come from the gl_Color, ambient from the material. This is
// equivalent to osg::Material::DIFFUSE. // equivalent to osg::Material::DIFFUSE.
#version 120
#define MODE_OFF 0 #define MODE_OFF 0
#define MODE_DIFFUSE 1 #define MODE_DIFFUSE 1
#define MODE_AMBIENT_AND_DIFFUSE 2 #define MODE_AMBIENT_AND_DIFFUSE 2
@ -18,12 +18,17 @@
// bugs with gl_FrontFacing in the fragment shader. // bugs with gl_FrontFacing in the fragment shader.
varying vec4 diffuse_term; varying vec4 diffuse_term;
varying vec3 normal; varying vec3 normal;
varying float fogCoord;
uniform int colorMode; uniform int colorMode;
////fog "include"////////
uniform int fogType;
void fog_Func(int type);
/////////////////////////
void main() void main()
{ {
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform(); gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = gl_NormalMatrix * gl_Normal; normal = gl_NormalMatrix * gl_Normal;
@ -51,5 +56,6 @@ void main()
// gl_FrontFacing in the fragment shader. // gl_FrontFacing in the fragment shader.
gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0; gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0;
gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0; gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0;
fogCoord = abs(ecPosition.z / ecPosition.w); //fogCoord = abs(ecPosition.z / ecPosition.w);
fog_Func(fogType);
} }

View file

@ -1,4 +1,5 @@
// -*-C++-*- // -*-C++-*-
// © Vivian Meazza - 2011
// Shader that uses OpenGL state values to do per-pixel lighting // Shader that uses OpenGL state values to do per-pixel lighting
// //
@ -8,6 +9,9 @@
// Diffuse colors come from the gl_Color, ambient from the material. This is // Diffuse colors come from the gl_Color, ambient from the material. This is
// equivalent to osg::Material::DIFFUSE. // equivalent to osg::Material::DIFFUSE.
#version 120
#define fps2kts 0.5925
#define MODE_OFF 0 #define MODE_OFF 0
#define MODE_DIFFUSE 1 #define MODE_DIFFUSE 1
#define MODE_AMBIENT_AND_DIFFUSE 2 #define MODE_AMBIENT_AND_DIFFUSE 2
@ -18,15 +22,69 @@
// bugs with gl_FrontFacing in the fragment shader. // bugs with gl_FrontFacing in the fragment shader.
varying vec4 diffuse_term; varying vec4 diffuse_term;
varying vec3 normal; varying vec3 normal;
varying float fogCoord; //varying float fogCoord;
uniform int colorMode; uniform int colorMode;
uniform float osg_SimulationTime; uniform float osg_SimulationTime;
uniform float WindSpeed, Offset, AmpFactor; uniform float Offset, AmpFactor, WindE, WindN, spd, hdg;
uniform sampler3D Noise; uniform sampler3D Noise;
////fog "include"////////
uniform int fogType;
void fog_Func(int type);
/////////////////////////
/////// functions /////////
float normalize_range(float _val)
{
if (_val > 180.0)
return _val - 360.0;
else
return _val;
}
void relWind(out float rel_wind_speed_kts, out float rel_wind_from_rad)
{
//calculate speed north and east in kts
float speed_north_kts = cos(radians(hdg)) * spd ;
float speed_east_kts = sin(radians(hdg)) * spd ;
//calculate the relative wind speed north and east in kts
float rel_wind_speed_from_east_kts = WindE*fps2kts + speed_east_kts;
float rel_wind_speed_from_north_kts = WindN*fps2kts + speed_north_kts;
//combine relative speeds north and east to get relative windspeed in kts
rel_wind_speed_kts = sqrt(pow(abs(rel_wind_speed_from_east_kts), 2)
+ pow(abs(rel_wind_speed_from_north_kts), 2));
//calculate the relative wind direction
float rel_wind_from_deg = degrees(atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts));
//rel_wind_from_rad = atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts);
float rel_wind = rel_wind_from_deg - hdg;
rel_wind = normalize_range(rel_wind);
rel_wind_from_rad = radians(rel_wind);
}
void rotationmatrix(in float angle, out mat4 rotmat)
{
rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0,
sin( angle ), cos( angle ), 0.0, 0.0,
0.0 , 0.0 , 1.0, 0.0,
0.0 , 0.0 , 0.0, 1.0 );
}
void main() void main()
{ {
mat4 RotationMatrix;
float relWindspd=0;
float relWinddir=0;
// compute relative wind speed and direction
relWind (relWindspd, relWinddir);
// map noise vector // map noise vector
vec4 noisevec = texture3D(Noise, gl_Vertex.xyz); vec4 noisevec = texture3D(Noise, gl_Vertex.xyz);
@ -35,14 +93,18 @@ void main()
vec4 pos = gl_Vertex; vec4 pos = gl_Vertex;
vec4 oldpos = gl_Vertex; vec4 oldpos = gl_Vertex;
float freq = (10 * WindSpeed) + 10; float freq = (10 * relWindspd) + 10;
pos.y = sin((pos.x * 5.0 + tsec * freq )/5.0) * 0.5 ; pos.y = sin((pos.x * 5.0 + tsec * freq )/5.0) * 0.5 ;
pos.y += sin((pos.z * 5.0 + tsec * freq/2)/5.0) * 0.125 ; pos.y += sin((pos.z * 5.0 + tsec * freq/2)/5.0) * 0.125 ;
pos.y *= pow(pos.x - Offset, 2.0) * AmpFactor; pos.y *= pow(pos.x - Offset, 2.0) * AmpFactor;
//rotate the flag to align with relative wind
rotationmatrix(-relWinddir, RotationMatrix);
pos *= RotationMatrix;
gl_Position = gl_ModelViewProjectionMatrix * pos; gl_Position = gl_ModelViewProjectionMatrix * pos;
//do the colour and fog
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
@ -52,28 +114,30 @@ void main()
if (colorMode == MODE_DIFFUSE) { if (colorMode == MODE_DIFFUSE) {
diffuse_color = gl_Color; diffuse_color = gl_Color;
ambient_color = gl_FrontMaterial.ambient; ambient_color = gl_FrontMaterial.ambient;
} else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) {
diffuse_color = gl_Color; diffuse_color = gl_Color;
ambient_color = gl_Color; ambient_color = gl_Color;
} else { } else {
diffuse_color = gl_FrontMaterial.diffuse; diffuse_color = gl_FrontMaterial.diffuse;
ambient_color = gl_FrontMaterial.ambient; ambient_color = gl_FrontMaterial.ambient;
}
diffuse_term = diffuse_color * gl_LightSource[0].diffuse;
vec4 ambient_term = ambient_color * gl_LightSource[0].ambient;
// Super hack: if diffuse material alpha is less than 1, assume a
// transparency animation is at work
if (gl_FrontMaterial.diffuse.a < 1.0)
diffuse_term.a = gl_FrontMaterial.diffuse.a;
else
diffuse_term.a = gl_Color.a;
// Another hack for supporting two-sided lighting without using
// gl_FrontFacing in the fragment shader.
gl_FrontColor.rgb = ambient_term.rgb; gl_FrontColor.a = 0.0;
gl_BackColor.rgb = ambient_term.rgb; gl_FrontColor.a = 1.0;
// fogCoord = abs(ecPosition.z / ecPosition.w);
fog_Func(fogType);
} }
diffuse_term = diffuse_color * gl_LightSource[0].diffuse;
vec4 ambient_term = ambient_color * gl_LightSource[0].ambient;
// Super hack: if diffuse material alpha is less than 1, assume a
// transparency animation is at work
if (gl_FrontMaterial.diffuse.a < 1.0)
diffuse_term.a = gl_FrontMaterial.diffuse.a;
else
diffuse_term.a = gl_Color.a;
// Another hack for supporting two-sided lighting without using
// gl_FrontFacing in the fragment shader.
gl_FrontColor.rgb = ambient_term.rgb; gl_FrontColor.a = 0.0;
gl_BackColor.rgb = ambient_term.rgb; gl_FrontColor.a = 1.0;
fogCoord = abs(ecPosition.z / ecPosition.w);
}

View file

@ -1,4 +1,4 @@
//#define FOG_FUNCTION //#define fog_FuncTION
//default fog //default fog
//varying float fogCoord; //varying float fogCoord;
varying vec3 PointPos; varying vec3 PointPos;

View file

@ -2,7 +2,7 @@
varying vec3 PointPos; varying vec3 PointPos;
//varying vec4 EyePos; //varying vec4 EyePos;
void fog_func(int type) void fog_Func(int type)
{ {
PointPos = (gl_ModelViewMatrix * gl_Vertex).xyz; PointPos = (gl_ModelViewMatrix * gl_Vertex).xyz;
//PointPos = gl_Vertex; //PointPos = gl_Vertex;

View file

@ -31,21 +31,29 @@ attribute vec3 binormal;
uniform float canopy_height; uniform float canopy_height;
void main(void) ////fog "include"////////
{ uniform int fogType;
rawposIn = gl_Vertex;
ecPosIn = gl_ModelViewMatrix * gl_Vertex;
NormalIn = normalize(gl_Normal);
//rawTopIn = rawposIn + vec4(0.0, 0.0, canopy_height, 0.0);
//ecTopIn = gl_ModelViewMatrix * rawTopIn;
ecNormalIn = gl_NormalMatrix * NormalIn;
VTangentIn = gl_NormalMatrix * tangent;
VBinormalIn = gl_NormalMatrix * binormal;
gl_FrontColor = gl_Color; void fog_Func(int type);
gl_Position = ftransform(); /////////////////////////
//positionTopIn = gl_ModelViewProjectionMatrix * rawTopIn;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; void main(void)
constantColorIn = gl_FrontMaterial.emission {
+ gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient); rawposIn = gl_Vertex;
} ecPosIn = gl_ModelViewMatrix * gl_Vertex;
NormalIn = normalize(gl_Normal);
//rawTopIn = rawposIn + vec4(0.0, 0.0, canopy_height, 0.0);
//ecTopIn = gl_ModelViewMatrix * rawTopIn;
ecNormalIn = gl_NormalMatrix * NormalIn;
VTangentIn = gl_NormalMatrix * tangent;
VBinormalIn = gl_NormalMatrix * binormal;
gl_FrontColor = gl_Color;
gl_Position = ftransform();
//positionTopIn = gl_ModelViewProjectionMatrix * rawTopIn;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
constantColorIn = gl_FrontMaterial.emission
+ gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
fog_Func(fogType);
}

View file

@ -18,126 +18,135 @@ uniform float snowlevel; // From /sim/rendering/snow-level-m
const float scale = 1.0; const float scale = 1.0;
int linear_search_steps = 10; int linear_search_steps = 10;
////fog "include" /////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
float ray_intersect(sampler2D reliefMap, vec2 dp, vec2 ds) float ray_intersect(sampler2D reliefMap, vec2 dp, vec2 ds)
{ {
float size = 1.0 / float(linear_search_steps); float size = 1.0 / float(linear_search_steps);
float depth = 0.0; float depth = 0.0;
float best_depth = 1.0; float best_depth = 1.0;
for(int i = 0; i < linear_search_steps - 1; ++i) for(int i = 0; i < linear_search_steps - 1; ++i)
{ {
depth += size; depth += size;
float t = texture2D(reliefMap, dp + ds * depth).a; float t = texture2D(reliefMap, dp + ds * depth).a;
if(best_depth > 0.996) if(best_depth > 0.996)
if(depth >= t) if(depth >= t)
best_depth = depth; best_depth = depth;
} }
depth = best_depth; depth = best_depth;
const int binary_search_steps = 5; const int binary_search_steps = 5;
for(int i = 0; i < binary_search_steps; ++i) for(int i = 0; i < binary_search_steps; ++i)
{ {
size *= 0.5; size *= 0.5;
float t = texture2D(reliefMap, dp + ds * depth).a; float t = texture2D(reliefMap, dp + ds * depth).a;
if(depth >= t) if(depth >= t)
{ {
best_depth = depth; best_depth = depth;
depth -= 2.0 * size; depth -= 2.0 * size;
} }
depth += size; depth += size;
} }
return(best_depth); return(best_depth);
} }
void main (void) void main (void)
{ {
float bump = 1.0; float bump = 1.0;
if ( quality_level >= 3.0 ) { if ( quality_level >= 3.0 ) {
linear_search_steps = 20; linear_search_steps = 20;
} }
vec2 uv, dp = vec2(0, 0), ds = vec2(0, 0); vec2 uv, dp = vec2(0, 0), ds = vec2(0, 0);
vec3 N; vec3 N;
float d = 0; float d = 0;
if ( bump > 0.9 && quality_level >= 2.0 && quality_level < 3.5) if ( bump > 0.9 && quality_level > 2.0 && quality_level <= 4.0)
{ {
vec3 V = normalize(ecPosition.xyz); vec3 V = normalize(ecPosition.xyz);
float a = dot(VNormal, -V); float a = dot(VNormal, -V);
vec2 s = vec2(dot(V, VTangent), dot(V, VBinormal)); vec2 s = vec2(dot(V, VTangent), dot(V, VBinormal));
// prevent a divide by zero // prevent a divide by zero
if (a > -1e-3 && a < 1e-3) a = 1e-3; if (a > -1e-3 && a < 1e-3) a = 1e-3;
s *= depth_factor / a; s *= depth_factor / a;
ds = s; ds = s;
dp = gl_TexCoord[0].st; dp = gl_TexCoord[0].st;
d = ray_intersect(NormalTex, dp, ds); d = ray_intersect(NormalTex, dp, ds);
uv = dp + ds * d; uv = dp + ds * d;
N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0; N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0;
} }
else else
{ {
uv = gl_TexCoord[0].st; uv = gl_TexCoord[0].st;
N = vec3(0.0, 0.0, 1.0); N = vec3(0.0, 0.0, 1.0);
} }
vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale); vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale);
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale); vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale);
float fogFactor; float fogFactor;
float fogCoord = ecPosition.z; float fogCoord = ecPosition.z;
const float LOG2 = 1.442695; const float LOG2 = 1.442695;
fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2); fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
float biasFactor = fogFactor = clamp(fogFactor, 0.0, 1.0); float biasFactor = fogFactor = clamp(fogFactor, 0.0, 1.0);
float n=0.06; float n=0.06;
n += nvL[0]*0.4; n += nvL[0]*0.4;
n += nvL[1]*0.6; n += nvL[1]*0.6;
n += nvL[2]*2.0; n += nvL[2]*2.0;
n += nvL[3]*4.0; n += nvL[3]*4.0;
n += noisevec[0]*0.1; n += noisevec[0]*0.1;
n += noisevec[1]*0.4; n += noisevec[1]*0.4;
n += noisevec[2]*0.8; n += noisevec[2]*0.8;
n += noisevec[3]*2.1; n += noisevec[3]*2.1;
n = mix(0.6, n, biasFactor); n = mix(0.6, n, biasFactor);
// good // good
vec4 c1 = texture2D(BaseTex, uv); vec4 c1 = texture2D(BaseTex, uv);
//brown //brown
//c1 = mix(c1, vec4(n-0.46, n-0.45, n-0.53, 1.0), smoothstep(0.50, 0.55, nvL[2]*6.6)); //c1 = mix(c1, vec4(n-0.46, n-0.45, n-0.53, 1.0), smoothstep(0.50, 0.55, nvL[2]*6.6));
//"steep = gray" //"steep = gray"
c1 = mix(vec4(n-0.30, n-0.29, n-0.37, 1.0), c1, smoothstep(0.970, 0.990, abs(normalize(Normal).z)+nvL[2]*1.3)); c1 = mix(vec4(n-0.30, n-0.29, n-0.37, 1.0), c1, smoothstep(0.970, 0.990, abs(normalize(Normal).z)+nvL[2]*1.3));
//"snow" //"snow"
c1 = mix(c1, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0), smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0)); c1 = mix(c1, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0), smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0));
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal); N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
vec3 l = gl_LightSource[0].position.xyz; vec3 l = gl_LightSource[0].position.xyz;
vec3 diffuse = gl_Color.rgb * max(0.0, dot(N, l)); vec3 diffuse = gl_Color.rgb * max(0.0, dot(N, l));
float shadow_factor = 1.0; float shadow_factor = 1.0;
// Shadow // Shadow
if ( quality_level >= 3.0 ) { if ( quality_level >= 3.0 ) {
dp += ds * d; dp += ds * d;
vec3 sl = normalize( vec3( dot( l, VTangent ), dot( l, VBinormal ), dot( -l, VNormal ) ) ); vec3 sl = normalize( vec3( dot( l, VTangent ), dot( l, VBinormal ), dot( -l, VNormal ) ) );
ds = sl.xy * depth_factor / sl.z; ds = sl.xy * depth_factor / sl.z;
dp -= ds * d; dp -= ds * d;
float dl = ray_intersect(NormalTex, dp, ds); float dl = ray_intersect(NormalTex, dp, ds);
if ( dl < d - 0.05 ) if ( dl < d - 0.05 )
shadow_factor = dot( constantColor.xyz, vec3( 1.0, 1.0, 1.0 ) ) * 0.25; shadow_factor = dot( constantColor.xyz, vec3( 1.0, 1.0, 1.0 ) ) * 0.25;
} }
// end shadow // end shadow
vec4 ambient_light = constantColor + gl_LightSource[0].diffuse * shadow_factor * vec4(diffuse, 1.0); vec4 ambient_light = constantColor + gl_LightSource[0].diffuse * shadow_factor * vec4(diffuse, 1.0);
c1 *= ambient_light; c1 *= ambient_light;
vec4 finalColor = c1; vec4 finalColor = c1;
if(gl_Fog.density == 1.0) //if(gl_Fog.density == 1.0)
fogFactor=1.0; // fogFactor=1.0;
gl_FragColor = mix(gl_Fog.color ,finalColor, fogFactor); // gl_FragColor = mix(gl_Fog.color ,finalColor, fogFactor);
} finalColor.rgb = fog_Func(finalColor.rgb, fogType);
gl_FragColor = finalColor;
}

View file

@ -9,18 +9,27 @@ varying vec4 constantColor;
attribute vec3 tangent; attribute vec3 tangent;
attribute vec3 binormal; attribute vec3 binormal;
void main(void) ////fog "include" /////
{ uniform int fogType;
rawpos = gl_Vertex;
ecPosition = gl_ModelViewMatrix * rawpos;
Normal = normalize(gl_Normal);
VNormal = gl_NormalMatrix * gl_Normal;
VTangent = gl_NormalMatrix * tangent;
VBinormal = gl_NormalMatrix * binormal;
gl_FrontColor = gl_Color; void fog_Func(int type);
constantColor = gl_FrontMaterial.emission
+ gl_FrontColor * (gl_LightModel.ambient + gl_LightSource[0].ambient); //////////////////////
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; void main(void)
} {
rawpos = gl_Vertex;
ecPosition = gl_ModelViewMatrix * rawpos;
Normal = normalize(gl_Normal);
VNormal = gl_NormalMatrix * gl_Normal;
VTangent = gl_NormalMatrix * tangent;
VBinormal = gl_NormalMatrix * binormal;
gl_FrontColor = gl_Color;
constantColor = gl_FrontMaterial.emission
+ gl_FrontColor * (gl_LightModel.ambient + gl_LightSource[0].ambient);
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
fog_Func(fogType);
}

View file

@ -1,6 +1,6 @@
// -*- mode: C; -*- // -*- mode: C; -*-
// Licence: GPL v2 // Licence: GPL v2
// Author: Vivian Meazza. // © Emilian Huminiuc and Vivian Meazza 2011
varying vec3 rawpos; varying vec3 rawpos;
varying float fogCoord; varying float fogCoord;
@ -19,12 +19,19 @@ uniform mat4 osg_ViewMatrixInverse;
attribute vec3 tangent; attribute vec3 tangent;
attribute vec3 binormal; attribute vec3 binormal;
////fog "include"////////
uniform int fogType;
void fog_Func(int type);
/////////////////////////
void main(void) void main(void)
{ {
rawpos = gl_Vertex.xyz / gl_Vertex.w; rawpos = gl_Vertex.xyz / gl_Vertex.w;
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
ecPosition.xyz = ecPosition.xyz / ecPosition.w; ecPosition.xyz = ecPosition.xyz / ecPosition.w;
fogCoord = ecPosition.z; fogCoord = ecPosition.z;
fog_Func(fogType);
vec3 n = normalize(gl_Normal); vec3 n = normalize(gl_Normal);
vec3 t = cross(gl_Normal, vec3(1.0,0.0,0.0)); vec3 t = cross(gl_Normal, vec3(1.0,0.0,0.0));

View file

@ -1,6 +1,6 @@
// -*- mode: C; -*- // -*- mode: C; -*-
// Licence: GPL v2 // Licence: GPL v2
// Author: Vivian Meazza. // © Emilian Huminiuc and Vivian Meazza 2011
#version 120 #version 120
@ -32,7 +32,13 @@ uniform float ambient_correction;
uniform float reflect_map; uniform float reflect_map;
uniform float normalmap_dds; uniform float normalmap_dds;
uniform int fogType; //uniform int fogType;
////fog "include" /////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
vec3 fog_Func(vec3 color, int type); vec3 fog_Func(vec3 color, int type);

View file

@ -1,15 +1,26 @@
// -*-C++-*- // -*-C++-*-
uniform sampler2D texture; uniform sampler2D texture;
////fog "include" /////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
void main() void main()
{ {
vec4 color = vec4(1.0, 1.0, 1.0, 1.0); vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
vec4 texel; vec4 texel;
vec4 fragColor; vec4 fragColor;
vec4 finalColor;
texel = texture2D(texture, gl_TexCoord[0].st); texel = texture2D(texture, gl_TexCoord[0].st);
fragColor = color * texel; fragColor = color * texel;
gl_FragColor = fragColor; gl_FragColor = fragColor;
finalColor.rgb = fog_Func(fragColor.rgb, fogType);
gl_FragColor = finalColor;
} }

View file

@ -1,19 +1,25 @@
// -*-C++-*- // -*-C++-*-
// Texture switching based on face slope and snow level,with ideas from crop.frag, forest.frag // Texture switching based on face slope and snow level
// © 2011 - Frederic Bouvier, Emilian Huminiuc, Tim Moore, Yves Sablonier // based on earlier work by Frederic Bouvier, Tim Moore, and Yves Sablonier.
// © Emilian Huminiuc 2011
// Ambient term comes in gl_Color.rgb. // Ambient term comes in gl_Color.rgb.
#version 120
varying vec4 diffuse_term, RawPos; varying vec4 diffuse_term, RawPos;
varying vec3 Vnormal, normal; varying vec3 Vnormal, normal;
varying float fogCoord; //varying float fogCoord;
uniform float SnowLevel, Transitions, InverseSlope, RainNorm, CloudCover0, CloudCover1, CloudCover2, CloudCover3, CloudCover4; uniform float SnowLevel, Transitions, InverseSlope, RainNorm, CloudCover0, CloudCover1, CloudCover2, CloudCover3, CloudCover4;
uniform sampler2D BaseTex, SecondTex, ThirdTex, SnowTex; uniform sampler2D BaseTex, SecondTex, ThirdTex, SnowTex;
uniform sampler3D NoiseTex; uniform sampler3D NoiseTex;
////fog "include" /////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
void main() void main()
{ {
float MixFactor, NdotL, NdotHV, fogFactor, cover, slope, L1, L2, wetness; float MixFactor, NdotL, NdotHV, fogFactor, cover, slope, L1, L2, wetness;
vec3 n, lightDir, halfVector; vec3 n, lightDir, halfVector;
@ -29,7 +35,7 @@ void main()
Noise = texture3D(NoiseTex, RawPos.xyz*0.0011); Noise = texture3D(NoiseTex, RawPos.xyz*0.0011);
MixFactor = Noise.r * Noise.g * Noise.b; //Mixing Factor to create a more organic looking boundary MixFactor = Noise.r * Noise.g * Noise.b; //Mixing Factor to create a more organic looking boundary
MixFactor *= 300.0; MixFactor *= 300;
MixFactor = clamp(MixFactor, 0.0, 1.0); MixFactor = clamp(MixFactor, 0.0, 1.0);
L1 = 0.90 - 0.02 * MixFactor; //first transition slope L1 = 0.90 - 0.02 * MixFactor; //first transition slope
L2 = 0.78 + 0.04 * MixFactor; //Second transition slope L2 = 0.78 + 0.04 * MixFactor; //Second transition slope
@ -47,7 +53,7 @@ void main()
specular.rgb = (gl_FrontMaterial.specular.rgb specular.rgb = (gl_FrontMaterial.specular.rgb
* gl_LightSource[0].specular.rgb * gl_LightSource[0].specular.rgb
* pow(NdotHV, gl_FrontMaterial.shininess)); * pow(NdotHV, gl_FrontMaterial.shininess));
} }
color.a = diffuse_term.a; color.a = diffuse_term.a;
// This shouldn't be necessary, but our lighting becomes very // This shouldn't be necessary, but our lighting becomes very
@ -63,7 +69,7 @@ void main()
vec4 baseTexel = texture2D(BaseTex, gl_TexCoord[0].st); vec4 baseTexel = texture2D(BaseTex, gl_TexCoord[0].st);
vec4 secondTexel = texture2D(SecondTex, gl_TexCoord[0].st); vec4 secondTexel = texture2D(SecondTex, gl_TexCoord[0].st);
vec4 thirdTexel = texture2D(ThirdTex, gl_TexCoord[0].st); vec4 thirdTexel = texture2D(ThirdTex, gl_TexCoord[0].st);
vec4 snowTexel = texture2D(SnowTex, gl_TexCoord[0].st * 2.0); vec4 snowTexel = texture2D(SnowTex, gl_TexCoord[0].st * 2);
//Normal transition. For more abrupt faces apply another texture (or 2). //Normal transition. For more abrupt faces apply another texture (or 2).
if (InverseSlope == 0.0) { if (InverseSlope == 0.0) {
//Do we do an intermediate transition //Do we do an intermediate transition
@ -71,46 +77,46 @@ void main()
if (slope >= L1) { if (slope >= L1) {
//texel = mix(texture2D(SecondTex, gl_TexCoord[0].st), texture2D(BaseTex, gl_TexCoord[0].st), smoothstep(L1, L1 + 0.03 * MixFactor, slope)); //texel = mix(texture2D(SecondTex, gl_TexCoord[0].st), texture2D(BaseTex, gl_TexCoord[0].st), smoothstep(L1, L1 + 0.03 * MixFactor, slope));
texel = baseTexel; texel = baseTexel;
} }
if (slope >= L2 && slope < L1){ if (slope >= L2 && slope < L1){
texel = mix(secondTexel, baseTexel, smoothstep(L2, L1 - 0.06 * MixFactor, slope)); texel = mix(secondTexel, baseTexel, smoothstep(L2, L1 - 0.06 * MixFactor, slope));
} }
if (slope < L2){ if (slope < L2){
texel = mix(thirdTexel, secondTexel, smoothstep(L2 - 0.13 * MixFactor, L2, slope)); texel = mix(thirdTexel, secondTexel, smoothstep(L2 - 0.13 * MixFactor, L2, slope));
} }
// Just one transition // Just one transition
} else if (Transitions < 1.5) { } else if (Transitions < 1.5) {
if (slope >= L1) { if (slope >= L1) {
texel = baseTexel; texel = baseTexel;
}
if (slope < L1) {
texel = mix(thirdTexel, baseTexel, smoothstep(L2 - 0.13 * MixFactor, L1, slope));
}
} }
if (slope < L1) {
texel = mix(thirdTexel, baseTexel, smoothstep(L2 - 0.13 * MixFactor, L1, slope));
}
}
//Invert the transition: keep original texture on abrupt slopes and switch to another on flatter terrain //Invert the transition: keep original texture on abrupt slopes and switch to another on flatter terrain
} else if (InverseSlope > 0.0) { } else if (InverseSlope > 0.0) {
//Interemdiate transition ? //Interemdiate transition ?
if (Transitions >= 1.5) { if (Transitions >= 1.5) {
if (slope >= L1 + 0.1) { if (slope >= L1 + 0.1) {
texel = thirdTexel; texel = thirdTexel;
} }
if (slope >= L2 && slope < L1 + 0.1){ if (slope >= L2 && slope < L1 + 0.1){
texel = mix(secondTexel, thirdTexel, smoothstep(L2 + 0.06 * MixFactor, L1 + 0.1, slope)); texel = mix(secondTexel, thirdTexel, smoothstep(L2 + 0.06 * MixFactor, L1 + 0.1, slope));
} }
if (slope <= L2){ if (slope <= L2){
texel = mix(baseTexel, secondTexel, smoothstep(L2 - 0.06 * MixFactor, L2, slope)); texel = mix(baseTexel, secondTexel, smoothstep(L2 - 0.06 * MixFactor, L2, slope));
} }
//just one //just one
} else if (Transitions < 1.5) { } else if (Transitions < 1.5) {
if (slope > L1 + 0.1) { if (slope > L1 + 0.1) {
texel = thirdTexel; texel = thirdTexel;
} }
if (slope <= L1 + 0.1){ if (slope <= L1 + 0.1){
texel = mix(baseTexel, thirdTexel, smoothstep(L2 - 0.06 * MixFactor, L1 + 0.1, slope)); texel = mix(baseTexel, thirdTexel, smoothstep(L2 - 0.06 * MixFactor, L1 + 0.1, slope));
} }
}
} }
}
//darken textures with wetness //darken textures with wetness
wetness = 1.0 - 0.3 * RainNorm; wetness = 1.0 - 0.3 * RainNorm;
@ -121,20 +127,19 @@ void main()
//Snow texture for areas higher than SnowLevel //Snow texture for areas higher than SnowLevel
if (RawPos.z >= SnowLevel - (1000.0 * slope + 300 * MixFactor) && slope > L2 - 0.12) { if (RawPos.z >= SnowLevel - (1000.0 * slope + 300 * MixFactor) && slope > L2 - 0.12) {
texel = mix(texel, mix(texel, snowTexel, smoothstep(L2 - 0.09 * MixFactor, L2, slope)), smoothstep(SnowLevel - (1000.0 * slope + 300 * MixFactor), SnowLevel - (1000 * slope - 150 * MixFactor), RawPos.z)); texel = mix(texel, mix(texel, snowTexel, smoothstep(L2 - 0.09 * MixFactor, L2, slope)), smoothstep(SnowLevel - (1000.0 * slope + 300 * MixFactor), SnowLevel - (1000 * slope - 150 * MixFactor), RawPos.z));
} }
fragColor = color * texel + specular; fragColor = color * texel + specular;
if(cover >= 2.5){ if(cover >= 2.5){
fragColor.rgb = fragColor.rgb * 1.2; fragColor.rgb = fragColor.rgb * 1.2;
} else { } else {
fragColor.rg = fragColor.rg * (0.6 + 0.2 * cover); fragColor.rg = fragColor.rg * (0.6 + 0.2 * cover);
fragColor.b = fragColor.b * (0.5 + 0.25 * cover); fragColor.b = fragColor.b * (0.5 + 0.25 * cover);
} }
fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
}
//fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
//gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
gl_FragColor = fragColor;
}

View file

@ -19,13 +19,19 @@
// bugs with gl_FrontFacing in the fragment shader. // bugs with gl_FrontFacing in the fragment shader.
varying vec4 diffuse_term, RawPos; varying vec4 diffuse_term, RawPos;
varying vec3 normal, Vnormal; varying vec3 normal, Vnormal;
varying float fogCoord; //varying float fogCoord;
uniform int colorMode; uniform int colorMode;
////fog "include"////////
uniform int fogType;
void fog_Func(int type);
/////////////////////////
void main() void main()
{ {
RawPos = gl_Vertex; RawPos = gl_Vertex;
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; //vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform(); gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = normalize(gl_Normal); normal = normalize(gl_Normal);
@ -34,25 +40,26 @@ void main()
if (colorMode == MODE_DIFFUSE) { if (colorMode == MODE_DIFFUSE) {
diffuse_color = gl_Color; diffuse_color = gl_Color;
ambient_color = gl_FrontMaterial.ambient; ambient_color = gl_FrontMaterial.ambient;
} else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) {
diffuse_color = gl_Color; diffuse_color = gl_Color;
ambient_color = gl_Color; ambient_color = gl_Color;
} else { } else {
diffuse_color = gl_FrontMaterial.diffuse; diffuse_color = gl_FrontMaterial.diffuse;
ambient_color = gl_FrontMaterial.ambient; ambient_color = gl_FrontMaterial.ambient;
}
diffuse_term = diffuse_color * gl_LightSource[0].diffuse;
vec4 constant_term = gl_FrontMaterial.emission + ambient_color *
(gl_LightModel.ambient + gl_LightSource[0].ambient);
// Super hack: if diffuse material alpha is less than 1, assume a
// transparency animation is at work
if (gl_FrontMaterial.diffuse.a < 1.0)
diffuse_term.a = gl_FrontMaterial.diffuse.a;
else
diffuse_term.a = gl_Color.a;
// Another hack for supporting two-sided lighting without using
// gl_FrontFacing in the fragment shader.
gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0;
gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0;
//fogCoord = abs(ecPosition.z / ecPosition.w);
fog_Func(fogType);
} }
diffuse_term = diffuse_color * gl_LightSource[0].diffuse;
vec4 constant_term = gl_FrontMaterial.emission + ambient_color *
(gl_LightModel.ambient + gl_LightSource[0].ambient);
// Super hack: if diffuse material alpha is less than 1, assume a
// transparency animation is at work
if (gl_FrontMaterial.diffuse.a < 1.0)
diffuse_term.a = gl_FrontMaterial.diffuse.a;
else
diffuse_term.a = gl_Color.a;
// Another hack for supporting two-sided lighting without using
// gl_FrontFacing in the fragment shader.
gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0;
gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0;
fogCoord = abs(ecPosition.z / ecPosition.w);
}

View file

@ -1,9 +1,22 @@
uniform sampler2D baseTexture; #version 120
varying float fogFactor; uniform sampler2D baseTexture;
//varying float fogFactor;
//varying vec4 PointPos;
//varying vec4 EyePos;
void main(void) ////fog "include" /////
{ uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
void main(void)
{
vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); vec4 base = texture2D( baseTexture, gl_TexCoord[0].st);
vec4 finalColor = base * gl_Color; if (base.a <= 0.01)
gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor ); discard;
vec4 fragColor = base * gl_Color;
//gl_FragColor = vec4(mix(gl_Fog.color.rgb, finalColor.rgb, fogFactor ), finalColor.a);
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
gl_FragColor = fragColor;
} }

View file

@ -3,8 +3,15 @@
// normal - x y scaling, z number of varieties // normal - x y scaling, z number of varieties
// fog coord - rotation // fog coord - rotation
// color - xyz of tree quad origin, replicated 4 times. // color - xyz of tree quad origin, replicated 4 times.
#version 120
//varying float fogCoord;
varying vec3 PointPos;
//varying vec4 EyePos;
////fog "include"////////
uniform int fogType;
varying float fogFactor; void fog_Func(int type);
/////////////////////////
void main(void) void main(void)
{ {
@ -30,7 +37,10 @@ void main(void)
vec4 ambientColor = gl_FrontLightModelProduct.sceneColor + gl_LightSource[0].ambient * gl_FrontMaterial.ambient; vec4 ambientColor = gl_FrontLightModelProduct.sceneColor + gl_LightSource[0].ambient * gl_FrontMaterial.ambient;
gl_FrontColor = ambientColor + gl_LightSource[0].diffuse * vec4(diffuse, 1.0); gl_FrontColor = ambientColor + gl_LightSource[0].diffuse * vec4(diffuse, 1.0);
float fogCoord = abs(ecPosition.z); //fogCoord = abs(ecPosition.z);
fogFactor = exp( -gl_Fog.density * gl_Fog.density * fogCoord * fogCoord); //fogFactor = exp( -gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
fogFactor = clamp(fogFactor, 0.0, 1.0); //fogFactor = clamp(fogFactor, 0.0, 1.0);
// fog_Func(fogType);
PointPos = ecPosition;
//EyePos = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0);
} }

161
Shaders/ubershader.frag Normal file
View file

@ -0,0 +1,161 @@
// -*- mode: C; -*-
// Licence: GPL v2
// Authors: Frederic Bouvier and Gijs de Rooy
// with major additions and revisions by
// Emilian Huminiuc and Vivian Meazza 2011
#version 120
varying vec3 rawpos;
varying vec3 VNormal;
varying vec3 VTangent;
varying vec3 VBinormal;
varying vec3 vViewVec;
varying vec3 reflVec;
varying float alpha;
uniform samplerCube Environment;
uniform sampler2D BaseTex;
uniform sampler2D NormalTex;
uniform sampler2D LightMapTex;
uniform sampler2D ReflMapTex;
uniform sampler2D ReflFresnelTex;
uniform sampler2D ReflRainbowTex;
uniform sampler3D ReflNoiseTex;
uniform int nmap_enabled;
uniform int nmap_dds;
uniform int refl_enabled;
uniform int refl_map;
uniform int lightmap_enabled;
uniform int lightmap_multi;
uniform int shader_qual;
uniform float lightmap_r_factor;
uniform float lightmap_g_factor;
uniform float lightmap_b_factor;
uniform float lightmap_a_factor;
uniform float refl_correction;
uniform float refl_fresnel;
uniform float refl_rainbow;
uniform float refl_noise;
uniform float amb_correction;
uniform vec3 lightmap_r_color;
uniform vec3 lightmap_g_color;
uniform vec3 lightmap_b_color;
uniform vec3 lightmap_a_color;
///fog include//////////////////////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
////////////////////////////////////
void main (void)
{
vec4 texel = texture2D(BaseTex, gl_TexCoord[0].st);
vec4 nmap = texture2D(NormalTex, gl_TexCoord[0].st);
vec4 reflmap = texture2D(ReflMapTex, gl_TexCoord[0].st);
vec4 noisevec = texture3D(ReflNoiseTex, rawpos.xyz);
vec4 reflection = textureCube(Environment, reflVec);
vec4 lightmapTexel = texture2D(LightMapTex, gl_TexCoord[0].st);
vec3 mixedcolor;
vec3 N;
float pf;
///BEGIN bump
if (nmap_enabled > 0 && shader_qual > 1){
N = nmap.rgb * 2.0 - 1.0;
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
if (nmap_dds > 0)
N = -N;
} else {
N = normalize(VNormal);
}
///END bump
vec3 viewVec = normalize(vViewVec);
float v = dot(viewVec, normalize(VNormal));// Map a rainbowish color
vec4 fresnel = texture2D(ReflFresnelTex, vec2(v, 0.0));
vec4 rainbow = texture2D(ReflRainbowTex, vec2(v, 0.0));
float nDotVP = max(0.0, dot(N, normalize(gl_LightSource[0].position.xyz)));
float nDotHV = max(0.0, dot(N, normalize(gl_LightSource[0].halfVector.xyz)));
if (nDotVP == 0.0)
pf = 0.0;
else
pf = pow(nDotHV, gl_FrontMaterial.shininess);
vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP;
vec4 Specular = gl_FrontMaterial.specular * gl_LightSource[0].specular * pf;
vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse;
color += Specular * gl_FrontMaterial.specular * nmap.a;
color = clamp( color, 0.0, 1.0 );
//////////////////////////////////////////////////////////////////////
//BEGIN reflect
//////////////////////////////////////////////////////////////////////
if (refl_enabled > 0 && shader_qual > 0){
float reflFactor;
float transparency_offset = clamp(refl_correction, -1.0, 1.0);// set the user shininess offset
if(refl_map > 0){
// map the shininess of the object with user input
//float pam = (map.a * -2) + 1; //reverse map
reflFactor = reflmap.a + transparency_offset;
} else if (nmap_enabled > 0 && shader_qual > 1) {
// set the reflectivity proportional to shininess with user input
reflFactor = (gl_FrontMaterial.shininess / 128.0) * nmap.a + transparency_offset;
} else {
reflFactor = gl_FrontMaterial.shininess/128.0 + transparency_offset;
}
reflFactor = clamp(reflFactor, 0.0, 1.0);
// add fringing fresnel and rainbow effects and modulate by reflection
vec4 reflcolor = mix(reflection, rainbow, refl_rainbow * v);
reflcolor += Specular * nmap.a;
vec4 reflfrescolor = mix(reflcolor, fresnel, refl_fresnel * v);
vec4 noisecolor = mix(reflfrescolor, noisevec, refl_noise);
vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0);
raincolor += Specular * nmap.a;
mixedcolor = mix(texel, raincolor, reflFactor).rgb;
} else {
mixedcolor = texel.rgb;
}
///////////////////////////////////////////////////////////////////////
//END reflect
///////////////////////////////////////////////////////////////////////
// set ambient adjustment to remove bluiness with user input
float ambient_offset = clamp(amb_correction, -1.0, 1.0);
vec4 ambient_Correction = vec4(gl_LightSource[0].ambient.rg, gl_LightSource[0].ambient.b * 0.6, 0.5) * ambient_offset ;
ambient_Correction = clamp(ambient_Correction, -1.0, 1.0);
color.a = texel.a * alpha;
vec4 fragColor = vec4(color.rgb * mixedcolor + ambient_Correction.rgb, color.a);
fragColor += Specular * nmap.a;
//////////////////////////////////////////////////////////////////////
// BEGIN lightmap
//////////////////////////////////////////////////////////////////////
if ( lightmap_enabled >= 1 ) {
vec3 lightmapcolor;
if (lightmap_multi >0 ){
lightmapcolor = lightmap_r_color * lightmap_r_factor * lightmapTexel.r +
lightmap_g_color * lightmap_g_factor * lightmapTexel.g +
lightmap_b_color * lightmap_b_factor * lightmapTexel.b +
lightmap_a_color * lightmap_a_factor * lightmapTexel.a ;
} else {
lightmapcolor = lightmapTexel.rgb * lightmap_r_color * lightmap_r_factor;
}
fragColor.rgb = max(fragColor.rgb, lightmapcolor * gl_FrontMaterial.diffuse.rgb * mixedcolor);
}
//////////////////////////////////////////////////////////////////////
// END lightmap
/////////////////////////////////////////////////////////////////////
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
gl_FragColor = fragColor;
}

108
Shaders/ubershader.vert Normal file
View file

@ -0,0 +1,108 @@
// -*- mode: C; -*-
// Licence: GPL v2
// © Emilian Huminiuc and Vivian Meazza 2011
#version 120
varying vec3 rawpos;
varying vec3 VNormal;
varying vec3 VTangent;
varying vec3 VBinormal;
varying vec3 vViewVec;
varying vec3 reflVec;
varying float alpha;
attribute vec3 tangent;
attribute vec3 binormal;
uniform float pitch;
uniform float roll;
uniform float hdg;
uniform int refl_dynamic;
uniform int nmap_enabled;
uniform int shader_qual;
//////Fog Include///////////
uniform int fogType;
void fog_Func(int type);
////////////////////////////
void rotationMatrixPR(in float sinRx, in float cosRx, in float sinRy, in float cosRy, out mat4 rotmat)
{
rotmat = mat4( cosRy , sinRx * sinRy, cosRx * sinRy , 0.0,
0.0 , cosRx , -sinRx * cosRx, 0.0,
-sinRy, sinRx * cosRy, cosRx * cosRy , 0.0,
0.0 , 0.0 , 0.0 , 1.0 );
}
void rotationMatrixH(in float sinRz, in float cosRz, out mat4 rotmat)
{
rotmat = mat4( cosRz, -sinRz, 0.0, 0.0,
sinRz, cosRz , 0.0, 0.0,
0.0 , 0.0 , 1.0, 0.0,
0.0 , 0.0 , 0.0, 1.0 );
}
void main(void)
{
rawpos = gl_Vertex.xyz;
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
fog_Func(fogType);
VNormal = normalize(gl_NormalMatrix * gl_Normal);
if (nmap_enabled > 0 && shader_qual > 1){
VTangent = normalize(gl_NormalMatrix * tangent);
VBinormal = normalize(gl_NormalMatrix * binormal);
} else {
VTangent = vec3(0.0);
VBinormal = vec3 (0.0);
}
vec3 n = normalize(gl_Normal);
vec3 t = cross(n, vec3(1.0,0.0,0.0));
vec3 b = cross(n,t);
// Super hack: if diffuse material alpha is less than 1, assume a
// transparency animation is at work
if (gl_FrontMaterial.diffuse.a < 1.0)
alpha = gl_FrontMaterial.diffuse.a;
else
alpha = gl_Color.a;
// Vertex in eye coordinates
vec3 vertVec = ecPosition.xyz;
vViewVec.x = dot(t, vertVec);
vViewVec.y = dot(b, vertVec);
vViewVec.z = dot(n, vertVec);
// calculate the reflection vector
vec4 reflect_eye = vec4(reflect(vertVec, VNormal), 0.0);
vec3 reflVec_stat = normalize(gl_ModelViewMatrixInverse * reflect_eye).xyz;
if (refl_dynamic > 0){
//prepare rotation matrix
mat4 RotMatPR;
mat4 RotMatH;
float _roll = roll;
if (_roll>90.0 || _roll < -90.0)
{
_roll = -_roll;
}
float cosRx = cos(radians(_roll));
float sinRx = sin(radians(_roll));
float cosRy = cos(radians(-pitch));
float sinRy = sin(radians(-pitch));
float cosRz = cos(radians(hdg));
float sinRz = sin(radians(hdg));
rotationMatrixPR(sinRx, cosRx, sinRy, cosRy, RotMatPR);
rotationMatrixH(sinRz, cosRz, RotMatH);
vec3 reflVec_dyn = (RotMatH * (RotMatPR * normalize(gl_ModelViewMatrixInverse * reflect_eye))).xyz;
reflVec = reflVec_dyn;
} else {
reflVec = reflVec_stat;
}
gl_FrontColor = gl_FrontMaterial.emission + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}

View file

@ -33,82 +33,88 @@ int linear_search_steps = 10;
int GlobalIterationCount = 0; int GlobalIterationCount = 0;
int gIterationCap = 64; int gIterationCap = 64;
////fog "include" /////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
void QDM(inout vec3 p, inout vec3 v) void QDM(inout vec3 p, inout vec3 v)
{ {
const int MAX_LEVEL = TEXTURE_MIP_LEVELS; const int MAX_LEVEL = TEXTURE_MIP_LEVELS;
const float NODE_COUNT = TEXTURE_PIX_COUNT; const float NODE_COUNT = TEXTURE_PIX_COUNT;
const float TEXEL_SPAN_HALF = 1.0 / NODE_COUNT / 2.0; const float TEXEL_SPAN_HALF = 1.0 / NODE_COUNT / 2.0;
float fDeltaNC = TEXEL_SPAN_HALF * depth_factor; float fDeltaNC = TEXEL_SPAN_HALF * depth_factor;
vec3 p2 = p; vec3 p2 = p;
float level = MAX_LEVEL; float level = MAX_LEVEL;
vec2 dirSign = (sign(v.xy) + 1.0) * 0.5; vec2 dirSign = (sign(v.xy) + 1.0) * 0.5;
GlobalIterationCount = 0; GlobalIterationCount = 0;
float d = 0.0; float d = 0.0;
while (level >= 0.0 && GlobalIterationCount < gIterationCap) while (level >= 0.0 && GlobalIterationCount < gIterationCap)
{ {
vec4 uv = vec4(p2.xyz, level); vec4 uv = vec4(p2.xyz, level);
d = texture2DLod(QDMTex, uv.xy, uv.w).w; d = texture2DLod(QDMTex, uv.xy, uv.w).w;
if (d > p2.z) if (d > p2.z)
{ {
//predictive point of ray traversal //predictive point of ray traversal
vec3 tmpP2 = p + v * d; vec3 tmpP2 = p + v * d;
//current node count //current node count
float nodeCount = pow(2.0, (MAX_LEVEL - level)); float nodeCount = pow(2.0, (MAX_LEVEL - level));
//current and predictive node ID //current and predictive node ID
vec4 nodeID = floor(vec4(p2.xy, tmpP2.xy)*nodeCount); vec4 nodeID = floor(vec4(p2.xy, tmpP2.xy)*nodeCount);
//check if we are crossing the current cell //check if we are crossing the current cell
if (nodeID.x != nodeID.z || nodeID.y != nodeID.w) if (nodeID.x != nodeID.z || nodeID.y != nodeID.w)
{ {
//calculate distance to nearest bound //calculate distance to nearest bound
vec2 a = p2.xy - p.xy; vec2 a = p2.xy - p.xy;
vec2 p3 = (nodeID.xy + dirSign) / nodeCount; vec2 p3 = (nodeID.xy + dirSign) / nodeCount;
vec2 b = p3.xy - p.xy; vec2 b = p3.xy - p.xy;
vec2 dNC = (b.xy * p2.z) / a.xy; vec2 dNC = (b.xy * p2.z) / a.xy;
//take the nearest cell //take the nearest cell
d = min(d,min(dNC.x, dNC.y))+fDeltaNC; d = min(d,min(dNC.x, dNC.y))+fDeltaNC;
level++; level++;
//use additional convergence speed-up //use additional convergence speed-up
#ifdef USE_QDM_ASCEND_INTERVAL #ifdef USE_QDM_ASCEND_INTERVAL
if(frac(level*0.5) > EPSILON) if(frac(level*0.5) > EPSILON)
level++; level++;
#elseif USE_QDM_ASCEND_CONST #elseif USE_QDM_ASCEND_CONST
level++; level++;
#endif #endif
} }
p2 = p + v * d; p2 = p + v * d;
} }
level--; level--;
GlobalIterationCount++; GlobalIterationCount++;
} }
// //
// Manual Bilinear filtering // Manual Bilinear filtering
// //
float rayLength = length(p2.xy - p.xy) + fDeltaNC; float rayLength = length(p2.xy - p.xy) + fDeltaNC;
float dA = p2.z * (rayLength - BILINEAR_SMOOTH_FACTOR * TEXEL_SPAN_HALF) / rayLength; float dA = p2.z * (rayLength - BILINEAR_SMOOTH_FACTOR * TEXEL_SPAN_HALF) / rayLength;
float dB = p2.z * (rayLength + BILINEAR_SMOOTH_FACTOR * TEXEL_SPAN_HALF) / rayLength; float dB = p2.z * (rayLength + BILINEAR_SMOOTH_FACTOR * TEXEL_SPAN_HALF) / rayLength;
vec4 p2a = vec4(p + v * dA, 0.0); vec4 p2a = vec4(p + v * dA, 0.0);
vec4 p2b = vec4(p + v * dB, 0.0); vec4 p2b = vec4(p + v * dB, 0.0);
dA = texture2DLod(NormalTex, p2a.xy, p2a.w).w; dA = texture2DLod(NormalTex, p2a.xy, p2a.w).w;
dB = texture2DLod(NormalTex, p2b.xy, p2b.w).w; dB = texture2DLod(NormalTex, p2b.xy, p2b.w).w;
dA = abs(p2a.z - dA); dA = abs(p2a.z - dA);
dB = abs(p2b.z - dB); dB = abs(p2b.z - dB);
p2 = mix(p2a.xyz, p2b.xyz, dA / (dA + dB)); p2 = mix(p2a.xyz, p2b.xyz, dA / (dA + dB));
p = p2; p = p2;
} }
float ray_intersect_QDM(vec2 dp, vec2 ds) float ray_intersect_QDM(vec2 dp, vec2 ds)
@ -121,35 +127,35 @@ float ray_intersect_QDM(vec2 dp, vec2 ds)
float ray_intersect_relief(vec2 dp, vec2 ds) float ray_intersect_relief(vec2 dp, vec2 ds)
{ {
float size = 1.0 / float(linear_search_steps); float size = 1.0 / float(linear_search_steps);
float depth = 0.0; float depth = 0.0;
float best_depth = 1.0; float best_depth = 1.0;
for(int i = 0; i < linear_search_steps - 1; ++i) for(int i = 0; i < linear_search_steps - 1; ++i)
{ {
depth += size; depth += size;
float t = step(0.95, texture2D(NormalTex, dp + ds * depth).a); float t = step(0.95, texture2D(NormalTex, dp + ds * depth).a);
if(best_depth > 0.996) if(best_depth > 0.996)
if(depth >= t) if(depth >= t)
best_depth = depth; best_depth = depth;
} }
depth = best_depth; depth = best_depth;
const int binary_search_steps = 5; const int binary_search_steps = 5;
for(int i = 0; i < binary_search_steps; ++i) for(int i = 0; i < binary_search_steps; ++i)
{ {
size *= 0.5; size *= 0.5;
float t = step(0.95, texture2D(NormalTex, dp + ds * depth).a); float t = step(0.95, texture2D(NormalTex, dp + ds * depth).a);
if(depth >= t) if(depth >= t)
{ {
best_depth = depth; best_depth = depth;
depth -= 2.0 * size; depth -= 2.0 * size;
} }
depth += size; depth += size;
} }
return(best_depth); return(best_depth);
} }
float ray_intersect(vec2 dp, vec2 ds) float ray_intersect(vec2 dp, vec2 ds)
@ -162,82 +168,76 @@ float ray_intersect(vec2 dp, vec2 ds)
void main (void) void main (void)
{ {
if ( quality_level >= 3.5 ) { if ( quality_level >= 3.5 ) {
linear_search_steps = 20; linear_search_steps = 20;
} }
vec3 ecPos3 = ecPosition.xyz / ecPosition.w; vec3 ecPos3 = ecPosition.xyz / ecPosition.w;
vec3 V = normalize(ecPos3); vec3 V = normalize(ecPos3);
vec3 s = vec3(dot(V, VTangent), dot(V, VBinormal), dot(VNormal, -V)); vec3 s = vec3(dot(V, VTangent), dot(V, VBinormal), dot(VNormal, -V));
vec2 ds = s.xy * depth_factor / s.z; vec2 ds = s.xy * depth_factor / s.z;
vec2 dp = gl_TexCoord[0].st - ds; vec2 dp = gl_TexCoord[0].st - ds;
float d = ray_intersect(dp, ds); float d = ray_intersect(dp, ds);
vec2 uv = dp + ds * d; vec2 uv = dp + ds * d;
vec3 N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0; vec3 N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0;
float emis = N.z; float emis = N.z;
N.z = sqrt(1.0 - min(1.0,dot(N.xy, N.xy))); N.z = sqrt(1.0 - min(1.0,dot(N.xy, N.xy)));
float Nz = N.z; float Nz = N.z;
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal); N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
vec3 l = gl_LightSource[0].position.xyz; vec3 l = gl_LightSource[0].position.xyz;
vec3 diffuse = gl_Color.rgb * max(0.0, dot(N, l)); vec3 diffuse = gl_Color.rgb * max(0.0, dot(N, l));
float shadow_factor = 1.0; float shadow_factor = 1.0;
// Shadow // Shadow
if ( quality_level >= 3.0 ) { if ( quality_level >= 3.0 ) {
dp += ds * d; dp += ds * d;
vec3 sl = normalize( vec3( dot( l, VTangent ), dot( l, VBinormal ), dot( -l, VNormal ) ) ); vec3 sl = normalize( vec3( dot( l, VTangent ), dot( l, VBinormal ), dot( -l, VNormal ) ) );
ds = sl.xy * depth_factor / sl.z; ds = sl.xy * depth_factor / sl.z;
dp -= ds * d; dp -= ds * d;
float dl = ray_intersect(dp, ds); float dl = ray_intersect(dp, ds);
if ( dl < d - 0.05 ) if ( dl < d - 0.05 )
shadow_factor = dot( constantColor.xyz, vec3( 1.0, 1.0, 1.0 ) ) * 0.25; shadow_factor = dot( constantColor.xyz, vec3( 1.0, 1.0, 1.0 ) ) * 0.25;
} }
// end shadow // end shadow
vec4 ambient_light = constantColor + gl_LightSource[0].diffuse * vec4(diffuse, 1.0); vec4 ambient_light = constantColor + gl_LightSource[0].diffuse * vec4(diffuse, 1.0);
float reflectance = ambient_light.r * 0.3 + ambient_light.g * 0.59 + ambient_light.b * 0.11; float reflectance = ambient_light.r * 0.3 + ambient_light.g * 0.59 + ambient_light.b * 0.11;
if ( shadow_factor < 1.0 ) if ( shadow_factor < 1.0 )
ambient_light = constantColor + gl_LightSource[0].diffuse * shadow_factor * vec4(diffuse, 1.0); ambient_light = constantColor + gl_LightSource[0].diffuse * shadow_factor * vec4(diffuse, 1.0);
float emission_factor = (1.0 - smoothstep(0.15, 0.25, reflectance)) * emis; float emission_factor = (1.0 - smoothstep(0.15, 0.25, reflectance)) * emis;
vec4 tc = texture2D(BaseTex, uv); vec4 tc = texture2D(BaseTex, uv);
emission_factor *= 0.5*pow(tc.r+0.8*tc.g+0.2*tc.b, 2.0) -0.2; emission_factor *= 0.5*pow(tc.r+0.8*tc.g+0.2*tc.b, 2.0) -0.2;
ambient_light += (emission_factor * vec4(night_color, 0.0)); ambient_light += (emission_factor * vec4(night_color, 0.0));
float fogFactor; vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale);
float fogCoord = ecPos3.z / (1.0 + smoothstep(0.3, 0.7, emission_factor)); vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale);
const float LOG2 = 1.442695;
fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
fogFactor = clamp(fogFactor, 0.0, 1.0);
vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale); float n=0.06;
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale); n += nvL[0]*0.4;
n += nvL[1]*0.6;
n += nvL[2]*2.0;
n += nvL[3]*4.0;
n += noisevec[0]*0.1;
n += noisevec[1]*0.4;
float n=0.06; n += noisevec[2]*0.8;
n += nvL[0]*0.4; n += noisevec[3]*2.1;
n += nvL[1]*0.6; n = mix(0.6, n, length(ecPosition.xyz) );
n += nvL[2]*2.0;
n += nvL[3]*4.0;
n += noisevec[0]*0.1;
n += noisevec[1]*0.4;
n += noisevec[2]*0.8; vec4 finalColor = texture2D(BaseTex, uv);
n += noisevec[3]*2.1; finalColor = mix(finalColor, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0),
n = mix(0.6, n, fogFactor); step(0.8,Nz)*(1.0-emis)*smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0));
finalColor *= ambient_light;
vec4 finalColor = texture2D(BaseTex, uv); vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depth_factor / s.z, 1.0 );
finalColor = mix(finalColor, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0), vec4 iproj = gl_ProjectionMatrix * p;
step(0.8,Nz)*(1.0-emis)*smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0)); iproj /= iproj.w;
finalColor *= ambient_light;
if (gl_Fog.density == 1.0) finalColor.rgb = fog_Func(finalColor.rgb, fogType);
fogFactor=1.0; gl_FragColor = finalColor;
vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depth_factor / s.z, 1.0 ); gl_FragDepth = (iproj.z+1.0)/2.0;
vec4 iproj = gl_ProjectionMatrix * p;
iproj /= iproj.w;
gl_FragColor = mix(gl_Fog.color ,finalColor, fogFactor);
gl_FragDepth = (iproj.z+1.0)/2.0;
} }

View file

@ -12,6 +12,12 @@ varying vec4 constantColor;
attribute vec3 tangent, binormal; attribute vec3 tangent, binormal;
////fog "include"////////
uniform int fogType;
void fog_Func(int type);
/////////////////////////
void main(void) void main(void)
{ {
rawpos = gl_Vertex; rawpos = gl_Vertex;
@ -25,4 +31,5 @@ void main(void)
+ gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient); + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
gl_Position = ftransform(); gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
fog_Func(fogType);
} }

77
Shaders/wake.vert Normal file
View file

@ -0,0 +1,77 @@
// This shader is mostly an adaptation of the shader found at
// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion
// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10
// © Michael Horsch - 2005
#version 120
#define fps2kts 0.5925
varying vec4 waterTex1;
varying vec4 waterTex2;
varying vec4 waterTex4;
varying vec4 ecPosition;
varying vec3 viewerdir;
varying vec3 lightdir;
varying vec3 normal;
uniform float osg_SimulationTime;
uniform float WindE, WindN, spd, hdg;
////fog "include"////////
uniform int fogType;
void fog_Func(int type);
/////////////////////////
/////// functions /////////
void relWind(out float rel_wind_speed_kts, float rel_wind_from_deg)
{
//calculate the carrier speed north and east in kts
float speed_north_kts = cos(radians(hdg)) * spd ;
float speed_east_kts = sin(radians(hdg)) * spd ;
//calculate the relative wind speed north and east in kts
float rel_wind_speed_from_east_kts = WindE*fps2kts + speed_east_kts;
float rel_wind_speed_from_north_kts = WindN*fps2kts + speed_north_kts;
//combine relative speeds north and east to get relative windspeed in kts
rel_wind_speed_kts = sqrt((rel_wind_speed_from_east_kts * rel_wind_speed_from_east_kts) + (rel_wind_speed_from_north_kts * rel_wind_speed_from_north_kts));
//calculate the relative wind direction
rel_wind_from_deg = degrees(atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts));
}
void main(void)
{
float relWindspd=0;
float relWinddir=0;
//compute relative wind speed and direction
relWind (relWindspd, relWinddir);
vec3 N = normalize(gl_Normal);
normal = N;
ecPosition = gl_ModelViewMatrix * gl_Vertex;
viewerdir = vec3(gl_ModelViewMatrixInverse[3]) - vec3(gl_Vertex);
lightdir = normalize(vec3(gl_ModelViewMatrixInverse * gl_LightSource[0].position));
waterTex4 = vec4( ecPosition.xzy, 0.0 );
vec4 t1 = vec4(osg_SimulationTime*0.005217, 0.0, 0.0, 0.0);
vec4 t2 = vec4(osg_SimulationTime*-0.0012, 0.0, 0.0, 0.0);
float windFactor = -relWindspd * 0.1;
// float windFactor = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.6;
waterTex1 = gl_MultiTexCoord0 + t1 * windFactor;
waterTex2 = gl_MultiTexCoord0 + t2 * windFactor;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_Position = ftransform();
fog_Func(fogType);
}

View file

@ -1,185 +1,221 @@
// This shader is mostly an adaptation of the shader found at // This shader is mostly an adaptation of the shader found at
// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion // http://www.bonzaisoftware.com/water_tut.html and its glsl conversion
// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10 // available at http://forum.bonzaisoftware.com/viewthread.php?tid=10
// © Michael Horsch - 2005 // © Michael Horsch - 2005
// Major update and revisions - 2011-10-07 // Major update and revisions - 2011-10-07
// © Emilian Huminiuc and Vivian Meazza // © Emilian Huminiuc and Vivian Meazza
#version 120 #version 120
uniform sampler2D water_normalmap; uniform sampler2D water_normalmap;
uniform sampler2D water_reflection; uniform sampler2D water_reflection;
uniform sampler2D water_dudvmap; uniform sampler2D water_dudvmap;
uniform sampler2D water_reflection_grey; uniform sampler2D water_reflection_grey;
uniform sampler2D sea_foam; uniform sampler2D sea_foam;
uniform sampler2D perlin_normalmap; uniform sampler2D perlin_normalmap;
uniform float saturation, Overcast, WindE, WindN; uniform sampler3D Noise;
uniform float CloudCover0, CloudCover1, CloudCover2, CloudCover3, CloudCover4;
uniform float osg_SimulationTime; uniform float saturation, Overcast, WindE, WindN;
uniform int Status; uniform float CloudCover0, CloudCover1, CloudCover2, CloudCover3, CloudCover4;
uniform float osg_SimulationTime;
varying vec4 waterTex1; //moving texcoords uniform int Status;
varying vec4 waterTex2; //moving texcoords
varying vec4 waterTex4; //viewts varying vec4 waterTex1; //moving texcoords
varying vec4 ecPosition; varying vec4 waterTex2; //moving texcoords
varying vec3 viewerdir; varying vec4 waterTex4; //viewts
varying vec3 lightdir; varying vec4 ecPosition;
varying vec3 normal; varying vec3 viewerdir;
varying vec3 lightdir;
/////// functions ///////// varying vec3 normal;
void rotationmatrix(in float angle, out mat4 rotmat) uniform float WaveFreq ;
{ uniform float WaveAmp ;
rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, uniform float WaveSharp ;
sin( angle ), cos( angle ), 0.0, 0.0,
0.0 , 0.0 , 1.0, 0.0, ////fog "include" /////
0.0 , 0.0 , 0.0, 1.0 ); uniform int fogType;
}
vec3 fog_Func(vec3 color, int type);
void main(void) //////////////////////
{
const vec4 sca = vec4(0.005, 0.005, 0.005, 0.005); /////// functions /////////
const vec4 sca2 = vec4(0.02, 0.02, 0.02, 0.02);
const vec4 tscale = vec4(0.25, 0.25, 0.25, 0.25); void rotationmatrix(in float angle, out mat4 rotmat)
{
mat4 RotationMatrix; rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0,
// compute direction to viewer sin( angle ), cos( angle ), 0.0, 0.0,
vec3 E = normalize(viewerdir); 0.0 , 0.0 , 1.0, 0.0,
0.0 , 0.0 , 0.0, 1.0 );
// compute direction to light source }
vec3 L = normalize(lightdir);
void main(void)
// half vector {
vec3 H = normalize(L + E); const vec4 sca = vec4(0.005, 0.005, 0.005, 0.005);
const vec4 sca2 = vec4(0.02, 0.02, 0.02, 0.02);
vec3 Normal = normalize(normal); const vec4 tscale = vec4(0.25, 0.25, 0.25, 0.25);
const float water_shininess = 240.0; mat4 RotationMatrix;
// compute direction to viewer
// approximate cloud cover vec3 E = normalize(viewerdir);
float cover = 0.0;
//bool Status = true; // compute direction to light source
vec3 L = normalize(lightdir);
float windEffect = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.6; //wind speed in kt
float windScale = 15.0/(3.0 + windEffect); //wave scale // half vector
float windEffect_low = 0.4 + 0.6 * smoothstep(0.0, 5.0, windEffect); //low windspeed wave filter vec3 H = normalize(L + E);
float waveRoughness = 0.15 + smoothstep(0.0, 15.0, windEffect); //wave roughness filter
vec3 Normal = normalize(normal);
//float noise_factor = 0.2 + 0.15 * smoothstep(0.0, 40.0, windEffect);
const float water_shininess = 240.0;
if (Status == 1){
cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4); // approximate cloud cover
} else { float cover = 0.0;
// hack to allow for Overcast not to be set by Local Weather //bool Status = true;
if (Overcast == 0){
cover = 5;
} else { float windEffect = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.6; //wind speed in kt
cover = Overcast * 5; float windScale = 15.0/(3.0 + windEffect); //wave scale
} float windEffect_low = 0.3 + 0.7 * smoothstep(0.0, 5.0, windEffect); //low windspeed wave filter
} float waveRoughness = 0.05 + smoothstep(0.0, 20.0, windEffect); //wave roughness filter
vec4 viewt = normalize(waterTex4); float mixFactor = 0.75 - 0.15 * smoothstep(0.0, 40.0, windEffect);
mixFactor = clamp(mixFactor, 0.3, 0.8);
vec4 disdis = texture2D(water_dudvmap, vec2(waterTex2 * tscale)* windScale) * 2.0 - 1.0;
if (Status == 1){
vec4 dist = texture2D(water_dudvmap, vec2(waterTex1 + disdis*sca2)* windScale) * 2.0 - 1.0; cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4);
dist *= (0.6 + 0.5 * smoothstep(0.0, 15.0, windEffect)); } else {
vec4 fdist = normalize(dist); // hack to allow for Overcast not to be set by Local Weather
fdist = -fdist; //dds fix if (Overcast == 0){
fdist *= sca; cover = 5;
} else {
//normalmaps cover = Overcast * 5;
vec4 nmap = texture2D(water_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0; }
vec4 nmap1 = texture2D(perlin_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0; }
rotationmatrix(radians(3.0 * sin(osg_SimulationTime * 0.0075)), RotationMatrix); vec4 viewt = normalize(waterTex4);
nmap += texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix * tscale) * windScale) * 2.0 - 1.0;
nmap1 += texture2D(perlin_normalmap, vec2(waterTex2 * RotationMatrix * tscale) * windScale) * 2.0 - 1.0; vec4 disdis = texture2D(water_dudvmap, vec2(waterTex2 * tscale)* windScale) * 2.0 - 1.0;
nmap *= windEffect_low; vec4 dist = texture2D(water_dudvmap, vec2(waterTex1 + disdis*sca2)* windScale) * 2.0 - 1.0;
nmap1 *= windEffect_low; dist *= (0.6 + 0.5 * smoothstep(0.0, 15.0, windEffect));
// mix water and noise, modulated by factor vec4 fdist = normalize(dist);
vec4 vNorm = normalize(mix(nmap, nmap1, 0.3) * waveRoughness); fdist = -fdist; //dds fix
vNorm = -vNorm; //dds fix fdist *= sca;
//load reflection //normalmaps
vec4 tmp = vec4(lightdir, 0.0); rotationmatrix(radians(3.0 * windScale + 0.6 * sin(waterTex1.s * 0.2)), RotationMatrix);
vec4 refTex; vec4 nmap = texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0;
vec4 refl; vec4 nmap1 = texture2D(perlin_normalmap, vec2(waterTex1/** RotationMatrix*/ + disdis * sca2) * windScale) * 2.0 - 1.0;
// cover = 0;
rotationmatrix(radians(-2.0 * windScale -0.4 * sin(waterTex1.s * 0.32)), RotationMatrix);
if(cover >= 1.5){ nmap += texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 1.5) * 2.0 - 1.0;
refTex = texture2D(water_reflection, vec2(tmp)); //nmap1 += texture2D(perlin_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0;
refl= normalize(refTex); rotationmatrix(radians(1.5 * windScale + 0.3 * sin(waterTex1.s * 0.16)), RotationMatrix);
} else { nmap += texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 2.1) * 2.0 - 1.0;
refTex = texture2D(water_reflection_grey, vec2(tmp)); rotationmatrix(radians(-0.5 * windScale - 0.45 * sin(waterTex1.s * 0.28)), RotationMatrix);
refl = normalize(refTex); nmap += texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 0.8) * 2.0 - 1.0;
refl.r *= (0.75 + 0.15 * cover);
refl.g *= (0.80 + 0.15 * cover); rotationmatrix(radians(-1.2 * windScale - 0.35 * sin(waterTex1.s * 0.28)), RotationMatrix);
refl.b *= (0.875 + 0.125 * cover); nmap += texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix* tscale) * windScale * 1.7) * 2.0 - 1.0;
refl.a *= 1.0; nmap1 += texture2D(perlin_normalmap, vec2(waterTex2/** RotationMatrix*/ * tscale) * windScale) * 2.0 - 1.0;
}
nmap *= windEffect_low;
vec3 N0 = vec3(texture2D(water_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0); nmap1 *= windEffect_low;
vec3 N1 = vec3(texture2D(perlin_normalmap, vec2(waterTex1 + disdis * sca) * windScale) * 2.0 - 1.0); // mix water and noise, modulated by factor
vec4 vNorm = normalize(mix(nmap, nmap1, mixFactor) * waveRoughness);
N0 += vec3(texture2D(water_normalmap, vec2(waterTex2 * tscale) * windScale) * 2.0 - 1.0); //vNorm.r += ddx;
N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2 * tscale) * windScale) * 2.0 - 1.0); vNorm = -vNorm; //dds fix
rotationmatrix(radians(2.0 * sin(osg_SimulationTime * 0.005)), RotationMatrix); //load reflection
N0 += vec3(texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix * (tscale + sca2)) * windScale) * 2.0 - 1.0); vec4 tmp = vec4(lightdir, 0.0);
N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2 * RotationMatrix * (tscale + sca2)) * windScale) * 2.0 - 1.0); vec4 refTex;
vec4 refl;
rotationmatrix(radians(-4.0 * sin(osg_SimulationTime * 0.003)), RotationMatrix); // cover = 0;
N0 += vec3(texture2D(water_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0);
N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca) * windScale) * 2.0 - 1.0); if(cover >= 1.5){
refTex = texture2D(water_reflection, vec2(tmp));
N0 *= windEffect_low; refl= normalize(refTex);
N1 *= windEffect_low; } else {
refTex = texture2D(water_reflection_grey, vec2(tmp));
vec3 N = normalize(mix(Normal + N0 , Normal + N1, 0.3) * waveRoughness); refl = normalize(refTex);
N = -N; //dds fix refl.r *= (0.75 + 0.15 * cover);
refl.g *= (0.80 + 0.15 * cover);
// specular refl.b *= (0.875 + 0.125 * cover);
vec3 specular_color = vec3(gl_LightSource[0].diffuse) refl.a *= 1.0;
* pow(max(0.0, dot(N, H)), water_shininess) * 6.0; }
vec4 specular = vec4(specular_color, 0.5);
rotationmatrix(radians(2.1* windScale + 0.25 * sin(waterTex1.s *0.14)), RotationMatrix);
specular = specular * saturation * 0.3 ; vec3 N0 = vec3(texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 1.15) * 2.0 - 1.0);
vec3 N1 = vec3(texture2D(perlin_normalmap, vec2(waterTex1/** RotationMatrix*/ + disdis * sca) * windScale) * 2.0 - 1.0);
//calculate fresnel
vec4 invfres = vec4( dot(vNorm, viewt) ); rotationmatrix(radians(-1.5 * windScale -0.32 * sin(waterTex1.s *0.24)), RotationMatrix);
vec4 fres = vec4(1.0) + invfres; N0 += vec3(texture2D(water_normalmap, vec2(waterTex2* RotationMatrix * tscale) * windScale * 1.8) * 2.0 - 1.0);
refl *= fres; N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2/** RotationMatrix*/ * tscale) * windScale) * 2.0 - 1.0);
//calculate the fog factor rotationmatrix(radians(3.8 * windScale + 0.45 * sin(waterTex1.s *0.32)), RotationMatrix);
float fogFactor; N0 += vec3(texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix * (tscale + sca2)) * windScale * 0.85) * 2.0 - 1.0);
float fogCoord = ecPosition.z; N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2/** RotationMatrix*/ * (tscale + sca2)) * windScale) * 2.0 - 1.0);
const float LOG2 = 1.442695;
fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2); rotationmatrix(radians(-2.8 * windScale - 0.38 * sin(waterTex1.s * 0.26)), RotationMatrix);
N0 += vec3(texture2D(water_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca2) * windScale * 2.1) * 2.0 - 1.0);
if(gl_Fog.density == 1.0) N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex1 /** RotationMatrix*/ + disdis * sca) * windScale) * 2.0 - 1.0);
fogFactor=1.0;
N0 *= windEffect_low;
//calculate final colour N1 *= windEffect_low;
vec4 ambient_light = gl_LightSource[0].diffuse;
vec4 finalColor; vec3 N = normalize(mix(Normal + N0, Normal + N1, mixFactor) * waveRoughness);
//N.r += ddx;
if(cover >= 1.5){ //N.g += ddy;
finalColor = refl + specular;
} else { N = -N; //dds fix
finalColor = refl;
} // specular
vec3 specular_color = vec3(gl_LightSource[0].diffuse)
float foamSlope = 0.1 + 0.1 * windScale; * pow(max(0.0, dot(N, H)), water_shininess) * 6.0;
if (windEffect >= 10.0) vec4 specular = vec4(specular_color, 0.5);
if (N.g >= foamSlope){
vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 30.0); specular = specular * saturation * 0.3 ;
finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(foamSlope, 0.25, N.g));
} //calculate fresnel
vec4 invfres = vec4( dot(vNorm, viewt) );
finalColor *= ambient_light; vec4 fres = vec4(1.0) + invfres;
refl *= fres;
gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor);
} //calculate the fog factor
float fogFactor;
float fogCoord = ecPosition.z;
const float LOG2 = 1.442695;
fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
if(gl_Fog.density == 1.0)
fogFactor=1.0;
//calculate final colour
vec4 ambient_light = gl_LightSource[0].diffuse;
vec4 finalColor;
if(cover >= 1.5){
finalColor = refl + specular;
} else {
finalColor = refl;
}
float foamSlope = 0.10 + 0.1 * windScale;
//float waveSlope = mix(N0.g, N1.g, 0.25);
vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 25.0);
float waveSlope = N.g;
if (windEffect >= 8.0)
if (waveSlope >= foamSlope){
finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.01, 0.50, N.g));
}
finalColor *= ambient_light;
//gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor);
finalColor.rgb = fog_Func(finalColor.rgb, fogType);
gl_FragColor = finalColor;
}

View file

@ -19,6 +19,12 @@ varying vec3 normal;
uniform float osg_SimulationTime; uniform float osg_SimulationTime;
uniform float WindE, WindN; uniform float WindE, WindN;
////fog "include"////////
uniform int fogType;
void fog_Func(int type);
/////////////////////////
/////// functions ///////// /////// functions /////////
void rotationmatrix(in float angle, out mat4 rotmat) void rotationmatrix(in float angle, out mat4 rotmat)
@ -45,8 +51,14 @@ void main(void)
vec4 t1 = vec4(0.0, osg_SimulationTime * 0.005217, 0.0, 0.0); vec4 t1 = vec4(0.0, osg_SimulationTime * 0.005217, 0.0, 0.0);
vec4 t2 = vec4(0.0, osg_SimulationTime * -0.0012, 0.0, 0.0); vec4 t2 = vec4(0.0, osg_SimulationTime * -0.0012, 0.0, 0.0);
float windFactor = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.01; float Angle;
float Angle = atan(-WindN + 0.001, WindE + 0.001) - atan(1.0);
float windFactor = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.05;
if (WindN == 0.0 && WindE == 0.0) {
Angle = 0.0;
}else{
Angle = atan(-WindN, WindE) - atan(1.0);
}
rotationmatrix(Angle, RotationMatrix); rotationmatrix(Angle, RotationMatrix);
waterTex1 = gl_MultiTexCoord0 * RotationMatrix - t1 * windFactor; waterTex1 = gl_MultiTexCoord0 * RotationMatrix - t1 * windFactor;
@ -54,5 +66,6 @@ void main(void)
rotationmatrix(Angle, RotationMatrix); rotationmatrix(Angle, RotationMatrix);
waterTex2 = gl_MultiTexCoord0 * RotationMatrix - t2 * windFactor; waterTex2 = gl_MultiTexCoord0 * RotationMatrix - t2 * windFactor;
fog_Func(fogType);
gl_Position = ftransform(); gl_Position = ftransform();
} }

370
Shaders/water_sine.frag Normal file
View file

@ -0,0 +1,370 @@
// This shader is mostly an adaptation of the shader found at
// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion
// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10
// © Michael Horsch - 2005
// Major update and revisions - 2011-10-07
// © Emilian Huminiuc and Vivian Meazza
#version 120
uniform sampler2D water_normalmap;
uniform sampler2D water_reflection;
uniform sampler2D water_dudvmap;
uniform sampler2D water_reflection_grey;
uniform sampler2D sea_foam;
uniform sampler2D perlin_normalmap;
uniform sampler3D Noise;
uniform float saturation, Overcast, WindE, WindN;
uniform float CloudCover0, CloudCover1, CloudCover2, CloudCover3, CloudCover4;
uniform float osg_SimulationTime;
uniform int Status;
varying vec4 waterTex1; //moving texcoords
varying vec4 waterTex2; //moving texcoords
varying vec4 waterTex4; //viewts
varying vec4 ecPosition;
varying vec3 viewerdir;
varying vec3 lightdir;
varying vec3 normal;
uniform float WaveFreq ;
uniform float WaveAmp ;
uniform float WaveSharp ;
uniform float WaveAngle ;
uniform float WaveFactor ;
uniform float WaveDAngle ;
////fog "include" /////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
/////// functions /////////
void rotationmatrix(in float angle, out mat4 rotmat)
{
rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0,
sin( angle ), cos( angle ), 0.0, 0.0,
0.0 , 0.0 , 1.0, 0.0,
0.0 , 0.0 , 0.0, 1.0 );
}
// wave functions ///////////////////////
struct Wave {
float freq; // 2*PI / wavelength
float amp; // amplitude
float phase; // speed * 2*PI / wavelength
vec2 dir;
};
Wave wave0 = Wave(1.0, 1.0, 0.5, vec2(0.97, 0.25));
Wave wave1 = Wave(2.0, 0.5, 1.3, vec2(0.97, -0.25));
Wave wave2 = Wave(1.0, 1.0, 0.6, vec2(0.95, -0.3));
Wave wave3 = Wave(2.0, 0.5, 1.4, vec2(0.99, 0.1));
float evaluateWave(in Wave w, vec2 pos, float t)
{
return w.amp * sin( dot(w.dir, pos) * w.freq + t * w.phase);
}
// derivative of wave function
float evaluateWaveDeriv(Wave w, vec2 pos, float t)
{
return w.freq * w.amp * cos( dot(w.dir, pos)*w.freq + t*w.phase);
}
// sharp wave functions
float evaluateWaveSharp(Wave w, vec2 pos, float t, float k)
{
return w.amp * pow(sin( dot(w.dir, pos)*w.freq + t*w.phase)* 0.5 + 0.5 , k);
}
float evaluateWaveDerivSharp(Wave w, vec2 pos, float t, float k)
{
return k*w.freq*w.amp * pow(sin( dot(w.dir, pos)*w.freq + t*w.phase)* 0.5 + 0.5 , k - 1) * cos( dot(w.dir, pos)*w.freq + t*w.phase);
}
void sumWaves(float angle, float dangle, float windScale, float factor, out float ddx, float ddy)
{
mat4 RotationMatrix;
float deriv;
vec4 P = waterTex1 * 1024;
rotationmatrix(radians(angle + dangle * windScale + 0.6 * sin(P.x * factor)), RotationMatrix);
P *= RotationMatrix;
P.y += evaluateWave(wave0, P.xz, osg_SimulationTime);
deriv = evaluateWaveDeriv(wave0, P.xz, osg_SimulationTime );
ddx = deriv * wave0.dir.x;
ddy = deriv * wave0.dir.y;
P.y += evaluateWave(wave1, P.xz, osg_SimulationTime);
deriv = evaluateWaveDeriv(wave1, P.xz, osg_SimulationTime);
ddx += deriv * wave1.dir.x;
ddy += deriv * wave1.dir.y;
P.y += evaluateWaveSharp(wave2, P.xz, osg_SimulationTime, WaveSharp);
deriv = evaluateWaveDerivSharp(wave2, P.xz, osg_SimulationTime, WaveSharp);
ddx += deriv * wave2.dir.x;
ddy += deriv * wave2.dir.y;
P.y += evaluateWaveSharp(wave3, P.xz, osg_SimulationTime, WaveSharp);
deriv = evaluateWaveDerivSharp(wave3, P.xz, osg_SimulationTime, WaveSharp);
ddx += deriv * wave3.dir.x;
ddy += deriv * wave3.dir.y;
}
void main(void)
{
const vec4 sca = vec4(0.005, 0.005, 0.005, 0.005);
const vec4 sca2 = vec4(0.02, 0.02, 0.02, 0.02);
const vec4 tscale = vec4(0.25, 0.25, 0.25, 0.25);
mat4 RotationMatrix;
// compute direction to viewer
vec3 E = normalize(viewerdir);
// compute direction to light source
vec3 L = normalize(lightdir);
// half vector
vec3 H = normalize(L + E);
vec3 Normal = normalize(normal);
const float water_shininess = 240.0;
// approximate cloud cover
float cover = 0.0;
//bool Status = true;
float windEffect = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.6; //wind speed in kt
float windScale = 15.0/(3.0 + windEffect); //wave scale
float windEffect_low = 0.3 + 0.7 * smoothstep(0.0, 5.0, windEffect); //low windspeed wave filter
float waveRoughness = 0.01 + smoothstep(0.0, 40.0, windEffect); //wave roughness filter
float mixFactor = 0.2 + 0.02 * smoothstep(0.0, 50.0, windEffect);
//mixFactor = 0.2;
mixFactor = clamp(mixFactor, 0.3, 0.8);
// sine waves
//float WaveFreq =1.0;
//float WaveAmp = 1000.0;
//float WaveSharp = 10.0;
float angle = 0.0;
wave0.freq = WaveFreq ;
wave0.amp = WaveAmp;
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle -= 45;
wave1.freq = WaveFreq * 2.0 ;
wave1.amp = WaveAmp * 1.25;
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle += 30;
wave2.freq = WaveFreq * 3.5;
wave2.amp = WaveAmp * 0.75;
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle -= 50;
wave3.freq = WaveFreq * 3.0 ;
wave3.amp = WaveAmp * 0.75;
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle)));
// sum waves
float ddx = 0.0, ddy = 0.0;
sumWaves(WaveAngle, -1.5, windScale, WaveFactor, ddx, ddy);
float ddx1 = 0.0, ddy1 = 0.0;
sumWaves(WaveAngle, 1.5, windScale, WaveFactor, ddx1, ddy1);
//reset the waves
angle = 0.0;
float waveamp = WaveAmp * 0.75;
wave0.freq = WaveFreq ;
wave0.amp = waveamp;
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle -= 20;
wave1.freq = WaveFreq * 2.0 ;
wave1.amp = waveamp * 1.25;
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle += 35;
wave2.freq = WaveFreq * 3.5;
wave2.amp = waveamp * 0.75;
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle -= 45;
wave3.freq = WaveFreq * 3.0 ;
wave3.amp = waveamp * 0.75;
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle)));
float ddx2 = 0.0, ddy2 = 0.0;
sumWaves(WaveAngle + WaveDAngle, -1.5, windScale, WaveFactor, ddx2, ddy2);
float ddx3 = 0.0, ddy3 = 0.0;
sumWaves(WaveAngle + WaveDAngle, 1.5, windScale, WaveFactor, ddx3, ddy3);
// end sine stuff
if (Status == 1){
cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4);
} else {
// hack to allow for Overcast not to be set by Local Weather
if (Overcast == 0){
cover = 5;
} else {
cover = Overcast * 5;
}
}
vec4 viewt = normalize(waterTex4);
vec4 disdis = texture2D(water_dudvmap, vec2(waterTex2 * tscale)* windScale) * 2.0 - 1.0;
//vec4 dist = texture2D(water_dudvmap, vec2(waterTex1 + disdis*sca2)* windScale) * 2.0 - 1.0;
//dist *= (0.6 + 0.5 * smoothstep(0.0, 15.0, windEffect));
//vec4 fdist = normalize(dist);
//fdist = -fdist; //dds fix
//fdist *= sca;
//normalmaps
vec4 nmap = texture2D(water_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0;
vec4 nmap1 = texture2D(perlin_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0;
rotationmatrix(radians(3.0 * sin(osg_SimulationTime * 0.0075)), RotationMatrix);
nmap += texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix * tscale) * windScale) * 2.0 - 1.0;
nmap1 += texture2D(perlin_normalmap, vec2(waterTex2 * RotationMatrix * tscale) * windScale) * 2.0 - 1.0;
nmap *= windEffect_low;
nmap1 *= windEffect_low;
// mix water and noise, modulated by factor
vec4 vNorm = normalize(mix(nmap, nmap1, mixFactor) * waveRoughness);
vNorm.r += ddx + ddx1 + ddx2 + ddx3;
vNorm = -vNorm; //dds fix
//load reflection
vec4 tmp = vec4(lightdir, 0.0);
vec4 refTex = texture2D(water_reflection, vec2(tmp)) ;
vec4 refTexGrey = texture2D(water_reflection_grey, vec2(tmp)) ;
vec4 refl ;
// cover = 0;
if(cover >= 1.5){
refl= normalize(refTex);
}
else
{
refl = normalize(refTexGrey);
refl.r *= (0.75 + 0.15 * cover);
refl.g *= (0.80 + 0.15 * cover);
refl.b *= (0.875 + 0.125 * cover);
refl.a *= 1.0;
}
vec3 N0 = vec3(texture2D(water_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0);
vec3 N1 = vec3(texture2D(perlin_normalmap, vec2(waterTex1 + disdis * sca) * windScale) * 2.0 - 1.0);
N0 += vec3(texture2D(water_normalmap, vec2(waterTex1 * tscale) * windScale) * 2.0 - 1.0);
N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2 * tscale) * windScale) * 2.0 - 1.0);
rotationmatrix(radians(2.0 * sin(osg_SimulationTime * 0.005)), RotationMatrix);
N0 += vec3(texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix * (tscale + sca2)) * windScale) * 2.0 - 1.0);
N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2 * RotationMatrix * (tscale + sca2)) * windScale) * 2.0 - 1.0);
rotationmatrix(radians(-4.0 * sin(osg_SimulationTime * 0.003)), RotationMatrix);
N0 += vec3(texture2D(water_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0);
N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca) * windScale) * 2.0 - 1.0);
N0 *= windEffect_low;
N1 *= windEffect_low;
N0.r += (ddx + ddx1 + ddx2 + ddx3);
N0.g += (ddy + ddy1 + ddy2 + ddy3);
vec3 N = normalize(mix(Normal + N0, Normal + N1, mixFactor) * waveRoughness);
N = -N; //dds fix
// specular
vec3 specular_color = vec3(gl_LightSource[0].diffuse)
* pow(max(0.0, dot(N, H)), water_shininess) * 6.0;
vec4 specular = vec4(specular_color, 0.5);
specular = specular * saturation * 0.3 ;
//calculate fresnel
vec4 invfres = vec4( dot(vNorm, viewt) );
vec4 fres = vec4(1.0) + invfres;
refl *= fres;
//calculate the fog factor
// float fogFactor;
// float fogCoord = ecPosition.z;
// const float LOG2 = 1.442695;
// fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
//
// if(gl_Fog.density == 1.0)
// fogFactor=1.0;
//calculate final colour
vec4 ambient_light = gl_LightSource[0].diffuse;
vec4 finalColor;
if(cover >= 1.5){
finalColor = refl + specular;
} else {
finalColor = refl;
}
//add foam
float foamSlope = 0.10 + 0.1 * windScale;
//float waveSlope = mix(N0.g, N1.g, 0.25);
vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 25.0);
float waveSlope = N.g;
if (windEffect >= 8.0)
if (waveSlope >= foamSlope){
finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.01, 0.50, N.g));
}
// float deltaN0 = 1.0 - N0.g;
//float deltaN1 = 1.0 - N1.g;
//if (windEffect >= 8.0){
// if (N0.g >= foamSlope){
// if (deltaN0 > 0.8){
// finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.01, 0.50, N0.g));
// } else {
// finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.15, 0.25, deltaN0));
// }
// }
// if (N1.g >= foamSlope){
// if (deltaN1 > 0.85){
// finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.01, 0.13, N1.g));
// } else {
// finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.01, 0.20, deltaN1));
// }
// }
//}
finalColor *= ambient_light;
//gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor);
finalColor.rgb = fog_Func(finalColor.rgb, fogType);
gl_FragColor = finalColor;
}

BIN
Textures/Water/bowwave3.dds Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -41,15 +41,6 @@
<group> <group>
<layout>vbox</layout> <layout>vbox</layout>
<text>
<halign>left</halign>
<label>"Material shaders" must be enabled for most options.</label>
</text>
<text>
<halign>left</halign>
<label>Snow is dependant on crop, landmass and urban shaders.</label>
</text>
<group> <group>
<layout>hbox</layout> <layout>hbox</layout>
<text> <text>
@ -350,205 +341,169 @@
<stretch>true</stretch> <stretch>true</stretch>
</hrule> </hrule>
</group> </group>
<checkbox>
<halign>left</halign>
<label>Material shaders</label>
<name>material-shaders</name>
<property>/sim/rendering/shader-effects</property>
<binding>
<command>dialog-apply</command>
<object-name>material-shaders</object-name>
</binding>
</checkbox>
<group>
<layout>vbox</layout>
<padding>10</padding>
<checkbox>
<halign>left</halign>
<label>Crop texture</label>
<name>crop-texture</name>
<enable>
<property>/sim/rendering/shader-effects</property>
</enable>
<property>/sim/rendering/crop-shader</property>
<binding>
<command>dialog-apply</command>
<object-name>crop-texture</object-name>
</binding>
</checkbox>
<checkbox>
<halign>left</halign>
<label>Landmass effects</label>
<name>landmass-effects</name>
<enable>
<property>/sim/rendering/shader-effects</property>
</enable>
<property>/sim/rendering/landmass-shader</property>
<binding>
<command>dialog-apply</command>
<object-name>landmass-effects</object-name>
</binding>
</checkbox>
<checkbox>
<halign>left</halign>
<label>Water reflection</label>
<name>water-reflection</name>
<enable>
<property>/sim/rendering/shader-effects</property>
</enable>
<property>/sim/rendering/water-shader</property>
<binding>
<command>dialog-apply</command>
<object-name>water-reflection</object-name>
</binding>
</checkbox>
<checkbox>
<halign>left</halign>
<label>Urban effects</label>
<name>urban-effects</name>
<enable>
<property>/sim/rendering/shader-effects</property>
</enable>
<property>/sim/rendering/urban-shader</property>
<binding>
<command>dialog-apply</command>
<object-name>urban-effects</object-name>
</binding>
</checkbox>
<checkbox>
<halign>left</halign>
<label>Transition effects</label>
<name>transition-effects</name>
<enable>
<property>/sim/rendering/shader-effects</property>
</enable>
<property>/sim/rendering/transition-shader</property>
<binding>
<command>dialog-apply</command>
<object-name>transition-effects</object-name>
</binding>
</checkbox>
<checkbox>
<halign>left</halign>
<label>Persistent contrails</label>
<name>persistent-contrails</name>
<enable>
<property>/sim/rendering/shader-effects</property>
</enable>
<property>/sim/rendering/contrail-shader</property>
<binding>
<command>dialog-apply</command>
<object-name>persistent-contrails</object-name>
</binding>
</checkbox>
</group>
<group> <group>
<layout>hbox</layout> <layout>hbox</layout>
<halign>right</halign>
<text>
<label>Snow line</label>
<enable>
<and>
<property>/sim/rendering/shader-effects</property>
<or>
<property>/sim/rendering/crop-shader</property>
<property>/sim/rendering/landmass-shader</property>
<property>/sim/rendering/urban-shader</property>
</or>
</and>
</enable>
</text>
<slider>
<name>snow-level</name>
<enable>
<and>
<property>/sim/rendering/shader-effects</property>
<or>
<property>/sim/rendering/crop-shader</property>
<property>/sim/rendering/landmass-shader</property>
<property>/sim/rendering/urban-shader</property>
</or>
</and>
</enable>
<min>0.0</min>
<max>5000.0</max>
<property>/sim/rendering/snow-level-m</property>
<binding>
<command>dialog-apply</command>
<object-name>snow-level</object-name>
</binding>
</slider>
<text>
<enable>
<and>
<property>/sim/rendering/shader-effects</property>
<or>
<property>/sim/rendering/crop-shader</property>
<property>/sim/rendering/landmass-shader</property>
<property>/sim/rendering/urban-shader</property>
</or>
</and>
</enable>
<label>12345678</label>
<format>%.fm</format>
<live>true</live>
<property>/sim/rendering/snow-level-m</property>
</text>
</group>
<group>
<layout>hbox</layout>
<halign>right</halign>
<text> <text>
<label>Performance vs Quality</label> <label>Performance</label>
<enable>
<property>/sim/rendering/shader-effects</property>
</enable>
</text> </text>
<slider> <slider>
<name>quality-level</name> <name>quality-level</name>
<enable>
<property>/sim/rendering/shader-effects</property>
</enable>
<min>0.0</min> <min>0.0</min>
<max>5.0</max> <max>5.0</max>
<step>0.5</step> <step>1.0</step>
<property>/sim/rendering/quality-level</property> <property>/sim/rendering/shaders/quality-level</property>
<binding> <binding>
<command>dialog-apply</command> <command>dialog-apply</command>
<object-name>quality-level</object-name> <object-name>quality-level</object-name>
</binding> </binding>
</slider> </slider>
<text> <text>
<enable> <label>Quality</label>
<property>/sim/rendering/shader-effects</property> </text>
</enable> <text>
<label>12345678</label> <label>12345678</label>
<format>%.1f</format> <format>(%1.0f)</format>
<live>true</live> <live>true</live>
<property>/sim/rendering/quality-level</property> <property>/sim/rendering/shaders/quality-level</property>
</text> </text>
</group> </group>
<group>
<layout>hbox</layout>
<button>
<legend>Shader Options</legend>
<enable>
<property>/sim/rendering/shaders/quality-level</property>
</enable>
<binding>
<command>dialog-show</command>
<dialog-name>shaders</dialog-name>
</binding>
</button>
<group>
<layout>vbox</layout>
<text>
<visible>
<not>
<property>/sim/rendering/shaders/quality-level</property>
</not>
</visible>
<label>Adjust the slider </label>
<halign>left</halign>
<color>
<red>1.0</red>
<green>0.6</green>
<blue>0.6</blue>
</color>
</text>
<text>
<visible>
<not>
<property>/sim/rendering/shaders/quality-level</property>
</not>
</visible>
<label>to enable shaders.</label>
<halign>left</halign>
<color>
<red>1.0</red>
<green>0.6</green>
<blue>0.6</blue>
</color>
</text>
</group>
</group>
<group> <group>
<layout>hbox</layout> <layout>hbox</layout>
<text> <text>
<label>Other</label>
<halign>left</halign>
<enable>
<property>/sim/rendering/shaders/quality-level</property>
</enable>
</text>
<hrule>
<stretch>true</stretch>
</hrule>
</group>
<group>
<layout>hbox</layout>
<halign>right</halign>
<text>
<label>Snow line</label>
<enable>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<or>
<property>/sim/rendering/shaders/crop</property>
<property>/sim/rendering/shaders/landmass</property>
<property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/shaders/urban</property>
</or>
</and>
</enable>
</text>
<slider>
<name>snow-level</name>
<enable>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<or>
<property>/sim/rendering/shaders/crop</property>
<property>/sim/rendering/shaders/landmass</property>
<property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/shaders/urban</property>
</or>
</and>
</enable>
<min>0.0</min>
<max>5000.0</max>
<property>/environment/snow-level-m</property>
<binding>
<command>dialog-apply</command>
<object-name>snow-level</object-name>
</binding>
</slider>
<text>
<halign>left</halign>
<enable>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<or>
<property>/sim/rendering/shaders/crop</property>
<property>/sim/rendering/shaders/landmass</property>
<property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/shaders/urban</property>
</or>
</and>
</enable>
<label>12345678</label>
<format>%.fm</format>
<live>true</live>
<property>/environment/snow-level-m</property>
</text>
</group>
<group>
<layout>hbox</layout>
<text>
<enable>
<property>/sim/rendering/shaders/quality-level</property>
</enable>
<label>Experimental effects</label> <label>Experimental effects</label>
<halign>left</halign> <halign>left</halign>
<color> <color>
<red>1.0</red> <red>1.0</red>
<green>0.6</green> <green>0.6</green>
<blue>0.6</blue> <blue>0.6</blue>
<alpha>1</alpha>
</color> </color>
</text> </text>
<hrule> <hrule>
@ -558,15 +513,14 @@
<group> <group>
<layout>vbox</layout> <layout>vbox</layout>
<padding>10</padding>
<checkbox> <checkbox>
<halign>left</halign> <halign>left</halign>
<enable>
<property>/sim/rendering/shaders/quality-level</property>
</enable>
<label>Skydome scattering</label> <label>Skydome scattering</label>
<name>skydome-scattering</name> <name>skydome-scattering</name>
<enable> <property>/sim/rendering/shaders/skydome</property>
<property>/sim/rendering/shader-effects</property>
</enable>
<property>/sim/rendering/scattering-shader</property>
<binding> <binding>
<command>dialog-apply</command> <command>dialog-apply</command>
<object-name>skydome-scattering</object-name> <object-name>skydome-scattering</object-name>
@ -580,13 +534,19 @@
<text> <text>
<label>Mie factor</label> <label>Mie factor</label>
<enable> <enable>
<property>/sim/rendering/shader-effects</property> <and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable> </enable>
</text> </text>
<slider> <slider>
<name>mie-factor</name> <name>mie-factor</name>
<enable> <enable>
<property>/sim/rendering/shader-effects</property> <and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable> </enable>
<min>0.0</min> <min>0.0</min>
<max>0.01</max> <max>0.01</max>
@ -599,7 +559,10 @@
</slider> </slider>
<text> <text>
<enable> <enable>
<property>/sim/rendering/shader-effects</property> <and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable> </enable>
<label>12345678</label> <label>12345678</label>
<format>%.3f</format> <format>%.3f</format>
@ -614,13 +577,19 @@
<text> <text>
<label>Rayleigh factor</label> <label>Rayleigh factor</label>
<enable> <enable>
<property>/sim/rendering/shader-effects</property> <and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable> </enable>
</text> </text>
<slider> <slider>
<name>rayleigh-factor</name> <name>rayleigh-factor</name>
<enable> <enable>
<property>/sim/rendering/shader-effects</property> <and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable> </enable>
<min>0.0</min> <min>0.0</min>
<max>0.001</max> <max>0.001</max>
@ -633,7 +602,10 @@
</slider> </slider>
<text> <text>
<enable> <enable>
<property>/sim/rendering/shader-effects</property> <and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable> </enable>
<label>12345678</label> <label>12345678</label>
<format>%.4f</format> <format>%.4f</format>
@ -648,13 +620,19 @@
<text> <text>
<label>Density factor</label> <label>Density factor</label>
<enable> <enable>
<property>/sim/rendering/shader-effects</property> <and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable> </enable>
</text> </text>
<slider> <slider>
<name>density-factor</name> <name>density-factor</name>
<enable> <enable>
<property>/sim/rendering/shader-effects</property> <and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable> </enable>
<min>0.0</min> <min>0.0</min>
<max>1.0</max> <max>1.0</max>
@ -667,7 +645,10 @@
</slider> </slider>
<text> <text>
<enable> <enable>
<property>/sim/rendering/shader-effects</property> <and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable> </enable>
<label>12345678</label> <label>12345678</label>
<format>%.1f</format> <format>%.1f</format>
@ -675,6 +656,10 @@
<property>/sim/rendering/dome-density</property> <property>/sim/rendering/dome-density</property>
</text> </text>
</group> </group>
<empty>
<stretch>1</stretch>
</empty>
</group> </group>
</group> </group>

314
gui/dialogs/shaders.xml Normal file
View file

@ -0,0 +1,314 @@
<?xml version="1.0"?>
<PropertyList>
<name>shaders</name>
<modal>false</modal>
<layout>vbox</layout>
<padding>20</padding>
<group>
<layout>hbox</layout>
<empty>
<stretch>1</stretch>
</empty>
<text>
<label>Shader options</label>
</text>
<empty>
<stretch>1</stretch>
</empty>
<button>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<legend></legend>
<keynum>27</keynum>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>hbox</layout>
<text>
<label>General</label>
<halign>left</halign>
</text>
<hrule>
<stretch>true</stretch>
</hrule>
</group>
<group>
<layout>hbox</layout>
<group>
<layout>vbox</layout>
<halign>left</halign>
<text>
<halign>left</halign>
<label>Crop</label>
<enable>
<property>/sim/rendering/shaders/crop</property>
</enable>
</text>
<text>
<halign>left</halign>
<label>Landmass</label>
<enable>
<property>/sim/rendering/shaders/landmass</property>
</enable>
</text>
<text>
<halign>left</halign>
<label>Persistent contrails</label>
<enable>
<property>/sim/rendering/shaders/contrails</property>
</enable>
</text>
<text>
<halign>left</halign>
<label>Transition</label>
<enable>
<property>/sim/rendering/shaders/transition</property>
</enable>
</text>
<text>
<halign>left</halign>
<label>Model</label>
<enable>
<property>/sim/rendering/shaders/model</property>
</enable>
</text>
<text>
<halign>left</halign>
<label>Urban</label>
<enable>
<property>/sim/rendering/shaders/urban</property>
</enable>
</text>
<text>
<halign>left</halign>
<label>Water</label>
<enable>
<property>/sim/rendering/shaders/water</property>
</enable>
</text>
</group>
<group>
<layout>vbox</layout>
<slider>
<name>crop</name>
<min>0.0</min>
<max>1.0</max>
<step>1.0</step>
<fraction>0.5</fraction>
<property>/sim/rendering/shaders/crop</property>
<binding>
<command>dialog-apply</command>
<object-name>crop</object-name>
</binding>
</slider>
<slider>
<name>landmass</name>
<min>0.0</min>
<max>1.0</max>
<step>1.0</step>
<fraction>0.5</fraction>
<property>/sim/rendering/shaders/landmass</property>
<binding>
<command>dialog-apply</command>
<object-name>landmass</object-name>
</binding>
</slider>
<slider>
<name>contrails</name>
<min>0.0</min>
<max>1.0</max>
<step>1.0</step>
<fraction>0.5</fraction>
<property>/sim/rendering/shaders/contrails</property>
<binding>
<command>dialog-apply</command>
<object-name>contrails</object-name>
</binding>
</slider>
<slider>
<name>transition</name>
<min>0.0</min>
<max>1.0</max>
<step>1.0</step>
<fraction>0.5</fraction>
<property>/sim/rendering/shaders/transition</property>
<binding>
<command>dialog-apply</command>
<object-name>transition</object-name>
</binding>
</slider>
<slider>
<name>model</name>
<min>0.0</min>
<max>1.0</max>
<step>1.0</step>
<fraction>0.5</fraction>
<property>/sim/rendering/shaders/model</property>
<binding>
<command>dialog-apply</command>
<object-name>model</object-name>
</binding>
</slider>
<slider>
<name>urban</name>
<min>0.0</min>
<max>5.0</max>
<step>1.0</step>
<property>/sim/rendering/shaders/urban</property>
<binding>
<command>dialog-apply</command>
<object-name>urban</object-name>
</binding>
</slider>
<slider>
<name>water</name>
<min>0.0</min>
<max>5.0</max>
<step>1.0</step>
<property>/sim/rendering/shaders/water</property>
<binding>
<command>dialog-apply</command>
<object-name>water</object-name>
</binding>
</slider>
</group>
</group>
<group>
<layout>hbox</layout>
<text>
<label>Aircraft</label>
<halign>left</halign>
</text>
<hrule>
<stretch>true</stretch>
</hrule>
</group>
<nasal>
<open>
if (props.globals.getNode("/sim/rendering/shaders/aircraft") != nil) {
var group = cmdarg().getChildren("group")[4];
group.removeChildren("slider");
group.removeChildren("hrule");
group.removeChildren("text");
var shaders = props.globals.getNode("/sim/rendering/shaders/aircraft").getChildren();
for(i=0; size(shaders) > i; i+=1) {
var fraction = 0.5;
var min = 0;
var max = 1;
var step = 1;
var name = shaders[i].getNode("name");
if (shaders[i].getNode("step") != nil){
step = shaders[i].getNode("step");
}
if (shaders[i].getNode("min") != nil){
min = shaders[i].getNode("min");
}
if (shaders[i].getNode("max") != nil){
max = shaders[i].getNode("max");
}
if (min != nil and max != nil and step != nil){
fraction = step/(max+step);
}
var target = group.getChild("slider", i, 1);
props.copy(group.getNode("slider-template"), target);
target.getNode("label").setValue(name != nil ? name.getValue() : (shaders[i].getName()));
target.getNode("name").setValue("aircraftshader"~i);
target.getNode("binding").getNode("object-name").setValue("aircraftshader"~i);
target.getNode("min").setValue(min);
target.getNode("max").setValue(max);
target.getNode("step").setValue(step);
target.getNode("fraction").setValue(fraction);
target.getNode("property").setValue(shaders[i].getPath()~"/quality-level");
}
}
</open>
</nasal>
<group>
<layout>vbox</layout>
<halign>left</halign>
<slider-template>
<name>
<!---->
</name>
<label>
<!---->
</label>
<min>
<!---->
</min>
<max>
<!---->
</max>
<step>
<!---->
</step>
<fraction>
<!---->
</fraction>
<property>
<!---->
</property>
<binding>
<command>dialog-apply</command>
<object-name>
<!---->
</object-name>
</binding>
</slider-template>
</group>
<hrule/>
<button>
<legend>Close</legend>
<default>true</default>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
</PropertyList>

View file

@ -1280,7 +1280,6 @@ Shared parameters for various materials.
<name>ShrubCover</name> <name>ShrubCover</name>
<name>ShrubGrassCover</name> <name>ShrubGrassCover</name>
<name>ScrubCover</name> <name>ScrubCover</name>
<name>Scrub</name>
<name>Sclerophyllous</name> <name>Sclerophyllous</name>
<name>Heath</name> <name>Heath</name>
<texture>Terrain/shrub.dds</texture> <texture>Terrain/shrub.dds</texture>
@ -2554,7 +2553,6 @@ Shared parameters for various materials.
<name>ShrubCover</name> <name>ShrubCover</name>
<name>ShrubGrassCover</name> <name>ShrubGrassCover</name>
<name>ScrubCover</name> <name>ScrubCover</name>
<name>Scrub</name>
<name>Sclerophyllous</name> <name>Sclerophyllous</name>
<name>Heath</name> <name>Heath</name>
<texture>Terrain.winter/shrub.png</texture> <texture>Terrain.winter/shrub.png</texture>

View file

@ -67,6 +67,24 @@ Started September 2000 by David Megginson, david@megginson.com
<debug type="bool">false</debug> <debug type="bool">false</debug>
<realism type="int">5</realism> <realism type="int">5</realism>
<filtering type="int">8</filtering> <filtering type="int">8</filtering>
<shaders>
<model type="float"
userarchive="y">1.0</model>
<crop type="float"
userarchive="y">1.0</crop>
<landmass type="float"
userarchive="y">1.0</landmass>
<contrails type="float"
userarchive="y">1.0</contrails>
<transition type="float"
userarchive="y">1.0</transition>
<urban type="float"
userarchive="y">1.0</urban>
<water type="float"
userarchive="y">1.0</water>
<quality-level type="float"
userarchive="y">3.0</quality-level>
</shaders>
<mie type="float" <mie type="float"
userarchive="y">0.003</mie> userarchive="y">0.003</mie>
<rayleigh type="float" <rayleigh type="float"