|
From: <fli...@li...> - 2017-03-06 10:22:08
|
trenk pushed a commit to branch next
in repository fgdata.
The following commit(s) were added to refs/heads/next by this push:
new 58ef0ce ALS road shader development
58ef0ce is described below
SF URL: http://sourceforge.net/p/flightgear/fgdata/ci/58ef0ce99889e78c13db890f55ae3522bf91e703/
Commit: 58ef0ce99889e78c13db890f55ae3522bf91e703
Author: Thorsten Renk
Committer: Thorsten Renk
AuthorDate: Mon Mar 6 12:21:54 2017 +0200
ALS road shader development
---
Effects/road.eff | 948 +++++++++++++++++++++++++++++++++++++++++++-
Shaders/road-ALS-ultra.frag | 142 +++++--
defaults.xml | 5 +
3 files changed, 1047 insertions(+), 48 deletions(-)
diff --git a/Effects/road.eff b/Effects/road.eff
index 3c425bb..98a32b2 100644
--- a/Effects/road.eff
+++ b/Effects/road.eff
@@ -4,12 +4,946 @@
<name>Effects/road</name>
<inherits-from>Effects/model-combined-deferred</inherits-from>
+ <parameters>
+ <texture n="7">
+ <image>Textures/Terrain/grain_texture.png</image>
+ <type>2d</type>
+ <filter>linear-mipmap-linear</filter>
+ <wrap-s>repeat</wrap-s>
+ <wrap-t>repeat</wrap-t>
+ <internal-format>normalized</internal-format>
+ </texture>
+ <grain-texture-enabled type="int">0</grain-texture-enabled>
+ <grain-magnification type="float">50</grain-magnification>
+ <road-traffic-enabled><use>/sim/rendering/osm/road-traffic-enabled</use></road-traffic-enabled>
+ <road-traffic-density><use>/sim/rendering/osm/road-traffic-density</use></road-traffic-density>
+ </parameters>
+
+ <technique n="3">
+ <predicate>
+ <and>
+ <property>/sim/rendering/shaders/skydome</property>
+ <property>/sim/rendering/shaders/quality-level</property>
+ <property>/sim/rendering/shaders/model</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>
+ <blend>
+ <use>transparent</use>
+ </blend>
+ <alpha-test>
+ <use>transparent</use>
+ </alpha-test>
+ <render-bin>
+ <bin-number>
+ <use>render-bin/bin-number</use>
+ </bin-number>
+ <bin-name>
+ <use>render-bin/bin-name</use>
+ </bin-name>
+ </render-bin>
+ <!-- Diffuse texture unit-->
+ <texture-unit>
+ <unit>0</unit>
+ <image>
+ <use>texture[0]/image</use>
+ </image>
+ <type>
+ <use>texture[0]/type</use>
+ </type>
+ <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>
+ <!-- Reflection Noise texture unit-->
+ <texture-unit>
+ <unit>1</unit>
+ <type>noise</type>
+ </texture-unit>
+ <!-- NormalMap texture unit-->
+ <texture-unit>
+ <unit>2</unit>
+ <image>
+ <use>texture[2]/image</use>
+ </image>
+ <type>
+ <use>texture[2]/type</use>
+ </type>
+ <filter>
+ <use>texture[2]/filter</use>
+ </filter>
+ <wrap-s>
+ <use>texture[2]/wrap-s</use>
+ </wrap-s>
+ <wrap-t>
+ <use>texture[2]/wrap-t</use>
+ </wrap-t>
+ <internal-format>
+ <use>texture[2]/internal-format</use>
+ </internal-format>
+ </texture-unit>
+
+ <!-- ReflectMap texture unit-->
+ <texture-unit>
+ <unit>4</unit>
+ <image>
+ <use>texture[4]/image</use>
+ </image>
+ <type>
+ <use>texture[4]/type</use>
+ </type>
+ <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 gradients texture unit-->
+ <texture-unit>
+ <unit>6</unit>
+ <image>
+ <use>texture[6]/image</use>
+ </image>
+ <type>
+ <use>texture[6]/type</use>
+ </type>
+ <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>
+ <!-- Grain texture -->
+ <texture-unit>
+ <unit>7</unit>
+ <image>
+ <use>texture[7]/image</use>
+ </image>
+ <type>
+ <use>texture[7]/type</use>
+ </type>
+ <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>
+
+ <vertex-program-two-side>
+ <use>vertex-program-two-side</use>
+ </vertex-program-two-side>
+
+ <program>
+ <vertex-shader>Shaders/model-ALS-ultra.vert</vertex-shader>
+ <fragment-shader>Shaders/road-ALS-ultra.frag</fragment-shader>
+ <fragment-shader>Shaders/cloud-shadowfunc.frag</fragment-shader>
+ <fragment-shader>Shaders/hazes.frag</fragment-shader>
+ <fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
+ <fragment-shader>Shaders/noise.frag</fragment-shader>
+ <fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
+ </program>
+
+ <uniform>
+ <name>BaseTex</name>
+ <type>sampler-2d</type>
+ <value type="int">0</value>
+ </uniform>
+
+ <uniform>
+ <name>ReflNoiseTex</name>
+ <type>sampler-3d</type>
+ <value type="int">1</value>
+ </uniform>
+
+ <uniform>
+ <name>NormalTex</name>
+ <type>sampler-2d</type>
+ <value type="int">2</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>ReflGradientsTex</name>
+ <type>sampler-2d</type>
+ <value type="int">6</value>
+ </uniform>
+
+ <uniform>
+ <name>GrainTex</name>
+ <type>sampler-2d</type>
+ <value type="int">7</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>
+
+ <uniform>
+ <name>nmap_tile</name>
+ <type>float</type>
+ <value>
+ <use>normalmap-tiling</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>
+
+ <!-- Fresnel reflectivity -->
+ <uniform>
+ <name>refl_fresnel_factor</name>
+ <type>float</type>
+ <value>
+ <use>reflection-fresnel-factor</use>
+ </value>
+ </uniform>
+
+ <!-- use a reflection map-->
+ <uniform>
+ <name>refl_map</name>
+ <type>int</type>
+ <value>
+ <use>reflect-map-enabled</use>
+ </value>
+ </uniform>
+
+ <!-- how are colors merged in a reflection-->
+ <uniform>
+ <name>refl_type</name>
+ <type>int</type>
+ <value>
+ <use>reflection-type</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>
+
+ <!-- dirt -->
+ <uniform>
+ <name>dirt_enabled</name>
+ <type>int</type>
+ <value>
+ <use>dirt-enabled</use>
+ </value>
+ </uniform>
+
+ <uniform>
+ <name>dirt_multi</name>
+ <type>int</type>
+ <value>
+ <use>dirt-multi</use>
+ </value>
+ </uniform>
+
+ <uniform>
+ <name>dirt_r_color</name>
+ <type>float-vec3</type>
+ <value>
+ <use>dirt-color[0]</use>
+ </value>
+ </uniform>
+
+ <uniform>
+ <name>dirt_r_factor</name>
+ <type>float</type>
+ <value>
+ <use>dirt-factor[0]</use>
+ </value>
+ </uniform>
+
+ <uniform>
+ <name>dirt_g_color</name>
+ <type>float-vec3</type>
+ <value>
+ <use>dirt-color[1]</use>
+ </value>
+ </uniform>
+
+ <uniform>
+ <name>dirt_g_factor</name>
+ <type>float</type>
+ <value>
+ <use>dirt-factor[1]</use>
+ </value>
+ </uniform>
+
+ <uniform>
+ <name>dirt_b_color</name>
+ <type>float-vec3</type>
+ <value>
+ <use>dirt-color[2]</use>
+ </value>
+ </uniform>
+
+ <uniform>
+ <name>dirt_b_factor</name>
+ <type>float</type>
+ <value>
+ <use>dirt-factor[2]</use>
+ </value>
+ </uniform>
+
+ <!-- road traffic -->
+ <uniform>
+ <name>road_traffic_enabled</name>
+ <type>int</type>
+ <value>
+ <use>road-traffic-enabled</use>
+ </value>
+ </uniform>
+
+ <uniform>
+ <name>road_traffic_density</name>
+ <type>float</type>
+ <value>
+ <use>road-traffic-density</use>
+ </value>
+ </uniform>
+
+
+ <!-- use a grain texture map-->
+ <uniform>
+ <name>grain_texture_enabled</name>
+ <type>int</type>
+ <value>
+ <use>grain-texture-enabled</use>
+ </value>
+ </uniform>
+
+ <uniform>
+ <name>grain_magnification</name>
+ <type>float</type>
+ <value>
+ <use>grain-magnification</use>
+ </value>
+ </uniform>
+
+ <!-- simulate wetness and rain-->
+ <uniform>
+ <name>rain_enabled</name>
+ <type>int</type>
+ <value>
+ <use>rain-enabled</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>
+
+ <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>ground_scattering</name>
+ <type>float</type>
+ <value>
+ <use>ground_scattering</use>
+ </value>
+ </uniform>
+ <uniform>
+ <name>terminator</name>
+ <type>float</type>
+ <value>
+ <use>terminator</use>
+ </value>
+ </uniform>
+ <uniform>
+ <name>terrain_alt</name>
+ <type>float</type>
+ <value>
+ <use>terrain_alt</use>
+ </value>
+ </uniform>
+ <uniform>
+ <name>overcast</name>
+ <type>float</type>
+ <value>
+ <use>overcast</use>
+ </value>
+ </uniform>
+ <uniform>
+ <name>eye_alt</name>
+ <type>float</type>
+ <value>
+ <use>eye_alt</use>
+ </value>
+ </uniform>
+ <uniform>
+ <name>cloud_self_shading</name>
+ <type>float</type>
+ <value><use>cloud_self_shading</use></value>
+ </uniform>
+ <uniform>
+ <name>moonlight</name>
+ <type>float</type>
+ <value><use>moonlight</use></value>
+ </uniform>
+ <uniform>
+ <name>air_pollution</name>
+ <type>float</type>
+ <value><use>air_pollution</use></value>
+ </uniform>
+ <uniform>
+ <name>rain_norm</name>
+ <type>float</type>
+ <value><use>rnorm</use></value>
+ </uniform>
+ <uniform>
+ <name>wetness</name>
+ <type>float</type>
+ <value><use>wetness</use></value>
+ </uniform>
+ <uniform>
+ <name>view_pitch_offset</name>
+ <type>float</type>
+ <value><use>view_pitch_offset</use></value>
+ </uniform>
+ <uniform>
+ <name>view_heading_offset</name>
+ <type>float</type>
+ <value><use>view_heading_offset</use></value>
+ </uniform>
+ <uniform>
+ <name>field_of_view</name>
+ <type>float</type>
+ <value><use>view_fov</use></value>
+ </uniform>
+ <uniform>
+ <name>landing_light1_offset</name>
+ <type>float</type>
+ <value><use>landing_light1_offset</use></value>
+ </uniform>
+ <uniform>
+ <name>landing_light2_offset</name>
+ <type>float</type>
+ <value><use>landing_light2_offset</use></value>
+ </uniform>
+ <uniform>
+ <name>landing_light3_offset</name>
+ <type>float</type>
+ <value><use>landing_light3_offset</use></value>
+ </uniform>
+ <uniform>
+ <name>gamma</name>
+ <type>float</type>
+ <value><use>gamma</use></value>
+ </uniform>
+ <uniform>
+ <name>brightness</name>
+ <type>float</type>
+ <value><use>brightness</use></value>
+ </uniform>
+ <uniform>
+ <name>use_filtering</name>
+ <type>bool</type>
+ <value><use>use_filtering</use></value>
+ </uniform>
+ <uniform>
+ <name>use_night_vision</name>
+ <type>bool</type>
+ <value><use>use_night_vision</use></value>
+ </uniform>
+ <uniform>
+ <name>use_IR_vision</name>
+ <type>bool</type>
+ <value><use>use_IR_vision</use></value>
+ </uniform>
+ <uniform>
+ <name>delta_T</name>
+ <type>float</type>
+ <value><use>delta_T</use></value>
+ </uniform>
+ <uniform>
+ <name>fact_grey</name>
+ <type>float</type>
+ <value><use>fact_grey</use></value>
+ </uniform>
+ <uniform>
+ <name>fact_black</name>
+ <type>float</type>
+ <value><use>fact_black</use></value>
+ </uniform>
+
+ <!-- cloud shadows -->
+ <uniform>
+ <name>cloudpos1_x</name>
+ <type>float</type>
+ <value><use>cloudpos1_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos1_y</name>
+ <type>float</type>
+ <value><use>cloudpos1_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos2_x</name>
+ <type>float</type>
+ <value><use>cloudpos2_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos2_y</name>
+ <type>float</type>
+ <value><use>cloudpos2_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos3_x</name>
+ <type>float</type>
+ <value><use>cloudpos3_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos3_y</name>
+ <type>float</type>
+ <value><use>cloudpos3_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos4_x</name>
+ <type>float</type>
+ <value><use>cloudpos4_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos4_y</name>
+ <type>float</type>
+ <value><use>cloudpos4_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos5_x</name>
+ <type>float</type>
+ <value><use>cloudpos5_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos5_y</name>
+ <type>float</type>
+ <value><use>cloudpos5_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos6_x</name>
+ <type>float</type>
+ <value><use>cloudpos6_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos6_y</name>
+ <type>float</type>
+ <value><use>cloudpos6_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos7_x</name>
+ <type>float</type>
+ <value><use>cloudpos7_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos7_y</name>
+ <type>float</type>
+ <value><use>cloudpos7_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos8_x</name>
+ <type>float</type>
+ <value><use>cloudpos8_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos8_y</name>
+ <type>float</type>
+ <value><use>cloudpos8_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos9_x</name>
+ <type>float</type>
+ <value><use>cloudpos9_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos9_y</name>
+ <type>float</type>
+ <value><use>cloudpos9_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos10_x</name>
+ <type>float</type>
+ <value><use>cloudpos10_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos10_y</name>
+ <type>float</type>
+ <value><use>cloudpos10_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos11_x</name>
+ <type>float</type>
+ <value><use>cloudpos11_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos11_y</name>
+ <type>float</type>
+ <value><use>cloudpos11_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos12_x</name>
+ <type>float</type>
+ <value><use>cloudpos12_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos12_y</name>
+ <type>float</type>
+ <value><use>cloudpos12_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos13_x</name>
+ <type>float</type>
+ <value><use>cloudpos13_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos13_y</name>
+ <type>float</type>
+ <value><use>cloudpos13_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos14_x</name>
+ <type>float</type>
+ <value><use>cloudpos14_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos14_y</name>
+ <type>float</type>
+ <value><use>cloudpos14_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos15_x</name>
+ <type>float</type>
+ <value><use>cloudpos15_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos15_y</name>
+ <type>float</type>
+ <value><use>cloudpos15_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos16_x</name>
+ <type>float</type>
+ <value><use>cloudpos16_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos16_y</name>
+ <type>float</type>
+ <value><use>cloudpos16_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos17_x</name>
+ <type>float</type>
+ <value><use>cloudpos17_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos17_y</name>
+ <type>float</type>
+ <value><use>cloudpos17_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos18_x</name>
+ <type>float</type>
+ <value><use>cloudpos18_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos18_y</name>
+ <type>float</type>
+ <value><use>cloudpos18_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos19_x</name>
+ <type>float</type>
+ <value><use>cloudpos19_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos19_y</name>
+ <type>float</type>
+ <value><use>cloudpos19_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos20_x</name>
+ <type>float</type>
+ <value><use>cloudpos20_x</use></value>
+ </uniform>
+ <uniform>
+ <name>cloudpos20_y</name>
+ <type>float</type>
+ <value><use>cloudpos20_y</use></value>
+ </uniform>
+ <uniform>
+ <name>cloud_shadow_flag</name>
+ <type>int</type>
+ <value><use>cloud_shadow_flag</use></value>
+ </uniform>
+ <uniform>
+ <name>use_searchlight</name>
+ <type>int</type>
+ <value><use>use_searchlight</use></value>
+ </uniform>
+ <uniform>
+ <name>use_landing_light</name>
+ <type>int</type>
+ <value><use>use_landing_light</use></value>
+ </uniform>
+ <uniform>
+ <name>use_alt_landing_light</name>
+ <type>int</type>
+ <value><use>use_alt_landing_light</use></value>
+ </uniform>
+ <uniform>
+ <name>display_xsize</name>
+ <type>int</type>
+ <value><use>display_xsize</use></value>
+ </uniform>
+ <uniform>
+ <name>display_ysize</name>
+ <type>int</type>
+ <value><use>display_ysize</use></value>
+ </uniform>
+
+
+
+ </pass>
+ </technique>
+
- <technique n="4">
- <pass>
- <program>
- <fragment-shader n="0">Shaders/road-ALS-ultra.frag</fragment-shader>
- </program>
- </pass>
- </technique>
</PropertyList>
diff --git a/Shaders/road-ALS-ultra.frag b/Shaders/road-ALS-ultra.frag
index d495fe6..424cd5d 100644
--- a/Shaders/road-ALS-ultra.frag
+++ b/Shaders/road-ALS-ultra.frag
@@ -20,7 +20,7 @@ varying vec3 vertVec;
varying float alpha;
uniform sampler2D BaseTex;
-uniform sampler2D LightMapTex;
+//uniform sampler2D LightMapTex;
uniform sampler2D NormalTex;
uniform sampler2D ReflMapTex;
uniform sampler2D ReflGradientsTex;
@@ -30,8 +30,8 @@ uniform sampler2D GrainTex;
uniform int dirt_enabled;
uniform int dirt_multi;
-uniform int lightmap_enabled;
-uniform int lightmap_multi;
+//uniform int lightmap_enabled;
+//uniform int lightmap_multi;
uniform int nmap_dds;
uniform int nmap_enabled;
uniform int refl_enabled;
@@ -39,6 +39,7 @@ uniform int refl_type;
uniform int refl_map;
uniform int grain_texture_enabled;
uniform int rain_enabled;
+uniform int road_traffic_enabled;
uniform int cloud_shadow_flag;
uniform int use_searchlight;
uniform int use_landing_light;
@@ -48,10 +49,10 @@ uniform float amb_correction;
uniform float dirt_b_factor;
uniform float dirt_g_factor;
uniform float dirt_r_factor;
-uniform float lightmap_a_factor;
-uniform float lightmap_b_factor;
-uniform float lightmap_g_factor;
-uniform float lightmap_r_factor;
+//uniform float lightmap_a_factor;
+//uniform float lightmap_b_factor;
+//uniform float lightmap_g_factor;
+//uniform float lightmap_r_factor;
uniform float nmap_tile;
uniform float refl_correction;
uniform float refl_fresnel;
@@ -61,6 +62,7 @@ uniform float refl_rainbow;
uniform float grain_magnification;
uniform float wetness;
uniform float rain_norm;
+uniform float road_traffic_density;
uniform float avisibility;
uniform float cloud_self_shading;
@@ -88,10 +90,10 @@ uniform bool use_IR_vision;
const float EarthRadius = 5800000.0;
const float terminator_width = 200000.0;
-uniform vec3 lightmap_r_color;
-uniform vec3 lightmap_g_color;
-uniform vec3 lightmap_b_color;
-uniform vec3 lightmap_a_color;
+//uniform vec3 lightmap_r_color;
+//uniform vec3 lightmap_g_color;
+//uniform vec3 lightmap_b_color;
+//uniform vec3 lightmap_a_color;
uniform vec3 dirt_r_color;
uniform vec3 dirt_g_color;
@@ -122,6 +124,59 @@ float light_func (in float x, in float a, in float b, in float c, in float d, in
}
+void road_type_mapper (in vec2 coord, out float rtype_traffic_density, out float rtype_base_illumination, out float rtype_traffic_speed)
+ {
+ if (coord.s < 0.125)
+ {
+ rtype_traffic_density = 0;
+ rtype_base_illumination = 0;
+ rtype_traffic_speed = 0.0;
+ }
+ else if (coord.s < 0.250)
+ {
+ rtype_traffic_density = 0.3;
+ rtype_base_illumination = 0.65;
+ rtype_traffic_speed = 0.5;
+ }
+ else if (coord.s < 0.375)
+ {
+ rtype_traffic_density = 1.0;
+ rtype_base_illumination = 1.0;
+ rtype_traffic_speed = 1.0;
+ }
+ else if (coord.s < 0.5)
+ {
+ rtype_traffic_density = 0.0;
+ rtype_base_illumination = 0.0;
+ rtype_traffic_speed = 0.0;
+ }
+ else if (coord.s < 0.625)
+ {
+ rtype_traffic_density = 0.0;
+ rtype_base_illumination = 0.0;
+ rtype_traffic_speed = 0.0;
+ }
+ else if (coord.s < 0.750)
+ {
+ rtype_traffic_density = 1.0;
+ rtype_base_illumination = 0.65;
+ rtype_traffic_speed = 1.0;
+ }
+ else if (coord.s < 0.875)
+ {
+ rtype_traffic_density = 0.1;
+ rtype_base_illumination = 0.0;
+ rtype_traffic_speed = 0.3;
+ }
+ else
+ {
+ rtype_traffic_density = 0.0;
+ rtype_base_illumination = 0.0;
+ rtype_traffic_speed = 0.0;
+ }
+
+
+ }
@@ -131,14 +186,19 @@ void main (void)
vec4 nmap = texture2D(NormalTex, gl_TexCoord[0].st * nmap_tile);
vec4 reflmap = texture2D(ReflMapTex, gl_TexCoord[0].st);
vec4 noisevec = texture3D(ReflNoiseTex, rawpos.xyz);
- vec4 lightmapTexel = texture2D(LightMapTex, gl_TexCoord[0].st);
vec4 grainTexel;
vec3 mixedcolor;
vec3 N = vec3(0.0,0.0,1.0);
-
+ // road type characteristics
+
+ float rtype_traffic_density = 0.0;
+ float rtype_base_illumination = 0.0;
+ float rtype_traffic_speed = 0.0;
+ road_type_mapper (gl_TexCoord[0].st, rtype_traffic_density, rtype_base_illumination, rtype_traffic_speed);
+
float pf = 0.0;
float pf1 = 0.0;
///some generic light scattering parameters
@@ -151,9 +211,7 @@ void main (void)
/// BEGIN geometry for light
vec3 up = (gl_ModelViewMatrix * vec4(0.0,0.0,1.0,0.0)).xyz;
- //vec4 worldPos3D = (osg_ViewMatrixInverse * vec4 (0.0,0.0,0.0, 1.0));
- //worldPos3D.a = 0.0;
- //vec3 up = (osg_ViewMatrix * worldPos3D).xyz;
+
float dist = length(vertVec);
float vertex_alt = max(100.0,dot(up, vertVec) + alt);
float vertex_scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt);
@@ -443,6 +501,7 @@ void main (void)
//////////////////////////////////////////////////////////////////////
// BEGIN lightmap
//////////////////////////////////////////////////////////////////////
+ /*
if ( lightmap_enabled >= 1 ) {
vec3 lightmapcolor = vec3(0.0);
vec4 lightmapFactor = vec4(lightmap_r_factor, lightmap_g_factor,
@@ -465,6 +524,7 @@ void main (void)
}
fragColor.rgb = max(fragColor.rgb, lightmapcolor * gl_FrontMaterial.diffuse.rgb * smoothstep(0.0, 1.0, mixedcolor*.5 + lightmapcolor*.5));
}
+ */
//////////////////////////////////////////////////////////////////////
// END lightmap
/////////////////////////////////////////////////////////////////////
@@ -474,8 +534,8 @@ void main (void)
//////////////////////////////////////////////////////////////////////
- if (0==1)
- {
+
+
vec2 roadCoords = gl_TexCoord[0].st;
roadCoords.s *=8.0;
roadCoords.s = fract(roadCoords.s);
@@ -484,35 +544,38 @@ void main (void)
vec3 pLMColor = vec3 (0.941, 0.682, 0.086);
float pLMIntensity = smoothstep(0.0, 0.4, roadCoords.s) * (1.0 - smoothstep(0.6, 1.0, roadCoords.s));
- pLMIntensity = 0.5 + 0.1 * max(0.0,sin(4.0 * roadCoords.t));
+ pLMIntensity = 0.5 * rtype_base_illumination + 0.1 * max(0.0,sin(4.0 * roadCoords.t));
pLMColor *= pLMIntensity;
- float cSign = 1.0;
- if (roadCoords.s > 0.5) {cSign = -1.0;}
+ if (road_traffic_enabled == 1)
+ {
+ float cSign = 1.0;
+ if (roadCoords.s > 0.5) {cSign = -1.0;}
- roadCoords.t += 0.2 * osg_SimulationTime * cSign;
- float cTag = fract(roadCoords.t * 10.0);
- float cDomain = roadCoords.t * 10.0 - cTag;
- float cRnd = rand2D(vec2 (0.1 * cDomain, 1.0));
+ roadCoords.t += 0.2 * osg_SimulationTime * cSign * rtype_traffic_speed;
+ float cTag = fract(roadCoords.t * 10.0);
+ float cDomain = roadCoords.t * 10.0 - cTag;
+ float cRnd = rand2D(vec2 (0.1 * cDomain, cSign));
- float cPresent = 0.0;
- if (cRnd > 0.8) {cPresent = 1.0;}
+ float cPresent = 0.0;
+ if (cRnd > 1.0 - 0.2 * road_traffic_density * rtype_traffic_density) {cPresent = 1.0;}
- vec3 pCLColor = vec3 (0.95, 1.0, 1.0);
- float pCLIntensity = smoothstep(0.2, 0.5, cTag) * (1.0-smoothstep(0.5, 0.7, cTag));
- float laneFact = smoothstep(0.25, 0.3, roadCoords.s) * (1.0-smoothstep(0.3, 0.35, roadCoords.s));
- laneFact += smoothstep(0.35, 0.4, roadCoords.s) * (1.0-smoothstep(0.4, 0.45, roadCoords.s));
- laneFact += smoothstep(0.65, 0.7, roadCoords.s) * (1.0-smoothstep(0.7, 0.75, roadCoords.s));
- laneFact += smoothstep(0.75, 0.8, roadCoords.s) * (1.0-smoothstep(0.8, 0.85, roadCoords.s));
- pCLIntensity = pCLIntensity * laneFact * cPresent;
+ vec3 pCLColor = vec3 (0.95, 1.0, 1.0);
+ float pCLIntensity = smoothstep(0.2, 0.5, cTag) * (1.0-smoothstep(0.5, 0.7, cTag));
+ float laneFact = smoothstep(0.25, 0.3, roadCoords.s) * (1.0-smoothstep(0.3, 0.35, roadCoords.s));
+ laneFact += smoothstep(0.35, 0.4, roadCoords.s) * (1.0-smoothstep(0.4, 0.45, roadCoords.s));
+ laneFact += smoothstep(0.65, 0.7, roadCoords.s) * (1.0-smoothstep(0.7, 0.75, roadCoords.s));
+ laneFact += smoothstep(0.75, 0.8, roadCoords.s) * (1.0-smoothstep(0.8, 0.85, roadCoords.s));
+ pCLIntensity = pCLIntensity * laneFact * cPresent;
- pCLColor = pCLColor *= pCLIntensity;
+ pCLColor = pCLColor *= pCLIntensity;
- pLMColor = pLMColor + pCLColor;
+ pLMColor = pLMColor + pCLColor;
+ }
fragColor.rgb = max(fragColor.rgb, pLMColor * gl_FrontMaterial.diffuse.rgb * smoothstep(0.0, 1.0, mixedcolor*.5 + pLMColor*.5));
- }
+
//////////////////////////////////////////////////////////////////////
@@ -631,10 +694,7 @@ void main (void)
hazeColor = vec3 (1.0, 1.0, 1.0);
}
- if (use_IR_vision)
- {
- //hazeColor.rgb = max(hazeColor.rgb, vec3 (0.5, 0.5, 0.5));
- }
+
/// END fog color
diff --git a/defaults.xml b/defaults.xml
index b617331..359b5ee 100644
--- a/defaults.xml
+++ b/defaults.xml
@@ -368,6 +368,11 @@ Started September 2000 by David Megginson, da...@me...
<black-factor type="float">0.0</black-factor>
</als-filters>
+ <osm>
+ <road-traffic-enabled type="bool">true</road-traffic-enabled>
+ <road-traffic-density type="float">1.0</road-traffic-density>
+ </osm>
+
<scenery-path-suffix>
<name type="string">Pylons</name>
<enabled type="bool" userarchive="y">false</enabled>
|