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>
<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>
<internal-format><use>texture[0]/internal-format</use></internal-format>
</texture-unit>
<texture-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>
</texture-unit>
<program>
<vertex-shader n="0">Shaders/bumpspec.vert</vertex-shader>
<fragment-shader n="0">Shaders/bumpspec.frag</fragment-shader>
<vertex-shader n="1">Shaders/bumpspec.vert</vertex-shader>
<fragment-shader n="1">Shaders/bumpspec.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -15,11 +15,45 @@
</wind-speed>
<offset>0.0</offset>
<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>
<technique n="9">
<predicate>
<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>
<less-equal>
<value type="float">2.0</value>
@ -114,7 +148,9 @@
<use>vertex-program-two-side</use>
</vertex-program-two-side>
<program>
<vertex-shader>Shaders/include_fog.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>
</program>
<!--<uniform>
@ -155,6 +191,79 @@
<type>sampler-3d</type>
<value type="int">9</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>
<!-- 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>

View file

@ -30,10 +30,10 @@
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</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>
<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 -->
<season-red type="float">0.12</season-red>
@ -49,8 +49,7 @@
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/transition-shader</property>
<property>/sim/rendering/shader-effects</property>
<property>/sim/rendering/shaders/transition</property>
<or>
<less-equal>
<value type="float">2.0</value>

View file

@ -30,10 +30,10 @@
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</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>
<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 -->
<season-red type="float">0.12</season-red>
@ -49,8 +49,7 @@
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/transition-shader</property>
<property>/sim/rendering/shader-effects</property>
<property>/sim/rendering/shaders/transition</property>
<or>
<less-equal>
<value type="float">2.0</value>

View file

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

View file

@ -1,299 +1,556 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/landmass</name>
<inherits-from>Effects/terrain-default</inherits-from>
<parameters>
<texture n="2">
<image>Textures.high/Terrain/forest-relief.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level>
<depth-factor type="float">0.01</depth-factor>
<canopy-height type="float">15.0</canopy-height>
<quality-level><use>/sim/rendering/quality-level</use></quality-level>
</parameters>
<generate>
<tangent type="int">6</tangent>
<binormal type="int">7</binormal>
</generate>
<technique n="8">
<predicate>
<and>
<property>/sim/rendering/landmass-shader</property>
<property>/sim/rendering/shader-effects</property>
<less-equal>
<value type="float">4.5</value>
<float-property>/sim/rendering/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>
<extension-supported>GL_EXT_geometry_shader4</extension-supported>
</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>
<alpha-test><use>transparent</use></alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number>-1</bin-number>
<bin-name>RenderBin</bin-name>
</render-bin>
<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>
<program>
<vertex-shader>Shaders/landmass-g.vert</vertex-shader>
<geometry-shader>Shaders/landmass.geom</geometry-shader>
<fragment-shader>Shaders/terrain-nocolor.frag</fragment-shader>
<geometry-vertices-out type="int">18</geometry-vertices-out>
<geometry-input-type>triangles</geometry-input-type>
<geometry-output-type>triangle-strip</geometry-output-type>
<attribute>
<name>tangent</name>
<index>6</index>
</attribute>
<attribute>
<name>binormal</name>
<index>7</index>
</attribute>
</program>
<uniform>
<name>texture</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>canopy_height</name>
<type>float</type>
<value><use>canopy-height</use></value>
</uniform>
<color-mask type="vec4d">0 0 0 0</color-mask>
</pass>
<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>Shaders/landmass-g.vert</vertex-shader>
<geometry-shader>Shaders/landmass.geom</geometry-shader>
<fragment-shader>Shaders/landmass.frag</fragment-shader>
<geometry-vertices-out type="int">18</geometry-vertices-out>
<geometry-input-type>triangles</geometry-input-type>
<geometry-output-type>triangle-strip</geometry-output-type>
<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>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>
</pass>
</technique>
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/landmass-shader</property>
<property>/sim/rendering/shader-effects</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>Shaders/landmass.vert</vertex-shader>
<fragment-shader>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>
</pass>
</technique>
<name>Effects/landmass</name>
<inherits-from>Effects/terrain-default</inherits-from>
<parameters>
<texture n="2">
<image>Textures.high/Terrain/forest-relief.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<snow-level>
<use>/environment/snow-level-m</use>
</snow-level>
<depth-factor type="float">0.01</depth-factor>
<canopy-height type="float">15.0</canopy-height>
<quality-level>
<use>/sim/rendering/shaders/quality-level</use>
</quality-level>
</parameters>
<!--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 -->
<generate>
<tangent type="int">6</tangent>
<binormal type="int">7</binormal>
</generate>
<technique n="8">
<predicate>
<and>
<property>/sim/rendering/shaders/landmass</property>
<less-equal>
<value type="float">4.5</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>
<extension-supported>GL_EXT_geometry_shader4</extension-supported>
</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>
<alpha-test>
<use>transparent</use>
</alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number>-1</bin-number>
<bin-name>RenderBin</bin-name>
</render-bin>
<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>
<program>
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<vertex-shader n="1">Shaders/landmass-g.vert</vertex-shader>
<geometry-shader>Shaders/landmass.geom</geometry-shader>
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/terrain-nocolor.frag</fragment-shader>
<geometry-vertices-out type="int">18</geometry-vertices-out>
<geometry-input-type>triangles</geometry-input-type>
<geometry-output-type>triangle-strip</geometry-output-type>
<attribute>
<name>tangent</name>
<index>6</index>
</attribute>
<attribute>
<name>binormal</name>
<index>7</index>
</attribute>
</program>
<uniform>
<name>texture</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>canopy_height</name>
<type>float</type>
<value>
<use>canopy-height</use>
</value>
</uniform>
<color-mask type="vec4d">0 0 0 0</color-mask>
<!-- 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>
<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-g.vert</vertex-shader>
<geometry-shader>Shaders/landmass.geom</geometry-shader>
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/landmass.frag</fragment-shader>
<geometry-vertices-out type="int">18</geometry-vertices-out>
<geometry-input-type>triangles</geometry-input-type>
<geometry-output-type>triangle-strip</geometry-output-type>
<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>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>

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"?>
<PropertyList>
<name>Effects/model-default</name>
<parameters>
<texture n ="0">
<type>white</type>
</texture>
<vertex-program-two-side type="bool">false</vertex-program-two-side>
<material>
<color-mode-uniform>1</color-mode-uniform> <!-- DIFFUSE -->
</material>
</parameters>
<technique n="10">
<predicate>
<and>
<property>/sim/rendering/shader-effects</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>
<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
<name>Effects/model-default</name>
<!-- <inherits-from>Effects/shadow</inherits-from> -->
<parameters>
<texture n ="0">
<type>white</type>
</texture>
<vertex-program-two-side type="bool">false</vertex-program-two-side>
<material>
<color-mode-uniform>1</color-mode-uniform>
<!-- DIFFUSE -->
</material>
<!-- BEGIN 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="10">
<predicate>
<and>
<property>/sim/rendering/shader-effects</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>
<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. -->
<unit>0</unit>
<!-- If there is a texture, the type in the derived effect
<unit>0</unit>
<!-- If there is a texture, the type in the derived effect
will be "2d". -->
<type><use>texture[0]/type</use></type>
<image><use>texture[0]/image</use></image>
<filter><use>texture[0]/filter</use></filter>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t>
<!--
<type>
<use>texture[0]/type</use>
</type>
<image>
<use>texture[0]/image</use>
</image>
<filter>
<use>texture[0]/filter</use>
</filter>
<wrap-s>
<use>texture[0]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[0]/wrap-t</use>
</wrap-t>
<!--
<internal-format>
<use>texture[0]/internal-format</use>
</internal-format>
-->
</texture-unit>
<vertex-program-two-side>
<use>vertex-program-two-side</use>
</vertex-program-two-side>
<program>
<vertex-shader>Shaders/default.vert</vertex-shader>
<fragment-shader>Shaders/default.frag</fragment-shader>
</program>
<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>
<!--
</texture-unit>
<vertex-program-two-side>
<use>vertex-program-two-side</use>
</vertex-program-two-side>
<program>
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<!--fog include-->
<vertex-shader n="1">Shaders/default.vert</vertex-shader>
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<!--fog include-->
<fragment-shader n="1">Shaders/default.frag</fragment-shader>
</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>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>
<use>texture[0]/internal-format</use>
</internal-format>
-->
<environment>
<mode>modulate</mode>
</environment>
</texture-unit>
<!-- A two-sided lighting model is set by default near the root
<environment>
<mode>modulate</mode>
</environment>
</texture-unit>
<!-- A two-sided lighting model is set by default near the root
of the scene graph. Perhaps that ought to be set in this
effect?
-->
</pass>
</technique>
</pass>
</technique>
</PropertyList>

View file

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

View file

@ -1,64 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/skydome</name>
<parameters>
<mie><use>/sim/rendering/mie</use></mie>
<rayleigh><use>/sim/rendering/rayleigh</use></rayleigh>
<density><use>/sim/rendering/dome-density</use></density>
</parameters>
<technique n="8">
<predicate>
<and>
<property>/sim/rendering/shader-effects</property>
<property>/sim/rendering/scattering-shader</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>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<program>
<vertex-shader>Shaders/skydome.vert</vertex-shader>
<fragment-shader>Shaders/skydome.frag</fragment-shader>
</program>
<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>
</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>
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/skydome</name>
<parameters>
<mie>
<use>/sim/rendering/mie</use>
</mie>
<rayleigh>
<use>/sim/rendering/rayleigh</use>
</rayleigh>
<density>
<use>/sim/rendering/dome-density</use>
</density>
<overcast>
<use>/rendering/scene/overcast</use>
</overcast>
<saturation>
<use>/rendering/scene/saturation</use>
</saturation>
<scattering>
<use>/rendering/scene/scattering</use>
</scattering>
<visibility>
<use>/environment/ground-visibility-m</use>
</visibility>
<avisibility>
<use>/environment/visibility-m</use>
</avisibility>
<lthickness>
<use>/environment/ground-haze-thickness-m</use>
</lthickness>
<terminator>
<use>/environment/terminator-relative-position-m</use>
</terminator>
</parameters>
<technique n="8">
<predicate>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</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>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<program>
<vertex-shader>Shaders/skydome.vert</vertex-shader>
<fragment-shader>Shaders/skydome.frag</fragment-shader>
</program>
<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"?>
<PropertyList>
<name>Effects/terrain-default</name>
<!-- <inherits-from>another-effect</inherits-from> -->
<parameters>
<material>
<ambient type="vec4d">
0.2 .2 0.2 1.0
</ambient>
<diffuse type="vec4d">
.8 .8 .8 1.0
</diffuse>
<specular type="vec4d">
0.0 0.0 0.0 1.0
</specular>
<emissive type="vec4d">
0.0 0.0 0.0 1.0
</emissive>
<shininess>1.2</shininess>
</material>
<texture n="0">
<image>Textures/Terrain/unknown.png</image>
<filter>linear-mipmap-linear</filter>
<!-- also repeat -->
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<!--
<name>Effects/terrain-default</name>
<!-- <inherits-from>another-effect</inherits-from> -->
<parameters>
<material>
<ambient type="vec4d">
0.2 .2 0.2 1.0
</ambient>
<diffuse type="vec4d">
.8 .8 .8 1.0
</diffuse>
<specular type="vec4d">
0.0 0.0 0.0 1.0
</specular>
<emissive type="vec4d">
0.0 0.0 0.0 1.0
</emissive>
<shininess>1.2</shininess>
</material>
<texture n="0">
<image>Textures/Terrain/unknown.png</image>
<filter>linear-mipmap-linear</filter>
<!-- also repeat -->
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<!--
<wrap-r>clamp-to-border</wrap-r>
-->
<!-- float, signed-integer, integer -->
<internal-format>normalized</internal-format>
</texture>
<transparent>false</transparent>
<render-bin>
<bin-number>0</bin-number>
<bin-name>RenderBin</bin-name>
</render-bin>
</parameters>
<!-- put techniques at a "high" index to allow derived effects to
<!-- float, signed-integer, integer -->
<internal-format>normalized</internal-format>
</texture>
<transparent>false</transparent>
<render-bin>
<bin-number>0</bin-number>
<bin-name>RenderBin</bin-name>
</render-bin>
<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>
</parameters>
<!-- put techniques at a "high" index to allow derived effects to
insert their own techniques first. -->
<technique n="10">
<predicate>
<and>
<property>/sim/rendering/shader-effects</property>
<technique n="10">
<predicate>
<and>
<property>/sim/rendering/shader-effects</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>
<emissive><use>material/emissive</use></emissive>
<shininess><use>material/shininess</use></shininess>
<color-mode>ambient-and-diffuse</color-mode>
</material>
<alpha-test><use>transparent</use></alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number>-1</bin-number>
<bin-name>RenderBin</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>
<program>
<vertex-shader>Shaders/default.vert</vertex-shader>
<fragment-shader>Shaders/terrain-nocolor.frag</fragment-shader>
</program>
<uniform>
<name>texture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<color-mask type="vec4d">0 0 0 0</color-mask>
</pass>
<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>
</texture-unit>
<program>
<vertex-shader>Shaders/default.vert</vertex-shader>
<fragment-shader>Shaders/default.frag</fragment-shader>
</program>
<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>
<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>
<emissive>
<use>material/emissive</use>
</emissive>
<shininess>
<use>material/shininess</use>
</shininess>
<color-mode>ambient-and-diffuse</color-mode>
</material>
<alpha-test>
<use>transparent</use>
</alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number>-1</bin-number>
<bin-name>RenderBin</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>
<program>
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<vertex-shader n="1">Shaders/default.vert</vertex-shader>
<vertex-shader n="0">Shaders/include_fog.frag</vertex-shader>
<fragment-shader n="1">Shaders/terrain-nocolor.frag</fragment-shader>
</program>
<uniform>
<name>texture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<color-mask type="vec4d">0 0 0 0</color-mask>
</pass>
<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>
</texture-unit>
<program>
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
<vertex-shader>Shaders/default.vert</vertex-shader>
<fragment-shader>Shaders/default.frag</fragment-shader>
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
</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>

View file

@ -1,62 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/test</name>
<parameters>
<texture n ="0">
</texture>
</parameters>
<technique n="10">
<predicate>
<and>
<property>/sim/rendering/shader-effects</property>
<less-equal>
<value type="float">1.0</value>
<shader-language/>
</less-equal>
</and>
</predicate>
<pass n="0">
<!-- This is apparently not used, so maybe we'll blow it way soon. -->
<lighting>true</lighting>
<material>
<ambient type="vec4d">0.5 0.5 0.5 1.0</ambient>
<diffuse type="vec4d">0.5 0.5 0.5 1.0</diffuse>
<color-mode>off</color-mode>
</material>
<alpha-test>
<comparison>greater</comparison>
<reference type="float">0.01</reference>
</alpha-test>
<shade-model>smooth</shade-model>
<blend>
<source>src-alpha</source>
<destination>one-minus-src-alpha</destination>
</blend>
<depth>
<write-mask>false</write-mask>
</depth>
<render-bin>
<bin-number>10</bin-number>
<bin-name>DepthSortedBin</bin-name>
</render-bin>
<texture-unit>
<unit>0</unit>
<type><use>texture[0]/type</use></type>
<image><use>texture[0]/image</use></image>
<filter><use>texture[0]/filter</use></filter>
<wrap-s><use>texture[0]/wrap-s</use></wrap-s>
<wrap-t><use>texture[0]/wrap-t</use></wrap-t>
<!--<wrap-s>clamp</wrap-s>
<name>Effects/test</name>
<parameters>
<texture n ="0">
</texture>
</parameters>
<technique n="10">
<predicate>
<and>
<property>/sim/rendering/shader-effects</property>
<less-equal>
<value type="float">1.0</value>
<shader-language/>
</less-equal>
</and>
</predicate>
<pass n="0">
<!-- This is apparently not used, so maybe we'll blow it way soon. -->
<lighting>true</lighting>
<material>
<ambient type="vec4d">0.5 0.5 0.5 1.0</ambient>
<diffuse type="vec4d">0.5 0.5 0.5 1.0</diffuse>
<color-mode>off</color-mode>
</material>
<alpha-test>
<comparison>greater</comparison>
<reference type="float">0.01</reference>
</alpha-test>
<shade-model>smooth</shade-model>
<blend>
<source>src-alpha</source>
<destination>one-minus-src-alpha</destination>
</blend>
<depth>
<write-mask>false</write-mask>
</depth>
<render-bin>
<bin-number>10</bin-number>
<bin-name>DepthSortedBin</bin-name>
</render-bin>
<texture-unit>
<unit>0</unit>
<type>
<use>texture[0]/type</use>
</type>
<image>
<use>texture[0]/image</use>
</image>
<filter>
<use>texture[0]/filter</use>
</filter>
<wrap-s>
<use>texture[0]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[0]/wrap-t</use>
</wrap-t>
<!--<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>-->
</texture-unit>
<!--<attribute>
</texture-unit>
<!--<attribute>
<mypars type="vec3">0 0 0</mypars>
<value type="int">10</value>
</attribute>-->
<program>
<vertex-shader>Shaders/test.vert</vertex-shader>
<fragment-shader>Shaders/test.frag</fragment-shader>
<!--<attribute>
<program>
<vertex-shader>Shaders/test.vert</vertex-shader>
<fragment-shader>Shaders/test.frag</fragment-shader>
<!--<attribute>
<name>usrAttr3</name>
<index>10</index>
</attribute>
@ -64,18 +74,18 @@
<name>usrAttr4</name>
<index>11</index>
</attribute>-->
</program>
<uniform>
<name>baseTexture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>shading</name>
<type>float</type>
<value type="float">0.5</value>
</uniform>
<vertex-program-two-side>true</vertex-program-two-side>
</pass>
</technique>
</program>
<uniform>
<name>baseTexture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>shading</name>
<type>float</type>
<value type="float">0.5</value>
</uniform>
<vertex-program-two-side>true</vertex-program-two-side>
</pass>
</technique>
</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)
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>
<name>Effects/transition</name>
<inherits-from>Effects/terrain-default</inherits-from>
<parameters>
<texture n="2">
<image>Textures.high/Terrain/transition1.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.high/Terrain/transition2.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.high/Terrain/snow3.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<name>Effects/transition</name>
<inherits-from>Effects/terrain-default</inherits-from>
<parameters>
<texture n="2">
<image>Textures.high/Terrain/transition1.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.high/Terrain/transition2.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.high/Terrain/snow3.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<rain-norm>
<use>/environment/rain-norm</use>
</rain-norm>
<snow-level>
<use>/sim/rendering/snow-level-m</use>
</snow-level>
<rain-norm>
<use>/environment/rain-norm</use>
</rain-norm>
<snow-level>
<use>/sim/rendering/snow-level-m</use>
</snow-level>
<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>
<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>
<transitions type="float">2.0</transitions>
<inverse type="float">0.0</inverse>
</parameters>
<transitions type="float">2.0</transitions>
<inverse type="float">0.0</inverse>
<!--<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>
<binormal type="int">7</binormal>
</generate>-->
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/transition-shader</property>
<property>/sim/rendering/shader-effects</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>
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/shaders/transition</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>
<!-- Use material values that are either inherited from the
<pass>
<lighting>true</lighting>
<!-- Use material values that are either inherited from the
terrain-default effect or supplied by an effect derived
from this one e.g., one created in the materials library. -->
<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>
<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>
<blend>
<use>transparent</use>
</blend>
<alpha-test>
<use>transparent</use>
</alpha-test>
<alpha-test>
<use>transparent</use>
</alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<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>
<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>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>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>
<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>2</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>3</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>3</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>4</unit>
<type>noise</type>
</texture-unit>
<texture-unit>
<unit>4</unit>
<type>noise</type>
</texture-unit>
<program>
<vertex-shader>Shaders/transition.vert</vertex-shader>
<fragment-shader>Shaders/transition.frag</fragment-shader>
</program>
<program>
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
<vertex-shader>Shaders/transition.vert</vertex-shader>
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
<fragment-shader>Shaders/transition.frag</fragment-shader>
</program>
<uniform>
<name>BaseTex</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>BaseTex</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>SecondTex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>SecondTex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>ThirdTex</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>ThirdTex</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>SnowTex</name>
<type>sampler-2d</type>
<value type="int">3</value>
</uniform>
<uniform>
<name>SnowTex</name>
<type>sampler-2d</type>
<value type="int">3</value>
</uniform>
<uniform>
<name>NoiseTex</name>
<type>sampler-3d</type>
<value type="int">4</value>
</uniform>
<uniform>
<name>NoiseTex</name>
<type>sampler-3d</type>
<value type="int">4</value>
</uniform>
<uniform>
<name>RainNorm</name>
<type>float</type>
<value>
<use>rain-norm</use>
</value>
</uniform>
<uniform>
<name>RainNorm</name>
<type>float</type>
<value>
<use>rain-norm</use>
</value>
</uniform>
<uniform>
<name>SnowLevel</name>
<type>float</type>
<value>
<use>snow-level</use>
</value>
</uniform>
<uniform>
<name>SnowLevel</name>
<type>float</type>
<value>
<use>snow-level</use>
</value>
</uniform>
<uniform>
<name>Transitions</name>
<type>float</type>
<value>
<use>transitions</use>
</value>
</uniform>
<uniform>
<name>Transitions</name>
<type>float</type>
<value>
<use>transitions</use>
</value>
</uniform>
<uniform>
<name>InverseSlope</name>
<type>float</type>
<value>
<use>inverse</use>
</value>
</uniform>
<uniform>
<name>InverseSlope</name>
<type>float</type>
<value>
<use>inverse</use>
</value>
</uniform>
<uniform>
<name>CloudCover0</name>
<type>float</type>
<value>
<use>cloud-cover0</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>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>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>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>
</pass>
</technique>
<uniform>
<name>CloudCover4</name>
<type>float</type>
<value>
<use>cloud-cover4</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

@ -12,87 +12,205 @@
Note: no sorting needed! -->
<PropertyList>
<name>Effects/tree</name>
<parameters>
<texture n ="0">
</texture>
</parameters>
<technique n="10">
<predicate>
<and>
<property>/sim/rendering/random-vegetation</property>
<less-equal>
<value type="float">1.0</value>
<shader-language/>
</less-equal>
</and>
</predicate>
<pass n="0">
<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>
<alpha-test>
<comparison>gequal</comparison>
<reference type="float">0.33</reference>
</alpha-test>
<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>Shaders/tree.vert</vertex-shader>
<fragment-shader>Shaders/tree.frag</fragment-shader>
</program>
<uniform>
<name>baseTexture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
</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>Shaders/tree.vert</vertex-shader>
<fragment-shader>Shaders/tree.frag</fragment-shader>
</program>
<uniform>
<name>baseTexture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
</pass>
</technique>
<name>Effects/tree</name>
<parameters>
<texture n ="0">
</texture>
<!-- 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="10">
<predicate>
<and>
<!--<property>/sim/rendering/shader-effects</property>-->
<property>/sim/rendering/random-vegetation</property>
<less-equal>
<value type="float">1.0</value>
<shader-language/>
</less-equal>
</and>
</predicate>
<pass n="0">
<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>
<alpha-test>
<comparison>gequal</comparison>
<reference type="float">0.33</reference>
</alpha-test>
<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>Shaders/include_fog.vert</vertex-shader> -->
<vertex-shader>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>
<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>

View file

@ -1,280 +1,492 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/urban</name>
<inherits-from>Effects/terrain-default</inherits-from>
<parameters>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level>
<depth-factor type="float">0.008</depth-factor>
<night-color type="vec3d">0.75 0.59 0.05</night-color>
<quality-level><use>/sim/rendering/quality-level</use></quality-level>
</parameters>
<generate>
<normal type="int">15</normal>
<tangent type="int">6</tangent>
<binormal type="int">7</binormal>
</generate>
<technique n="8">
<predicate>
<and>
<property>/sim/rendering/urban-shader</property>
<property>/sim/rendering/shader-effects</property>
<less-equal>
<value type="float">4.0</value>
<float-property>/sim/rendering/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>
<image><use>texture[2]/image</use></image>
<filter>nearest-mipmap-nearest</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>
<mipmap-control>
<function-r>average</function-r>
<function-g>average</function-g>
<function-b>average</function-b>
<function-a>min</function-a>
</mipmap-control>
</texture-unit>
<texture-unit>
<unit>3</unit>
<type>noise</type>
</texture-unit>
<program>
<vertex-shader>Shaders/urban.vert</vertex-shader>
<fragment-shader>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>
<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>QDMTex</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>NoiseTex</name>
<type>sampler-3d</type>
<value type="int">3</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>
<uniform>
<name>max_lod_level</name>
<type>float</type>
<value><use>max-lod-level</use></value>
</uniform>
</pass>
</technique>
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/urban-shader</property>
<property>/sim/rendering/shader-effects</property>
<less-equal>
<value type="float">2.0</value>
<float-property>/sim/rendering/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>Shaders/urban.vert</vertex-shader>
<fragment-shader>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>
<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>
<name>Effects/urban</name>
<inherits-from>Effects/terrain-default</inherits-from>
<parameters>
<snow-level>
<use>/sim/rendering/snow-level-m</use>
</snow-level>
<depth-factor type="float">0.008</depth-factor>
<night-color type="vec3d">0.75 0.59 0.05</night-color>
<quality-level>
<use>/sim/rendering/shaders/quality-level</use>
</quality-level>
<!--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>
<normal type="int">15</normal>
<tangent type="int">6</tangent>
<binormal type="int">7</binormal>
</generate>
<technique n="8">
<predicate>
<and>
<property>/sim/rendering/shaders/urban</property>
<property>/sim/rendering/shaders/quality-level</property>
<less-equal>
<value type="float">4.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>
<image>
<use>texture[2]/image</use>
</image>
<filter>nearest-mipmap-nearest</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>
<mipmap-control>
<function-r>average</function-r>
<function-g>average</function-g>
<function-b>average</function-b>
<function-a>min</function-a>
</mipmap-control>
</texture-unit>
<texture-unit>
<unit>3</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>
<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>QDMTex</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>NoiseTex</name>
<type>sampler-3d</type>
<value type="int">3</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>
<uniform>
<name>max_lod_level</name>
<type>float</type>
<value>
<use>max-lod-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>
<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>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/water-inland</name>
<name>Effects/water</name>
<inherits-from>Effects/terrain-default</inherits-from>
<parameters>
<texture n="0">
@ -49,6 +49,26 @@
<cloud-cover4>
<use>/environment/clouds/layer[4]/coverage-type</use>
</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>
<technique n="8">
<predicate>
@ -176,6 +196,7 @@
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
<vertex-shader>Shaders/water.vert</vertex-shader>
<fragment-shader>Shaders/water-inland.frag</fragment-shader>
</program>
@ -240,6 +261,50 @@
<use>cloud-cover4</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>
<technique n="9">

View file

@ -13,8 +13,8 @@
<texture n="2">
<!--<image>Textures/Water/water-normalmap.png</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/caustic-nm.png</image>-->
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
@ -23,8 +23,9 @@
<texture n="3">
<!--<image>Textures/Water/water-dudv.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_sine_nmap.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
@ -46,6 +47,7 @@
</texture>
<texture n="6">
<image>Textures/Water/perlin-noise-nm.dds</image>
<!-- <image>Textures/Water/water_sine_nmap.dds</image> -->
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
@ -60,44 +62,80 @@
<overcast>
<use>/rendering/scene/overcast</use>
</overcast>
<cloud-cover0>
<cloud-cover n="0">
<use>/environment/clouds/layer[0]/coverage-type</use>
</cloud-cover0>
<cloud-cover1>
</cloud-cover>
<cloud-cover n="1">
<use>/environment/clouds/layer[1]/coverage-type</use>
</cloud-cover1>
<cloud-cover2>
</cloud-cover>
<cloud-cover n="2" >
<use>/environment/clouds/layer[2]/coverage-type</use>
</cloud-cover2>
<cloud-cover3>
</cloud-cover>
<cloud-cover n="3">
<use>/environment/clouds/layer[3]/coverage-type</use>
</cloud-cover3>
<cloud-cover4>
</cloud-cover>
<cloud-cover n="4">
<use>/environment/clouds/layer[4]/coverage-type</use>
</cloud-cover4>
</cloud-cover>
<!--<wind>
<use>/environment/wind-speed-kt</use>
</wind>-->
<windE>
<use>/environment/config/boundary/entry[0]/wind-from-east-fps</use>
<use>/environment/sea/surface/wind-from-east-fps</use>
</windE>
<windN>
<use>/environment/config/boundary/entry[0]/wind-from-north-fps</use>
<use>/environment/sea/surface/wind-from-north-fps</use>
</windN>
<wind-from>
<use>/environment/config/boundary/entry[0]/wind-from-heading-deg</use>
</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>
<technique n="8">
<predicate>
<and>
<property>/sim/rendering/water-shader</property>
<property>/sim/rendering/shader-effects</property>
<property>/sim/rendering/shaders/water</property>
<less-equal>
<value type="float">2.0</value>
<float-property>/sim/rendering/quality-level</float-property>
<value type="float">4.0</value>
<float-property>/sim/rendering/shaders/water</float-property>
</less-equal>
<or>
<less-equal>
@ -251,9 +289,15 @@
<use>texture[6]/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/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>
<uniform>
<name>water_reflection</name>
@ -295,35 +339,35 @@
<name>CloudCover0</name>
<type>float</type>
<value>
<use>cloud-cover0</use>
<use>cloud-cover[0]</use>
</value>
</uniform>
<uniform>
<name>CloudCover1</name>
<type>float</type>
<value>
<use>cloud-cover1</use>
<use>cloud-cover[1]</use>
</value>
</uniform>
<uniform>
<name>CloudCover2</name>
<type>float</type>
<value>
<use>cloud-cover2</use>
<use>cloud-cover[2]</use>
</value>
</uniform>
<uniform>
<name>CloudCover3</name>
<type>float</type>
<value>
<use>cloud-cover3</use>
<use>cloud-cover[3]</use>
</value>
</uniform>
<uniform>
<name>CloudCover4</name>
<type>float</type>
<value>
<use>cloud-cover4</use>
<use>cloud-cover[4]</use>
</value>
</uniform>
<uniform>
@ -362,13 +406,109 @@
<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>
</technique>
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/water-shader</property>
<property>/sim/rendering/shader-effects</property>
<property>/sim/rendering/shaders/water</property>
<less-equal>
<value type="float">2.0</value>
<float-property>/sim/rendering/shaders/water</float-property>
</less-equal>
<or>
<less-equal>
<value type="float">2.0</value>
@ -415,17 +555,323 @@
</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>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>
</texture-unit>
<program>
<vertex-shader>Shaders/water-orig.vert</vertex-shader>
<fragment-shader>Shaders/water-orig.frag</fragment-shader>
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
<vertex-shader>Shaders/water.vert</vertex-shader>
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
<fragment-shader>Shaders/water.frag</fragment-shader>
</program>
<uniform>
<name>texture</name>
<type>sampler-3d</type>
<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>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>
</technique>
</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++-*-
// Ambient term comes in gl_Color.rgb.
#version 120
varying vec4 diffuse_term;
varying vec3 normal;
varying float fogCoord;
uniform sampler2D texture;
////fog "include" /////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
float luminance(vec3 color)
{
return dot(vec3(0.212671, 0.715160, 0.072169), color);
@ -44,6 +51,7 @@ void main()
color = clamp(color, 0.0, 1.0);
texel = texture2D(texture, gl_TexCoord[0].st);
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
// equivalent to osg::Material::DIFFUSE.
#version 120
#define MODE_OFF 0
#define MODE_DIFFUSE 1
#define MODE_AMBIENT_AND_DIFFUSE 2
@ -18,12 +18,17 @@
// bugs with gl_FrontFacing in the fragment shader.
varying vec4 diffuse_term;
varying vec3 normal;
varying float fogCoord;
uniform int colorMode;
////fog "include"////////
uniform int fogType;
void fog_Func(int type);
/////////////////////////
void main()
{
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = gl_NormalMatrix * gl_Normal;
@ -51,5 +56,6 @@ void main()
// 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);
//fogCoord = abs(ecPosition.z / ecPosition.w);
fog_Func(fogType);
}

View file

@ -1,4 +1,5 @@
// -*-C++-*-
// © Vivian Meazza - 2011
// 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
// equivalent to osg::Material::DIFFUSE.
#version 120
#define fps2kts 0.5925
#define MODE_OFF 0
#define MODE_DIFFUSE 1
#define MODE_AMBIENT_AND_DIFFUSE 2
@ -18,15 +22,69 @@
// bugs with gl_FrontFacing in the fragment shader.
varying vec4 diffuse_term;
varying vec3 normal;
varying float fogCoord;
//varying float fogCoord;
uniform int colorMode;
uniform float osg_SimulationTime;
uniform float WindSpeed, Offset, AmpFactor;
uniform float Offset, AmpFactor, WindE, WindN, spd, hdg;
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()
{
{
mat4 RotationMatrix;
float relWindspd=0;
float relWinddir=0;
// compute relative wind speed and direction
relWind (relWindspd, relWinddir);
// map noise vector
vec4 noisevec = texture3D(Noise, gl_Vertex.xyz);
@ -35,14 +93,18 @@ void main()
vec4 pos = 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.z * 5.0 + tsec * freq/2)/5.0) * 0.125 ;
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;
//do the colour and fog
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
@ -52,28 +114,30 @@ void main()
if (colorMode == MODE_DIFFUSE) {
diffuse_color = gl_Color;
ambient_color = gl_FrontMaterial.ambient;
} else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) {
diffuse_color = gl_Color;
ambient_color = gl_Color;
} else {
diffuse_color = gl_FrontMaterial.diffuse;
ambient_color = gl_FrontMaterial.ambient;
} else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) {
diffuse_color = gl_Color;
ambient_color = gl_Color;
} else {
diffuse_color = gl_FrontMaterial.diffuse;
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
//varying float fogCoord;
varying vec3 PointPos;

View file

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

View file

@ -31,21 +31,29 @@ attribute vec3 binormal;
uniform float canopy_height;
void main(void)
{
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;
////fog "include"////////
uniform int fogType;
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);
}
void fog_Func(int type);
/////////////////////////
void main(void)
{
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;
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 size = 1.0 / float(linear_search_steps);
float depth = 0.0;
float best_depth = 1.0;
float size = 1.0 / float(linear_search_steps);
float depth = 0.0;
float best_depth = 1.0;
for(int i = 0; i < linear_search_steps - 1; ++i)
{
depth += size;
float t = texture2D(reliefMap, dp + ds * depth).a;
if(best_depth > 0.996)
if(depth >= t)
best_depth = depth;
}
depth = best_depth;
for(int i = 0; i < linear_search_steps - 1; ++i)
{
depth += size;
float t = texture2D(reliefMap, dp + ds * depth).a;
if(best_depth > 0.996)
if(depth >= t)
best_depth = 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)
{
size *= 0.5;
float t = texture2D(reliefMap, dp + ds * depth).a;
if(depth >= t)
{
best_depth = depth;
depth -= 2.0 * size;
}
depth += size;
}
for(int i = 0; i < binary_search_steps; ++i)
{
size *= 0.5;
float t = texture2D(reliefMap, dp + ds * depth).a;
if(depth >= t)
{
best_depth = depth;
depth -= 2.0 * size;
}
depth += size;
}
return(best_depth);
}
return(best_depth);
}
void main (void)
{
float bump = 1.0;
{
float bump = 1.0;
if ( quality_level >= 3.0 ) {
linear_search_steps = 20;
}
if ( quality_level >= 3.0 ) {
linear_search_steps = 20;
}
vec2 uv, dp = vec2(0, 0), ds = vec2(0, 0);
vec3 N;
float d = 0;
if ( bump > 0.9 && quality_level >= 2.0 && quality_level < 3.5)
{
vec3 V = normalize(ecPosition.xyz);
float a = dot(VNormal, -V);
vec2 s = vec2(dot(V, VTangent), dot(V, VBinormal));
vec2 uv, dp = vec2(0, 0), ds = vec2(0, 0);
vec3 N;
float d = 0;
if ( bump > 0.9 && quality_level > 2.0 && quality_level <= 4.0)
{
vec3 V = normalize(ecPosition.xyz);
float a = dot(VNormal, -V);
vec2 s = vec2(dot(V, VTangent), dot(V, VBinormal));
// prevent a divide by zero
if (a > -1e-3 && a < 1e-3) a = 1e-3;
s *= depth_factor / a;
ds = s;
dp = gl_TexCoord[0].st;
d = ray_intersect(NormalTex, dp, ds);
// prevent a divide by zero
if (a > -1e-3 && a < 1e-3) a = 1e-3;
s *= depth_factor / a;
ds = s;
dp = gl_TexCoord[0].st;
d = ray_intersect(NormalTex, dp, ds);
uv = dp + ds * d;
N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0;
}
else
{
uv = gl_TexCoord[0].st;
N = vec3(0.0, 0.0, 1.0);
}
uv = dp + ds * d;
N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0;
}
else
{
uv = gl_TexCoord[0].st;
N = vec3(0.0, 0.0, 1.0);
}
vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale);
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale);
vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale);
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale);
float fogFactor;
float fogCoord = ecPosition.z;
const float LOG2 = 1.442695;
fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
float biasFactor = fogFactor = clamp(fogFactor, 0.0, 1.0);
float fogFactor;
float fogCoord = ecPosition.z;
const float LOG2 = 1.442695;
fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
float biasFactor = fogFactor = clamp(fogFactor, 0.0, 1.0);
float n=0.06;
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 += 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;
n += noisevec[2]*0.8;
n += noisevec[3]*2.1;
n = mix(0.6, n, biasFactor);
// good
vec4 c1 = texture2D(BaseTex, uv);
//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));
//"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));
//"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));
n += noisevec[2]*0.8;
n += noisevec[3]*2.1;
n = mix(0.6, n, biasFactor);
// good
vec4 c1 = texture2D(BaseTex, uv);
//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));
//"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));
//"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));
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
vec3 l = gl_LightSource[0].position.xyz;
vec3 diffuse = gl_Color.rgb * max(0.0, dot(N, l));
float shadow_factor = 1.0;
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
vec3 l = gl_LightSource[0].position.xyz;
vec3 diffuse = gl_Color.rgb * max(0.0, dot(N, l));
float shadow_factor = 1.0;
// Shadow
if ( quality_level >= 3.0 ) {
dp += ds * d;
vec3 sl = normalize( vec3( dot( l, VTangent ), dot( l, VBinormal ), dot( -l, VNormal ) ) );
ds = sl.xy * depth_factor / sl.z;
dp -= ds * d;
float dl = ray_intersect(NormalTex, dp, ds);
if ( dl < d - 0.05 )
shadow_factor = dot( constantColor.xyz, vec3( 1.0, 1.0, 1.0 ) ) * 0.25;
}
// end shadow
// Shadow
if ( quality_level >= 3.0 ) {
dp += ds * d;
vec3 sl = normalize( vec3( dot( l, VTangent ), dot( l, VBinormal ), dot( -l, VNormal ) ) );
ds = sl.xy * depth_factor / sl.z;
dp -= ds * d;
float dl = ray_intersect(NormalTex, dp, ds);
if ( dl < d - 0.05 )
shadow_factor = dot( constantColor.xyz, vec3( 1.0, 1.0, 1.0 ) ) * 0.25;
}
// 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;
vec4 finalColor = c1;
c1 *= ambient_light;
vec4 finalColor = c1;
if(gl_Fog.density == 1.0)
fogFactor=1.0;
//if(gl_Fog.density == 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 binormal;
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;
////fog "include" /////
uniform int fogType;
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;
}
void fog_Func(int type);
//////////////////////
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; -*-
// Licence: GPL v2
// Author: Vivian Meazza.
// © Emilian Huminiuc and Vivian Meazza 2011
varying vec3 rawpos;
varying float fogCoord;
@ -19,12 +19,19 @@ uniform mat4 osg_ViewMatrixInverse;
attribute vec3 tangent;
attribute vec3 binormal;
////fog "include"////////
uniform int fogType;
void fog_Func(int type);
/////////////////////////
void main(void)
{
rawpos = gl_Vertex.xyz / gl_Vertex.w;
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
ecPosition.xyz = ecPosition.xyz / ecPosition.w;
fogCoord = ecPosition.z;
fog_Func(fogType);
vec3 n = normalize(gl_Normal);
vec3 t = cross(gl_Normal, vec3(1.0,0.0,0.0));

View file

@ -1,6 +1,6 @@
// -*- mode: C; -*-
// Licence: GPL v2
// Author: Vivian Meazza.
// © Emilian Huminiuc and Vivian Meazza 2011
#version 120
@ -32,7 +32,13 @@ uniform float ambient_correction;
uniform float reflect_map;
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);

View file

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

View file

@ -1,19 +1,25 @@
// -*-C++-*-
// Texture switching based on face slope and snow level,with ideas from crop.frag, forest.frag
// © 2011 - Frederic Bouvier, Emilian Huminiuc, Tim Moore, Yves Sablonier
// Texture switching based on face slope and snow level
// based on earlier work by Frederic Bouvier, Tim Moore, and Yves Sablonier.
// © Emilian Huminiuc 2011
// Ambient term comes in gl_Color.rgb.
#version 120
varying vec4 diffuse_term, RawPos;
varying vec3 Vnormal, normal;
varying float fogCoord;
//varying float fogCoord;
uniform float SnowLevel, Transitions, InverseSlope, RainNorm, CloudCover0, CloudCover1, CloudCover2, CloudCover3, CloudCover4;
uniform sampler2D BaseTex, SecondTex, ThirdTex, SnowTex;
uniform sampler3D NoiseTex;
////fog "include" /////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
void main()
{
{
float MixFactor, NdotL, NdotHV, fogFactor, cover, slope, L1, L2, wetness;
vec3 n, lightDir, halfVector;
@ -29,7 +35,7 @@ void main()
Noise = texture3D(NoiseTex, RawPos.xyz*0.0011);
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);
L1 = 0.90 - 0.02 * MixFactor; //first transition slope
L2 = 0.78 + 0.04 * MixFactor; //Second transition slope
@ -47,7 +53,7 @@ void main()
specular.rgb = (gl_FrontMaterial.specular.rgb
* gl_LightSource[0].specular.rgb
* pow(NdotHV, gl_FrontMaterial.shininess));
}
}
color.a = diffuse_term.a;
// 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 secondTexel = texture2D(SecondTex, 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).
if (InverseSlope == 0.0) {
//Do we do an intermediate transition
@ -71,46 +77,46 @@ void main()
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 = baseTexel;
}
}
if (slope >= L2 && slope < L1){
texel = mix(secondTexel, baseTexel, smoothstep(L2, L1 - 0.06 * MixFactor, slope));
}
}
if (slope < L2){
texel = mix(thirdTexel, secondTexel, smoothstep(L2 - 0.13 * MixFactor, L2, slope));
}
}
// Just one transition
} else if (Transitions < 1.5) {
if (slope >= L1) {
texel = baseTexel;
} else if (Transitions < 1.5) {
if (slope >= L1) {
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
} else if (InverseSlope > 0.0) {
//Interemdiate transition ?
if (Transitions >= 1.5) {
if (slope >= L1 + 0.1) {
texel = thirdTexel;
}
if (slope >= L2 && slope < L1 + 0.1){
texel = mix(secondTexel, thirdTexel, smoothstep(L2 + 0.06 * MixFactor, L1 + 0.1, slope));
}
if (slope <= L2){
texel = mix(baseTexel, secondTexel, smoothstep(L2 - 0.06 * MixFactor, L2, slope));
}
//just one
} else if (Transitions < 1.5) {
if (slope > L1 + 0.1) {
texel = thirdTexel;
}
if (slope <= L1 + 0.1){
texel = mix(baseTexel, thirdTexel, smoothstep(L2 - 0.06 * MixFactor, L1 + 0.1, slope));
}
} else if (InverseSlope > 0.0) {
//Interemdiate transition ?
if (Transitions >= 1.5) {
if (slope >= L1 + 0.1) {
texel = thirdTexel;
}
if (slope >= L2 && slope < L1 + 0.1){
texel = mix(secondTexel, thirdTexel, smoothstep(L2 + 0.06 * MixFactor, L1 + 0.1, slope));
}
if (slope <= L2){
texel = mix(baseTexel, secondTexel, smoothstep(L2 - 0.06 * MixFactor, L2, slope));
}
//just one
} else if (Transitions < 1.5) {
if (slope > L1 + 0.1) {
texel = thirdTexel;
}
if (slope <= L1 + 0.1){
texel = mix(baseTexel, thirdTexel, smoothstep(L2 - 0.06 * MixFactor, L1 + 0.1, slope));
}
}
}
}
//darken textures with wetness
wetness = 1.0 - 0.3 * RainNorm;
@ -121,20 +127,19 @@ void main()
//Snow texture for areas higher than SnowLevel
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));
}
}
fragColor = color * texel + specular;
if(cover >= 2.5){
fragColor.rgb = fragColor.rgb * 1.2;
} else {
fragColor.rg = fragColor.rg * (0.6 + 0.2 * 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);
}
} else {
fragColor.rg = fragColor.rg * (0.6 + 0.2 * cover);
fragColor.b = fragColor.b * (0.5 + 0.25 * cover);
}
//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.
varying vec4 diffuse_term, RawPos;
varying vec3 normal, Vnormal;
varying float fogCoord;
//varying float fogCoord;
uniform int colorMode;
////fog "include"////////
uniform int fogType;
void fog_Func(int type);
/////////////////////////
void main()
{
{
RawPos = gl_Vertex;
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
//vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = normalize(gl_Normal);
@ -34,25 +40,26 @@ void main()
if (colorMode == MODE_DIFFUSE) {
diffuse_color = gl_Color;
ambient_color = gl_FrontMaterial.ambient;
} else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) {
diffuse_color = gl_Color;
ambient_color = gl_Color;
} else {
diffuse_color = gl_FrontMaterial.diffuse;
ambient_color = gl_FrontMaterial.ambient;
} else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) {
diffuse_color = gl_Color;
ambient_color = gl_Color;
} else {
diffuse_color = gl_FrontMaterial.diffuse;
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;
varying float fogFactor;
#version 120
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 finalColor = base * gl_Color;
gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor );
if (base.a <= 0.01)
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
// fog coord - rotation
// 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)
{
@ -30,7 +37,10 @@ void main(void)
vec4 ambientColor = gl_FrontLightModelProduct.sceneColor + gl_LightSource[0].ambient * gl_FrontMaterial.ambient;
gl_FrontColor = ambientColor + gl_LightSource[0].diffuse * vec4(diffuse, 1.0);
float fogCoord = abs(ecPosition.z);
fogFactor = exp( -gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
fogFactor = clamp(fogFactor, 0.0, 1.0);
//fogCoord = abs(ecPosition.z);
//fogFactor = exp( -gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
//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 gIterationCap = 64;
////fog "include" /////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
void QDM(inout vec3 p, inout vec3 v)
{
const int MAX_LEVEL = TEXTURE_MIP_LEVELS;
const float NODE_COUNT = TEXTURE_PIX_COUNT;
const float TEXEL_SPAN_HALF = 1.0 / NODE_COUNT / 2.0;
const int MAX_LEVEL = TEXTURE_MIP_LEVELS;
const float NODE_COUNT = TEXTURE_PIX_COUNT;
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;
float level = MAX_LEVEL;
vec3 p2 = p;
float level = MAX_LEVEL;
vec2 dirSign = (sign(v.xy) + 1.0) * 0.5;
GlobalIterationCount = 0;
float d = 0.0;
while (level >= 0.0 && GlobalIterationCount < gIterationCap)
{
vec4 uv = vec4(p2.xyz, level);
d = texture2DLod(QDMTex, uv.xy, uv.w).w;
while (level >= 0.0 && GlobalIterationCount < gIterationCap)
{
vec4 uv = vec4(p2.xyz, level);
d = texture2DLod(QDMTex, uv.xy, uv.w).w;
if (d > p2.z)
{
//predictive point of ray traversal
vec3 tmpP2 = p + v * d;
if (d > p2.z)
{
//predictive point of ray traversal
vec3 tmpP2 = p + v * d;
//current node count
float nodeCount = pow(2.0, (MAX_LEVEL - level));
//current and predictive node ID
vec4 nodeID = floor(vec4(p2.xy, tmpP2.xy)*nodeCount);
//current node count
float nodeCount = pow(2.0, (MAX_LEVEL - level));
//current and predictive node ID
vec4 nodeID = floor(vec4(p2.xy, tmpP2.xy)*nodeCount);
//check if we are crossing the current cell
if (nodeID.x != nodeID.z || nodeID.y != nodeID.w)
{
//calculate distance to nearest bound
vec2 a = p2.xy - p.xy;
vec2 p3 = (nodeID.xy + dirSign) / nodeCount;
vec2 b = p3.xy - p.xy;
//check if we are crossing the current cell
if (nodeID.x != nodeID.z || nodeID.y != nodeID.w)
{
//calculate distance to nearest bound
vec2 a = p2.xy - p.xy;
vec2 p3 = (nodeID.xy + dirSign) / nodeCount;
vec2 b = p3.xy - p.xy;
vec2 dNC = (b.xy * p2.z) / a.xy;
//take the nearest cell
d = min(d,min(dNC.x, dNC.y))+fDeltaNC;
vec2 dNC = (b.xy * p2.z) / a.xy;
//take the nearest cell
d = min(d,min(dNC.x, dNC.y))+fDeltaNC;
level++;
level++;
//use additional convergence speed-up
#ifdef USE_QDM_ASCEND_INTERVAL
if(frac(level*0.5) > EPSILON)
level++;
#elseif USE_QDM_ASCEND_CONST
level++;
#endif
}
p2 = p + v * d;
}
level--;
GlobalIterationCount++;
}
//use additional convergence speed-up
#ifdef USE_QDM_ASCEND_INTERVAL
if(frac(level*0.5) > EPSILON)
level++;
#elseif USE_QDM_ASCEND_CONST
level++;
#endif
}
p2 = p + v * d;
}
level--;
GlobalIterationCount++;
}
//
// Manual Bilinear filtering
//
float rayLength = length(p2.xy - p.xy) + fDeltaNC;
//
// Manual Bilinear filtering
//
float rayLength = length(p2.xy - p.xy) + fDeltaNC;
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 dA = 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 p2b = vec4(p + v * dB, 0.0);
dA = texture2DLod(NormalTex, p2a.xy, p2a.w).w;
dB = texture2DLod(NormalTex, p2b.xy, p2b.w).w;
vec4 p2a = vec4(p + v * dA, 0.0);
vec4 p2b = vec4(p + v * dB, 0.0);
dA = texture2DLod(NormalTex, p2a.xy, p2a.w).w;
dB = texture2DLod(NormalTex, p2b.xy, p2b.w).w;
dA = abs(p2a.z - dA);
dB = abs(p2b.z - dB);
dA = abs(p2a.z - dA);
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)
@ -121,35 +127,35 @@ float ray_intersect_QDM(vec2 dp, vec2 ds)
float ray_intersect_relief(vec2 dp, vec2 ds)
{
float size = 1.0 / float(linear_search_steps);
float depth = 0.0;
float best_depth = 1.0;
float size = 1.0 / float(linear_search_steps);
float depth = 0.0;
float best_depth = 1.0;
for(int i = 0; i < linear_search_steps - 1; ++i)
{
depth += size;
float t = step(0.95, texture2D(NormalTex, dp + ds * depth).a);
if(best_depth > 0.996)
if(depth >= t)
best_depth = depth;
}
depth = best_depth;
for(int i = 0; i < linear_search_steps - 1; ++i)
{
depth += size;
float t = step(0.95, texture2D(NormalTex, dp + ds * depth).a);
if(best_depth > 0.996)
if(depth >= t)
best_depth = 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)
{
size *= 0.5;
float t = step(0.95, texture2D(NormalTex, dp + ds * depth).a);
if(depth >= t)
{
best_depth = depth;
depth -= 2.0 * size;
}
depth += size;
}
for(int i = 0; i < binary_search_steps; ++i)
{
size *= 0.5;
float t = step(0.95, texture2D(NormalTex, dp + ds * depth).a);
if(depth >= t)
{
best_depth = depth;
depth -= 2.0 * size;
}
depth += size;
}
return(best_depth);
return(best_depth);
}
float ray_intersect(vec2 dp, vec2 ds)
@ -162,82 +168,76 @@ float ray_intersect(vec2 dp, vec2 ds)
void main (void)
{
if ( quality_level >= 3.5 ) {
linear_search_steps = 20;
}
vec3 ecPos3 = ecPosition.xyz / ecPosition.w;
vec3 V = normalize(ecPos3);
vec3 s = vec3(dot(V, VTangent), dot(V, VBinormal), dot(VNormal, -V));
vec2 ds = s.xy * depth_factor / s.z;
vec2 dp = gl_TexCoord[0].st - ds;
float d = ray_intersect(dp, ds);
if ( quality_level >= 3.5 ) {
linear_search_steps = 20;
}
vec3 ecPos3 = ecPosition.xyz / ecPosition.w;
vec3 V = normalize(ecPos3);
vec3 s = vec3(dot(V, VTangent), dot(V, VBinormal), dot(VNormal, -V));
vec2 ds = s.xy * depth_factor / s.z;
vec2 dp = gl_TexCoord[0].st - ds;
float d = ray_intersect(dp, ds);
vec2 uv = dp + ds * d;
vec3 N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0;
vec2 uv = dp + ds * d;
vec3 N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0;
float emis = N.z;
N.z = sqrt(1.0 - min(1.0,dot(N.xy, N.xy)));
float Nz = N.z;
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
float emis = N.z;
N.z = sqrt(1.0 - min(1.0,dot(N.xy, N.xy)));
float Nz = N.z;
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
vec3 l = gl_LightSource[0].position.xyz;
vec3 diffuse = gl_Color.rgb * max(0.0, dot(N, l));
float shadow_factor = 1.0;
vec3 l = gl_LightSource[0].position.xyz;
vec3 diffuse = gl_Color.rgb * max(0.0, dot(N, l));
float shadow_factor = 1.0;
// Shadow
if ( quality_level >= 3.0 ) {
dp += ds * d;
vec3 sl = normalize( vec3( dot( l, VTangent ), dot( l, VBinormal ), dot( -l, VNormal ) ) );
ds = sl.xy * depth_factor / sl.z;
dp -= ds * d;
float dl = ray_intersect(dp, ds);
if ( dl < d - 0.05 )
shadow_factor = dot( constantColor.xyz, vec3( 1.0, 1.0, 1.0 ) ) * 0.25;
}
// end shadow
// Shadow
if ( quality_level >= 3.0 ) {
dp += ds * d;
vec3 sl = normalize( vec3( dot( l, VTangent ), dot( l, VBinormal ), dot( -l, VNormal ) ) );
ds = sl.xy * depth_factor / sl.z;
dp -= ds * d;
float dl = ray_intersect(dp, ds);
if ( dl < d - 0.05 )
shadow_factor = dot( constantColor.xyz, vec3( 1.0, 1.0, 1.0 ) ) * 0.25;
}
// end shadow
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;
if ( shadow_factor < 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;
vec4 tc = texture2D(BaseTex, uv);
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));
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;
if ( shadow_factor < 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;
vec4 tc = texture2D(BaseTex, uv);
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));
float fogFactor;
float fogCoord = ecPos3.z / (1.0 + smoothstep(0.3, 0.7, emission_factor));
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);
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale);
vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale);
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale);
float n=0.06;
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 += 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;
n += noisevec[2]*0.8;
n += noisevec[3]*2.1;
n = mix(0.6, n, length(ecPosition.xyz) );
n += noisevec[2]*0.8;
n += noisevec[3]*2.1;
n = mix(0.6, n, fogFactor);
vec4 finalColor = texture2D(BaseTex, uv);
finalColor = mix(finalColor, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0),
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);
finalColor = mix(finalColor, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0),
step(0.8,Nz)*(1.0-emis)*smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0));
finalColor *= ambient_light;
vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depth_factor / s.z, 1.0 );
vec4 iproj = gl_ProjectionMatrix * p;
iproj /= iproj.w;
if (gl_Fog.density == 1.0)
fogFactor=1.0;
finalColor.rgb = fog_Func(finalColor.rgb, fogType);
gl_FragColor = finalColor;
vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depth_factor / s.z, 1.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;
gl_FragDepth = (iproj.z+1.0)/2.0;
}

View file

@ -12,6 +12,12 @@ varying vec4 constantColor;
attribute vec3 tangent, binormal;
////fog "include"////////
uniform int fogType;
void fog_Func(int type);
/////////////////////////
void main(void)
{
rawpos = gl_Vertex;
@ -25,4 +31,5 @@ void main(void)
+ gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
gl_Position = ftransform();
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
// 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 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;
/////// 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 );
}
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.4 + 0.6 * smoothstep(0.0, 5.0, windEffect); //low windspeed wave filter
float waveRoughness = 0.15 + smoothstep(0.0, 15.0, windEffect); //wave roughness filter
//float noise_factor = 0.2 + 0.15 * smoothstep(0.0, 40.0, windEffect);
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, 0.3) * waveRoughness);
vNorm = -vNorm; //dds fix
//load reflection
vec4 tmp = vec4(lightdir, 0.0);
vec4 refTex;
vec4 refl;
// cover = 0;
if(cover >= 1.5){
refTex = texture2D(water_reflection, vec2(tmp));
refl= normalize(refTex);
} else {
refTex = texture2D(water_reflection_grey, vec2(tmp));
refl = normalize(refTex);
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(waterTex2 * 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;
vec3 N = normalize(mix(Normal + N0 , Normal + N1, 0.3) * 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;
}
float foamSlope = 0.1 + 0.1 * windScale;
if (windEffect >= 10.0)
if (N.g >= foamSlope){
vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 30.0);
finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(foamSlope, 0.25, N.g));
}
finalColor *= ambient_light;
gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor);
}
// 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 ;
////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 );
}
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.05 + smoothstep(0.0, 20.0, windEffect); //wave roughness filter
float mixFactor = 0.75 - 0.15 * smoothstep(0.0, 40.0, windEffect);
mixFactor = clamp(mixFactor, 0.3, 0.8);
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
rotationmatrix(radians(3.0 * windScale + 0.6 * sin(waterTex1.s * 0.2)), RotationMatrix);
vec4 nmap = texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0;
vec4 nmap1 = texture2D(perlin_normalmap, vec2(waterTex1/** RotationMatrix*/ + disdis * sca2) * windScale) * 2.0 - 1.0;
rotationmatrix(radians(-2.0 * windScale -0.4 * sin(waterTex1.s * 0.32)), RotationMatrix);
nmap += texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 1.5) * 2.0 - 1.0;
//nmap1 += texture2D(perlin_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0;
rotationmatrix(radians(1.5 * windScale + 0.3 * sin(waterTex1.s * 0.16)), RotationMatrix);
nmap += texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 2.1) * 2.0 - 1.0;
rotationmatrix(radians(-0.5 * windScale - 0.45 * sin(waterTex1.s * 0.28)), RotationMatrix);
nmap += texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 0.8) * 2.0 - 1.0;
rotationmatrix(radians(-1.2 * windScale - 0.35 * sin(waterTex1.s * 0.28)), RotationMatrix);
nmap += texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix* tscale) * windScale * 1.7) * 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;
vNorm = -vNorm; //dds fix
//load reflection
vec4 tmp = vec4(lightdir, 0.0);
vec4 refTex;
vec4 refl;
// cover = 0;
if(cover >= 1.5){
refTex = texture2D(water_reflection, vec2(tmp));
refl= normalize(refTex);
} else {
refTex = texture2D(water_reflection_grey, vec2(tmp));
refl = normalize(refTex);
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;
}
rotationmatrix(radians(2.1* windScale + 0.25 * sin(waterTex1.s *0.14)), RotationMatrix);
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);
rotationmatrix(radians(-1.5 * windScale -0.32 * sin(waterTex1.s *0.24)), RotationMatrix);
N0 += vec3(texture2D(water_normalmap, vec2(waterTex2* RotationMatrix * tscale) * windScale * 1.8) * 2.0 - 1.0);
N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2/** RotationMatrix*/ * tscale) * windScale) * 2.0 - 1.0);
rotationmatrix(radians(3.8 * windScale + 0.45 * sin(waterTex1.s *0.32)), RotationMatrix);
N0 += vec3(texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix * (tscale + sca2)) * windScale * 0.85) * 2.0 - 1.0);
N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2/** RotationMatrix*/ * (tscale + sca2)) * windScale) * 2.0 - 1.0);
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);
N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex1 /** RotationMatrix*/ + disdis * sca) * windScale) * 2.0 - 1.0);
N0 *= windEffect_low;
N1 *= windEffect_low;
vec3 N = normalize(mix(Normal + N0, Normal + N1, mixFactor) * waveRoughness);
//N.r += ddx;
//N.g += ddy;
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;
}
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 WindE, WindN;
////fog "include"////////
uniform int fogType;
void fog_Func(int type);
/////////////////////////
/////// functions /////////
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 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 = atan(-WindN + 0.001, WindE + 0.001) - atan(1.0);
float Angle;
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);
waterTex1 = gl_MultiTexCoord0 * RotationMatrix - t1 * windFactor;
@ -54,5 +66,6 @@ void main(void)
rotationmatrix(Angle, RotationMatrix);
waterTex2 = gl_MultiTexCoord0 * RotationMatrix - t2 * windFactor;
fog_Func(fogType);
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>
<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>
<layout>hbox</layout>
<text>
@ -350,205 +341,169 @@
<stretch>true</stretch>
</hrule>
</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>
<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>
<label>Performance vs Quality</label>
<enable>
<property>/sim/rendering/shader-effects</property>
</enable>
<label>Performance</label>
</text>
<slider>
<name>quality-level</name>
<enable>
<property>/sim/rendering/shader-effects</property>
</enable>
<min>0.0</min>
<max>5.0</max>
<step>0.5</step>
<property>/sim/rendering/quality-level</property>
<step>1.0</step>
<property>/sim/rendering/shaders/quality-level</property>
<binding>
<command>dialog-apply</command>
<object-name>quality-level</object-name>
</binding>
</slider>
<text>
<enable>
<property>/sim/rendering/shader-effects</property>
</enable>
<label>Quality</label>
</text>
<text>
<label>12345678</label>
<format>%.1f</format>
<format>(%1.0f)</format>
<live>true</live>
<property>/sim/rendering/quality-level</property>
<property>/sim/rendering/shaders/quality-level</property>
</text>
</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>
<layout>hbox</layout>
<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>
<halign>left</halign>
<color>
<red>1.0</red>
<green>0.6</green>
<blue>0.6</blue>
<alpha>1</alpha>
</color>
</text>
<hrule>
@ -558,15 +513,14 @@
<group>
<layout>vbox</layout>
<padding>10</padding>
<checkbox>
<halign>left</halign>
<enable>
<property>/sim/rendering/shaders/quality-level</property>
</enable>
<label>Skydome scattering</label>
<name>skydome-scattering</name>
<enable>
<property>/sim/rendering/shader-effects</property>
</enable>
<property>/sim/rendering/scattering-shader</property>
<property>/sim/rendering/shaders/skydome</property>
<binding>
<command>dialog-apply</command>
<object-name>skydome-scattering</object-name>
@ -580,13 +534,19 @@
<text>
<label>Mie factor</label>
<enable>
<property>/sim/rendering/shader-effects</property>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable>
</text>
<slider>
<name>mie-factor</name>
<enable>
<property>/sim/rendering/shader-effects</property>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable>
<min>0.0</min>
<max>0.01</max>
@ -599,7 +559,10 @@
</slider>
<text>
<enable>
<property>/sim/rendering/shader-effects</property>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable>
<label>12345678</label>
<format>%.3f</format>
@ -614,13 +577,19 @@
<text>
<label>Rayleigh factor</label>
<enable>
<property>/sim/rendering/shader-effects</property>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable>
</text>
<slider>
<name>rayleigh-factor</name>
<enable>
<property>/sim/rendering/shader-effects</property>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable>
<min>0.0</min>
<max>0.001</max>
@ -633,7 +602,10 @@
</slider>
<text>
<enable>
<property>/sim/rendering/shader-effects</property>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable>
<label>12345678</label>
<format>%.4f</format>
@ -648,13 +620,19 @@
<text>
<label>Density factor</label>
<enable>
<property>/sim/rendering/shader-effects</property>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable>
</text>
<slider>
<name>density-factor</name>
<enable>
<property>/sim/rendering/shader-effects</property>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable>
<min>0.0</min>
<max>1.0</max>
@ -667,7 +645,10 @@
</slider>
<text>
<enable>
<property>/sim/rendering/shader-effects</property>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<property>/sim/rendering/shaders/skydome</property>
</and>
</enable>
<label>12345678</label>
<format>%.1f</format>
@ -675,6 +656,10 @@
<property>/sim/rendering/dome-density</property>
</text>
</group>
<empty>
<stretch>1</stretch>
</empty>
</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>ShrubGrassCover</name>
<name>ScrubCover</name>
<name>Scrub</name>
<name>Sclerophyllous</name>
<name>Heath</name>
<texture>Terrain/shrub.dds</texture>
@ -2554,7 +2553,6 @@ Shared parameters for various materials.
<name>ShrubCover</name>
<name>ShrubGrassCover</name>
<name>ScrubCover</name>
<name>Scrub</name>
<name>Sclerophyllous</name>
<name>Heath</name>
<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>
<realism type="int">5</realism>
<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"
userarchive="y">0.003</mie>
<rayleigh type="float"