ALS terrain overlay shaders, not yet used, terrain definitions will follow post-release
This commit is contained in:
parent
f8dc5cd7c7
commit
7df5690f08
4 changed files with 1173 additions and 2 deletions
918
Effects/terrain-overlay.eff
Normal file
918
Effects/terrain-overlay.eff
Normal file
|
@ -0,0 +1,918 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PropertyList>
|
||||
<name>Effects/terrain-overlay</name>
|
||||
<inherits-from>Effects/terrain-default</inherits-from>
|
||||
|
||||
<parameters>
|
||||
|
||||
<texture n="20">
|
||||
<image>Textures/Terrain/void.png</image>
|
||||
<type>2d</type>
|
||||
<filter>nearest-mipmap-nearest</filter>
|
||||
<mag-filter>nearest</mag-filter>
|
||||
<wrap-s>repeat</wrap-s>
|
||||
<wrap-t>repeat</wrap-t>
|
||||
<internal-format>normalized</internal-format>
|
||||
</texture>
|
||||
|
||||
<texture n="21">
|
||||
<image>Textures/Terrain/void.png</image>
|
||||
<type>2d</type>
|
||||
<filter>nearest-mipmap-nearest</filter>
|
||||
<mag-filter>nearest</mag-filter>
|
||||
<wrap-s>repeat</wrap-s>
|
||||
<wrap-t>repeat</wrap-t>
|
||||
<internal-format>normalized</internal-format>
|
||||
</texture>
|
||||
|
||||
<max_overlay_height>1.5</max_overlay_height>
|
||||
<overlay_scale>1.0</overlay_scale>
|
||||
<overlay_brightness_top>1.0</overlay_brightness_top>
|
||||
<overlay_brightness_bottom>0.5</overlay_brightness_bottom>
|
||||
<overlay_hardness>0.5</overlay_hardness>
|
||||
<overlay_secondary_hardness>0.5</overlay_secondary_hardness>
|
||||
<overlay_density>0.5</overlay_density>
|
||||
<overlay_steepness_factor>0.8</overlay_steepness_factor>
|
||||
<overlay_secondary_density>0.0</overlay_secondary_density>
|
||||
<overlay_autumn_flag>0</overlay_autumn_flag>
|
||||
<overlay_secondary_flag>0</overlay_secondary_flag>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</parameters>
|
||||
|
||||
<technique n="2">
|
||||
<predicate>
|
||||
<and>
|
||||
<property>/sim/rendering/shaders/skydome</property>
|
||||
<and>
|
||||
<less-equal>
|
||||
<value type="float">6.0</value>
|
||||
<float-property>/sim/rendering/shaders/landmass</float-property>
|
||||
</less-equal>
|
||||
<less-equal>
|
||||
<value type="float">6.0</value>
|
||||
<float-property>/sim/rendering/shaders/transition</float-property>
|
||||
</less-equal>
|
||||
<less-equal>
|
||||
<value type="float">1.0</value>
|
||||
<float-property>/sim/rendering/shaders/vegetation-effects</float-property>
|
||||
</less-equal>
|
||||
</and>
|
||||
<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>
|
||||
<extension-supported>GL_EXT_geometry_shader4</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>
|
||||
<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>
|
||||
<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>
|
||||
<texture-unit>
|
||||
<unit>2</unit>
|
||||
<image><use>texture[13]/image</use></image>
|
||||
<type><use>texture[13]/type</use></type>
|
||||
<filter><use>texture[13]/filter</use></filter>
|
||||
<wrap-s><use>texture[13]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[13]/wrap-t</use></wrap-t>
|
||||
<internal-format><use>texture[13]/internal-format</use></internal-format>
|
||||
</texture-unit>
|
||||
<texture-unit>
|
||||
<unit>3</unit>
|
||||
<type><use>texture[15]/type</use></type>
|
||||
<image><use>texture[15]/image</use></image>
|
||||
<filter><use>texture[15]/filter</use></filter>
|
||||
<wrap-s><use>texture[15]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[15]/wrap-t</use></wrap-t>
|
||||
<internal-format><use>texture[15]/internal-format</use></internal-format>
|
||||
</texture-unit>
|
||||
<texture-unit>
|
||||
<unit>4</unit>
|
||||
<type><use>texture[14]/type</use></type>
|
||||
<image><use>texture[14]/image</use></image>
|
||||
<filter><use>texture[14]/filter</use></filter>
|
||||
<wrap-s><use>texture[14]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[14]/wrap-t</use></wrap-t>
|
||||
<internal-format><use>texture[14]/internal-format</use></internal-format>
|
||||
</texture-unit>
|
||||
<texture-unit>
|
||||
<unit>5</unit>
|
||||
<type><use>texture[12]/type</use></type>
|
||||
<image><use>texture[12]/image</use></image>
|
||||
<filter><use>texture[12]/filter</use></filter>
|
||||
<wrap-s><use>texture[12]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[12]/wrap-t</use></wrap-t>
|
||||
<internal-format><use>texture[12]/internal-format</use></internal-format>
|
||||
</texture-unit>
|
||||
<texture-unit>
|
||||
<unit>7</unit>
|
||||
<type><use>texture[11]/type</use></type>
|
||||
<image><use>texture[11]/image</use></image>
|
||||
<filter><use>texture[11]/filter</use></filter>
|
||||
<wrap-s><use>texture[11]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[11]/wrap-t</use></wrap-t>
|
||||
<internal-format><use>texture[11]/internal-format</use></internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/terrain-ALS-ultra.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/terrain-ALS-ultra.frag</fragment-shader>
|
||||
<fragment-shader>Shaders/noise.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/filters-ALS.frag</fragment-shader>
|
||||
</program>
|
||||
<uniform>
|
||||
<name>grain_strength</name>
|
||||
<type>float</type>
|
||||
<value><use>grain_strength</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>intrinsic_wetness</name>
|
||||
<type>float</type>
|
||||
<value><use>intrinsic_wetness</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>transition_model</name>
|
||||
<type>float</type>
|
||||
<value><use>transition_model</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>hires_overlay_bias</name>
|
||||
<type>float</type>
|
||||
<value><use>hires_overlay_bias</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>dot_density</name>
|
||||
<type>float</type>
|
||||
<value><use>dot_density</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>dot_size</name>
|
||||
<type>float</type>
|
||||
<value><use>dot_size</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>dust_resistance</name>
|
||||
<type>float</type>
|
||||
<value><use>dust_resistance</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>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>eye_lat</name>
|
||||
<type>float</type>
|
||||
<value><use>eye_lat</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>eye_lon</name>
|
||||
<type>float</type>
|
||||
<value><use>eye_lon</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>snowlevel</name>
|
||||
<type>float</type>
|
||||
<value><use>snow_level</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>snow_thickness_factor</name>
|
||||
<type>float</type>
|
||||
<value><use>snow_thickness_factor</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>dust_cover_factor</name>
|
||||
<type>float</type>
|
||||
<value><use>dust_cover_factor</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>lichen_cover_factor</name>
|
||||
<type>float</type>
|
||||
<value> <use>lichen_cover_factor</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>wetness</name>
|
||||
<type>float</type>
|
||||
<value><use>wetness</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>fogstructure</name>
|
||||
<type>float</type>
|
||||
<value><use>fogstructure</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>season</name>
|
||||
<type>float</type>
|
||||
<value><use>season</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>air_pollution</name>
|
||||
<type>float</type>
|
||||
<value><use>air_pollution</use></value>
|
||||
</uniform>
|
||||
<!-- secondary lights -->
|
||||
<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>
|
||||
<!-- filtering -->
|
||||
<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_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>use_filtering</name>
|
||||
<type>bool</type>
|
||||
<value><use>use_filtering</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>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>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>
|
||||
<uniform>
|
||||
<name>wind_effects</name>
|
||||
<type>int</type>
|
||||
<value><use>wind_effects</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>cloud_shadow_flag</name>
|
||||
<type>int</type>
|
||||
<value><use>cloud_shadow_flag</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>rock_strata</name>
|
||||
<type>int</type>
|
||||
<value><use>rock_strata</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>raise_vertex</name>
|
||||
<type>bool</type>
|
||||
<value> <use>raise_vertex</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>texture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">0</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>mix_texture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">5</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>detail_texture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">7</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>grain_texture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">4</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>dot_texture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">3</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>gradient_texture</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">2</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>colorMode</name>
|
||||
<type>int</type>
|
||||
<value>2</value>
|
||||
<!-- AMBIENT_AND_DIFFUSE -->
|
||||
</uniform>
|
||||
<depth>
|
||||
<function>lequal</function>
|
||||
</depth>
|
||||
</pass>
|
||||
|
||||
<pass n="2">
|
||||
<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>
|
||||
<!--<alpha-to-coverage>true</alpha-to-coverage>-->
|
||||
|
||||
<cull-face>back</cull-face>
|
||||
<!--<render-bin>
|
||||
<bin-number>10</bin-number>
|
||||
<bin-name>GrassBin</bin-name>
|
||||
</render-bin>-->
|
||||
<render-bin>
|
||||
<bin-number>111</bin-number>
|
||||
<bin-name>DepthSortedBin</bin-name>
|
||||
</render-bin>
|
||||
<texture-unit>
|
||||
<unit>7</unit>
|
||||
<type><use>texture[20]/type</use></type>
|
||||
<image><use>texture[20]/image</use></image>
|
||||
<filter><use>texture[20]/filter</use></filter>
|
||||
<mag-filter><use>texture[20]/mag-filter</use></mag-filter>
|
||||
<wrap-s><use>texture[20]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[20]/wrap-t</use></wrap-t>
|
||||
<internal-format><use>texture[20]/internal-format</use></internal-format>
|
||||
</texture-unit>
|
||||
<texture-unit>
|
||||
<unit>8</unit>
|
||||
<type><use>texture[21]/type</use></type>
|
||||
<image><use>texture[21]/image</use></image>
|
||||
<filter><use>texture[21]/filter</use></filter>
|
||||
<mag-filter><use>texture[21]/mag-filter</use></mag-filter>
|
||||
<wrap-s><use>texture[21]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[21]/wrap-t</use></wrap-t>
|
||||
<internal-format><use>texture[21]/internal-format</use></internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/grass-ALS.vert</vertex-shader>
|
||||
<geometry-shader>Shaders/terrain-overlay-ALS.geom</geometry-shader>
|
||||
<fragment-shader>Shaders/terrain-overlay-ALS.frag</fragment-shader>
|
||||
<fragment-shader>Shaders/noise.frag</fragment-shader>
|
||||
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
|
||||
<fragment-shader>Shaders/cloud-shadowfunc.frag</fragment-shader>
|
||||
<geometry-vertices-out type="int">96</geometry-vertices-out>
|
||||
<geometry-input-type>triangles</geometry-input-type>
|
||||
<geometry-output-type>triangle-strip</geometry-output-type>
|
||||
</program>
|
||||
<uniform>
|
||||
<name>overlayPrimaryTex</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">7</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>overlaySecondaryTex</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">8</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>scattering</name>
|
||||
<type>float</type>
|
||||
<value><use>scattering</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>overlay_bias</name>
|
||||
<type>float</type>
|
||||
<value><use>overlay_bias</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>overlay_max_height</name>
|
||||
<type>float</type>
|
||||
<value><use>max_overlay_height</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>overlay_hardness</name>
|
||||
<type>float</type>
|
||||
<value><use>overlay_hardness</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>overlay_secondary_hardness</name>
|
||||
<type>float</type>
|
||||
<value><use>overlay_secondary_hardness</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>overlay_density</name>
|
||||
<type>float</type>
|
||||
<value><use>overlay_density</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>overlay_secondary_density</name>
|
||||
<type>float</type>
|
||||
<value><use>overlay_secondary_density</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>overlay_scale</name>
|
||||
<type>float</type>
|
||||
<value><use>overlay_scale</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>overlay_brightness_top</name>
|
||||
<type>float</type>
|
||||
<value><use>overlay_brightness_top</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>overlay_brightness_bottom</name>
|
||||
<type>float</type>
|
||||
<value><use>overlay_brightness_bottom</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>overlay_steepness_factor</name>
|
||||
<type>float</type>
|
||||
<value><use>overlay_steepness_factor</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>season</name>
|
||||
<type>float</type>
|
||||
<value><use>season</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>dust_cover_factor</name>
|
||||
<type>float</type>
|
||||
<value><use>dust_cover_factor</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>wetness</name>
|
||||
<type>float</type>
|
||||
<value><use>wetness</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>snowlevel</name>
|
||||
<type>float</type>
|
||||
<value><use>snow_level</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>snow_thickness_factor</name>
|
||||
<type>float</type>
|
||||
<value><use>snow_thickness_factor</use></value>
|
||||
</uniform>
|
||||
|
||||
<!-- cloud shadows -->
|
||||
<uniform>
|
||||
<name>cloudpos_n_x</name>
|
||||
<type>float</type>
|
||||
<value><use>cloudpos_n_x</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>cloudpos_n_y</name>
|
||||
<type>float</type>
|
||||
<value><use>cloudpos_n_y</use></value>
|
||||
</uniform>
|
||||
|
||||
|
||||
<!-- filtering -->
|
||||
<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_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>use_filtering</name>
|
||||
<type>bool</type>
|
||||
<value><use>use_filtering</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>
|
||||
|
||||
<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>
|
||||
<uniform>
|
||||
<name>overlay_autumn_flag</name>
|
||||
<type>int</type>
|
||||
<value><use>overlay_autumn_flag</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>overlay_secondary_flag</name>
|
||||
<type>int</type>
|
||||
<value><use>overlay_secondary_flag</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>cloud_shadow_flag</name>
|
||||
<type>int</type>
|
||||
<value><use>cloud_shadow_flag</use></value>
|
||||
</uniform>
|
||||
|
||||
|
||||
<blend>
|
||||
<active>true</active>
|
||||
<source>src-alpha</source>
|
||||
<destination>one-minus-src-alpha</destination>
|
||||
</blend>
|
||||
|
||||
<depth>
|
||||
<write-mask>false</write-mask>
|
||||
</depth>
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
|
@ -1455,14 +1455,19 @@ for (var i = index; i < i_max; i = i+1)
|
|||
}
|
||||
|
||||
var index_max = -1;
|
||||
var index_min = -1;
|
||||
var dist_max = -1.0;
|
||||
var dist_min = 1000000.0;
|
||||
|
||||
var counter = 0;
|
||||
|
||||
var diffx = 0.0;
|
||||
var diffy = 0.0;
|
||||
|
||||
foreach(s; cloudShadowArray)
|
||||
{
|
||||
var diffx = (s.lat - eyeLat) * local_weather.lat_to_m + offset_x;
|
||||
var diffy = -(s.lon - eyeLon) * local_weather.lon_to_m + offset_y;
|
||||
diffx = (s.lat - eyeLat) * local_weather.lat_to_m + offset_x;
|
||||
diffy = -(s.lon - eyeLon) * local_weather.lon_to_m + offset_y;
|
||||
|
||||
var dist = math.sqrt(diffx*diffx + diffy*diffy);
|
||||
if (getprop("/local-weather/cloud-shadows/cloud-shadow-fov-flag")==1)
|
||||
|
@ -1471,11 +1476,24 @@ foreach(s; cloudShadowArray)
|
|||
if (viewDotPos <0.7) {dist = dist -(viewDotPos - 0.7) * 10000.0;}
|
||||
}
|
||||
if (dist > dist_max) {dist_max = dist; index_max = counter;}
|
||||
if (dist < dist_min) {dist_min = dist; index_min = counter;}
|
||||
|
||||
setprop("/local-weather/cloud-shadows/cloudpos-x["~counter~"]",int(diffx) + s.size);
|
||||
setprop("/local-weather/cloud-shadows/cloudpos-y["~counter~"]",int(diffy) + s.strength );
|
||||
counter = counter+1;
|
||||
}
|
||||
|
||||
# now write out the closest cloud for the detail effects
|
||||
|
||||
var s = cloudShadowArray[index_min];
|
||||
|
||||
diffx = (s.lat - eyeLat) * local_weather.lat_to_m + offset_x;
|
||||
diffy = -(s.lon - eyeLon) * local_weather.lon_to_m + offset_y;
|
||||
|
||||
setprop("/local-weather/cloud-shadows/nearest-cloudpos-x",int(diffx) + s.size);
|
||||
setprop("/local-weather/cloud-shadows/nearest-cloudpos-y",int(diffy) + s.strength );
|
||||
|
||||
|
||||
#print("Dist_max:", dist_max, " index_max: ", index_max);
|
||||
cloudShadowMinIndex = index_max;
|
||||
if (dist_max > 0.0) {cloudShadowMaxDist = dist_max;}
|
||||
|
|
173
Shaders/terrain-overlay-ALS.frag
Normal file
173
Shaders/terrain-overlay-ALS.frag
Normal file
|
@ -0,0 +1,173 @@
|
|||
// -*-C++-*-
|
||||
#version 120
|
||||
|
||||
#define MAX_LAYERS 8
|
||||
#define MAX_DISTANCE 3000.0
|
||||
|
||||
uniform float visibility;
|
||||
uniform float avisibility;
|
||||
uniform float scattering;
|
||||
uniform float overlay_bias;
|
||||
uniform float season;
|
||||
uniform float dust_cover_factor;
|
||||
uniform float overlay_max_height;
|
||||
uniform float overlay_hardness;
|
||||
uniform float overlay_density;
|
||||
uniform float overlay_scale;
|
||||
uniform float overlay_steepness_factor;
|
||||
uniform float overlay_brightness_bottom;
|
||||
uniform float overlay_brightness_top;
|
||||
uniform float overlay_secondary_hardness;
|
||||
uniform float overlay_secondary_density;
|
||||
uniform float snowlevel;
|
||||
uniform float wetness;
|
||||
uniform float snow_thickness_factor;
|
||||
|
||||
uniform int overlay_autumn_flag;
|
||||
uniform int overlay_secondary_flag;
|
||||
uniform int cloud_shadow_flag;
|
||||
|
||||
uniform sampler2D overlayPrimaryTex;
|
||||
uniform sampler2D overlaySecondaryTex;
|
||||
|
||||
|
||||
uniform float osg_SimulationTime;
|
||||
|
||||
varying vec2 g_rawpos; // Horizontal position in model space
|
||||
varying float g_distance_to_eye; // Distance to the camera. Layers were disregarded
|
||||
varying vec3 g_normal;
|
||||
varying in float g_altitude;
|
||||
|
||||
|
||||
flat in float g_layer; // The layer where the fragment lives (0-1 range)
|
||||
|
||||
|
||||
float rand2D(in vec2 co);
|
||||
float Noise2D(in vec2 co, in float wavelength);
|
||||
vec3 filter_combined (in vec3 color) ;
|
||||
|
||||
float shadow_func_nearest (in float x, in float y, in float noise, in float dist);
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
if (g_distance_to_eye > MAX_DISTANCE) {discard;}
|
||||
|
||||
vec2 texCoord = gl_TexCoord[0].st;
|
||||
|
||||
vec2 pos_rotated = vec2 (0.707 * g_rawpos.x + 0.707 * g_rawpos.y, 0.707 * g_rawpos.x - 0.707 * g_rawpos.y);
|
||||
|
||||
|
||||
//float noise_1m = 0.5 * Noise2D(pos_rotated.xy, 1.0 * overlay_scale);
|
||||
//noise_1m += 0.5 * Noise2D(g_rawpos.xy, 1.1 * overlay_scale);
|
||||
|
||||
float noise_1m = Noise2D(pos_rotated.xy, 1.0 * overlay_scale);
|
||||
|
||||
float noise_2m = Noise2D(g_rawpos.xy, 2.0 * overlay_scale); ;
|
||||
float noise_10m = Noise2D(g_rawpos.xy, 10.0 * overlay_scale);
|
||||
|
||||
|
||||
|
||||
float value = 0.0;
|
||||
|
||||
float d_fade =smoothstep(100.0, MAX_DISTANCE, g_distance_to_eye);
|
||||
|
||||
float steepness = dot (normalize(g_normal), vec3 (0.0, 0.0, 1.0));
|
||||
float steepness_bias = smoothstep(overlay_steepness_factor, overlay_steepness_factor + 0.1, steepness);
|
||||
|
||||
float overlayPattern = 0.2 * noise_10m + 0.3 * noise_2m + 0.5 * noise_1m - 0.2 * g_layer - 0.1 + 0.2 * overlay_density ;
|
||||
overlayPattern *= steepness_bias;
|
||||
|
||||
float secondaryPattern = 0.2 * (1.0-noise_10m) + 0.3 * (1.0-noise_2m) + 0.5 * (1.0-noise_1m) - 0.4 * g_layer - 0.2 + 0.2 * overlay_secondary_density ;
|
||||
secondaryPattern *= overlay_secondary_flag;
|
||||
float secondaryMix = 0.0;
|
||||
|
||||
if (overlayPattern > 0.5)
|
||||
{
|
||||
value = smoothstep(0.5, (0.8 - 0.25 * overlay_hardness), overlayPattern);
|
||||
}
|
||||
else if (secondaryPattern > 0.5)
|
||||
{
|
||||
value = smoothstep(0.5, (0.8 - 0.25 * overlay_secondary_hardness), secondaryPattern);
|
||||
secondaryMix = 1.0;
|
||||
}
|
||||
else {discard;}
|
||||
|
||||
vec3 texel = texture2D(overlayPrimaryTex, texCoord * 20.0).rgb;
|
||||
vec3 secondary_texel = texture2D(overlaySecondaryTex, texCoord * 20.0).rgb;
|
||||
|
||||
// autumn coloring
|
||||
|
||||
if (overlay_autumn_flag == 1)
|
||||
{
|
||||
texel.r = min(1.0, (1.0 + 2.5 * 0.1 * season) * texel.r);
|
||||
texel.g = texel.g;
|
||||
texel.b = max(0.0, (1.0 - 4.0 * 0.1 * season) * texel.b);
|
||||
float intensity = length(texel.rgb) * (1.0 - 0.5 * smoothstep(1.1,2.0,season));
|
||||
texel.rgb = intensity * normalize(mix(texel.rgb, vec3(0.23,0.17,0.08), smoothstep(1.1,2.0, season)));
|
||||
}
|
||||
|
||||
texel = mix (texel, secondary_texel, secondaryMix);
|
||||
|
||||
|
||||
float layer_arg = mix(g_layer, 1.0, smoothstep(250.0, 5000.0, g_distance_to_eye));
|
||||
texel.rgb *= (overlay_brightness_bottom + (overlay_brightness_top - overlay_brightness_bottom) * g_layer);
|
||||
texel.rgb *= (1.0 - 0.5 * wetness);
|
||||
|
||||
// dust overlay
|
||||
|
||||
const vec3 dust_color = vec3 (0.76, 0.65, 0.45);
|
||||
texel = mix (texel, dust_color, 0.7 * dust_cover_factor);
|
||||
|
||||
// snow overlay
|
||||
|
||||
//vec3 snow_texel = vec3 (0.95, 0.95, 0.95);
|
||||
|
||||
float snow_factor = 0.2+0.8* smoothstep(0.2,0.8, 0.3 + 0.5 * snow_thickness_factor +0.0001*(g_altitude -snowlevel) );
|
||||
snow_factor *= smoothstep(0.5, 0.7, steepness);
|
||||
|
||||
snow_factor *= smoothstep(g_layer - 0.1, g_layer , snow_factor + 0.2);
|
||||
|
||||
//texel.rgb = mix(texel.rgb, snow_texel.rgb, snow_factor * smoothstep(snowlevel, snowlevel+200.0, g_altitude - 100.0));
|
||||
value *= (1.0 - snow_factor * smoothstep(snowlevel, snowlevel+200.0, g_altitude - 100.0));
|
||||
|
||||
// do a conservative simple fog model, fading to alpha
|
||||
|
||||
float min_visibility = min(visibility, avisibility);
|
||||
|
||||
float base_alpha = clamp(0.4 * overlay_max_height/0.3, 0.4, 1.0);
|
||||
value*= base_alpha * (1.0 - d_fade);
|
||||
|
||||
float targ = 8.0 * g_distance_to_eye/min_visibility;
|
||||
value *= exp(-targ - targ * targ * targ * targ);
|
||||
value= clamp(value, 0.0, 1.0);
|
||||
|
||||
// cloud shadows
|
||||
|
||||
float cloud_shade = 1.0;
|
||||
|
||||
if (cloud_shadow_flag == 1)
|
||||
{
|
||||
vec2 eyePos = (gl_ModelViewMatrixInverse * vec4 (0.0, 0.0, 0.0, 1.0)).xy;
|
||||
vec2 relPos = g_rawpos - eyePos;
|
||||
|
||||
|
||||
cloud_shade = shadow_func_nearest(relPos.x, relPos.y, 1.0, g_distance_to_eye);
|
||||
}
|
||||
|
||||
// lighting is very simple, the ground underneath should do most of it
|
||||
|
||||
vec3 N = normalize (gl_NormalMatrix * g_normal);
|
||||
float NdotL = 0.5 + 1.0 * clamp(dot (N, gl_LightSource[0].position.xyz), 0.0, 1.0) * cloud_shade;
|
||||
|
||||
texel *= length(gl_LightSource[0].diffuse.rgb)/1.73 * scattering * NdotL;
|
||||
texel = clamp(texel, 0.0, 1.0);
|
||||
|
||||
|
||||
vec4 fragColor = vec4 (texel, value);
|
||||
fragColor.rgb = filter_combined(fragColor.rgb);
|
||||
fragColor = clamp(fragColor, 0.0, 1.0);
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
}
|
62
Shaders/terrain-overlay-ALS.geom
Normal file
62
Shaders/terrain-overlay-ALS.geom
Normal file
|
@ -0,0 +1,62 @@
|
|||
// -*-C++-*-
|
||||
#version 120
|
||||
#extension GL_EXT_geometry_shader4 : enable
|
||||
|
||||
#define MAX_LAYERS 8
|
||||
#define MIN_LAYERS 2
|
||||
#define MAX_MINUS_MIN_LAYERS 6
|
||||
|
||||
uniform float overlay_max_height;
|
||||
|
||||
varying in vec3 v_normal[3];
|
||||
|
||||
varying out vec2 g_rawpos;
|
||||
varying out float g_distance_to_eye;
|
||||
varying out vec3 g_normal;
|
||||
varying out float g_altitude;
|
||||
|
||||
|
||||
flat varying out float g_layer;
|
||||
|
||||
|
||||
|
||||
float min3(in float a, in float b, in float c)
|
||||
{
|
||||
float m = a;
|
||||
if (m > b) m = b;
|
||||
if (m > c) m = c;
|
||||
return m;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
float distances[3];
|
||||
distances[0] = -(gl_ModelViewMatrix * gl_PositionIn[0]).z;
|
||||
distances[1] = -(gl_ModelViewMatrix * gl_PositionIn[1]).z;
|
||||
distances[2] = -(gl_ModelViewMatrix * gl_PositionIn[2]).z;
|
||||
float minDistance = min3(distances[0], distances[1], distances[2]);
|
||||
//float avgDistance = (distances[0]+distances[1]+distances[2])*0.33;
|
||||
|
||||
int numLayers = MIN_LAYERS + int((1.0 - smoothstep(250.0, 5000.0, minDistance)) * float(MAX_MINUS_MIN_LAYERS));
|
||||
|
||||
float deltaLayer = 1.0 / float(numLayers);
|
||||
float currDeltaLayer = 1.5 * deltaLayer;// * 0.5;
|
||||
|
||||
for (int layer = 0; layer < numLayers; ++layer) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
vec4 pos = gl_PositionIn[i] + vec4(v_normal[i] * currDeltaLayer * overlay_max_height, 0.0);
|
||||
g_rawpos = gl_PositionIn[i].xy;
|
||||
g_distance_to_eye = distances[i];
|
||||
g_layer = currDeltaLayer;
|
||||
g_normal = v_normal[i];
|
||||
g_altitude = gl_PositionIn[i].z;
|
||||
|
||||
gl_Position = gl_ModelViewProjectionMatrix * pos;
|
||||
gl_TexCoord[0] = gl_TexCoordIn[i][0];
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
|
||||
currDeltaLayer += deltaLayer;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue