1
0
Fork 0

Merge /u/fgarlin/flightgear/ branch next into next

https://sourceforge.net/p/flightgear/fgdata/merge-requests/185/
This commit is contained in:
Richard Harrison 2020-04-04 20:44:11 +00:00
commit c0529a9a8d
78 changed files with 800 additions and 688 deletions

View file

@ -91,8 +91,8 @@
<bin-name>RenderBin</bin-name>
</render-bin>
<program>
<vertex-shader>Shaders/Default/trivial.vert</vertex-shader>
<fragment-shader>Shaders/Default/trivial.frag</fragment-shader>
<vertex-shader>Shaders/ALS/terrain-writedepth.vert</vertex-shader>
<fragment-shader>Shaders/ALS/terrain-writedepth.frag</fragment-shader>
</program>
<color-mask type="vec4d">0 0 0 0</color-mask>
</pass>

View file

@ -94,8 +94,8 @@
<bin-name>RenderBin</bin-name>
</render-bin>
<program>
<vertex-shader>Shaders/Default/trivial.vert</vertex-shader>
<fragment-shader>Shaders/Default/trivial.frag</fragment-shader>
<vertex-shader>Shaders/ALS/terrain-writedepth.vert</vertex-shader>
<fragment-shader>Shaders/ALS/terrain-writedepth.frag</fragment-shader>
</program>
<color-mask type="vec4d">0 0 0 0</color-mask>
</pass>

View file

@ -305,7 +305,7 @@ please see Docs/README.model-combined.eff for documentation
<binormal type="int">7</binormal>
</generate>-->
<!-- Default rendering -->
<technique n="7">
<technique n="4">
<predicate>
<and>
<property>/sim/rendering/shaders/quality-level</property>
@ -843,7 +843,7 @@ please see Docs/README.model-combined.eff for documentation
</uniform>
</pass>
</technique>
<technique n="4">
<technique n="7">
<scheme>als-lighting</scheme>
<predicate>
<and>

View file

@ -473,7 +473,7 @@
<use>vertex-program-two-side</use>
</vertex-program-two-side>
<program>
<vertex-shader>Shaders/ALS/model-base.vert</vertex-shader>
<vertex-shader>Shaders/ALS/generic-base.vert</vertex-shader>
<vertex-shader>Shaders/ALS/shadows-include.vert</vertex-shader>
<fragment-shader>Shaders/ALS/model-base.frag</fragment-shader>
<fragment-shader>Shaders/ALS/hazes.frag</fragment-shader>

View file

@ -69,7 +69,7 @@
<use>vertex-program-two-side</use>
</vertex-program-two-side>
<program>
<vertex-shader>Shaders/ALS/model-base.vert</vertex-shader>
<vertex-shader>Shaders/ALS/generic-base.vert</vertex-shader>
<fragment-shader>Shaders/ALS/model-interior-base.frag</fragment-shader>
<fragment-shader>Shaders/ALS/hazes.frag</fragment-shader>
<fragment-shader>Shaders/ALS/secondary_lights.frag</fragment-shader>

View file

@ -742,7 +742,7 @@
<use>vertex-program-two-side</use>
</vertex-program-two-side>
<program>
<vertex-shader>Shaders/ALS/model-base.vert</vertex-shader>
<vertex-shader>Shaders/ALS/generic-base.vert</vertex-shader>
<fragment-shader>Shaders/ALS/model-interior-base.frag</fragment-shader>
<fragment-shader>Shaders/ALS/hazes.frag</fragment-shader>
<fragment-shader>Shaders/ALS/secondary_lights.frag</fragment-shader>

View file

@ -11,26 +11,6 @@
<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/shaders/skydome</use>
</fogtype>
<!-- END fog include -->
</parameters>
<technique n="9">
<pass>
@ -192,6 +172,25 @@
<mode>modulate</mode>
</environment>
</texture-unit>
<vertex-program-two-side>
<use>vertex-program-two-side</use>
</vertex-program-two-side>
<program>
<vertex-shader>Shaders/ALS/model-transparent.vert</vertex-shader>
<fragment-shader>Shaders/ALS/model-transparent.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>
</PropertyList>

View file

@ -86,7 +86,86 @@
<normal type="int">15</normal>
<tangent type="int">6</tangent>
</generate>
<technique n="8">
<technique n="9">
<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
of the scene graph. Perhaps that ought to be set in this
effect?
-->
</pass>
</technique>
<technique n="19">
<scheme>als-lighting</scheme>
<predicate>
<or>
<less-equal>
@ -360,82 +439,4 @@
</uniform>
</pass>
</technique>
<technique n="9">
<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
of the scene graph. Perhaps that ought to be set in this
effect?
-->
</pass>
</technique>
</PropertyList>

View file

@ -90,293 +90,7 @@
<normal type="int">15</normal>
<tangent type="int">6</tangent>
</generate>
<technique n="7">
<predicate>
<or>
<less-equal>
<value type="float">2.0</value>
<glversion/>
</less-equal>
<and>
<extension-supported>GL_ARB_shader_objects</extension-supported>
<extension-supported>GL_ARB_shading_language_100</extension-supported>
<extension-supported>GL_ARB_vertex_shader</extension-supported>
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
</predicate>
<pass>
<lighting>true</lighting>
<material>
<active>
<use>material/active</use>
</active>
<ambient>
<use>material/ambient</use>
</ambient>
<diffuse>
<use>material/diffuse</use>
</diffuse>
<specular>
<use>material/specular</use>
</specular>
<emissive>
<use>material/emissive</use>
</emissive>
<shininess>
<use>material/shininess</use>
</shininess>
<color-mode>
<use>material/color-mode</use>
</color-mode>
</material>
<blend>
<use>transparent</use>
</blend>
<alpha-test>
<active type="bool">false</active>
</alpha-test>
<shade-model>
<use>shade-model</use>
</shade-model>
<cull-face>
<use>cull-face</use>
</cull-face>
<rendering-hint>
<use>rendering-hint</use>
</rendering-hint>
<texture-unit>
<unit>0</unit>
<type>
<use>texture[0]/type</use>
</type>
<image>
<use>texture[0]/image</use>
</image>
<filter>
<use>texture[0]/filter</use>
</filter>
<wrap-s>
<use>texture[0]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[0]/wrap-t</use>
</wrap-t>
</texture-unit>
<texture-unit>
<unit>1</unit>
<image>
<use>texture[1]/image</use>
</image>
<type>
<use>texture[1]/type</use>
</type>
<filter>
<use>texture[1]/filter</use>
</filter>
<wrap-s>
<use>texture[1]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[1]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[1]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>2</unit>
<image>
<use>texture[2]/image</use>
</image>
<type>
<use>texture[2]/type</use>
</type>
<filter>
<use>texture[2]/filter</use>
</filter>
<wrap-s>
<use>texture[2]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[2]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[2]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>3</unit>
<image>
<use>texture[3]/image</use>
</image>
<type>
<use>texture[3]/type</use>
</type>
<filter>
<use>texture[3]/filter</use>
</filter>
<wrap-s>
<use>texture[3]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[3]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[3]/internal-format</use>
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/ALS/planet.vert</vertex-shader>
<fragment-shader>Shaders/ALS/planet.frag</fragment-shader>
<fragment-shader>Shaders/ALS/noise.frag</fragment-shader>
<fragment-shader>Shaders/ALS/filters.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>
</attribute>
<attribute>
<name>normal</name>
<index>15</index>
</attribute>
</program>
<uniform>
<name>texture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>shadowtex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>grain_texture</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>colorMode</name>
<type>int</type>
<value>
<use>material/color-mode-uniform</use>
</value>
</uniform>
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>air_pollution</name>
<type>float</type>
<value>
<use>air_pollution</use>
</value>
</uniform>
<uniform>
<name>sun_angle</name>
<type>float</type>
<value>
<use>sun-angle</use>
</value>
</uniform>
<uniform>
<name>use_clouds</name>
<type>bool</type>
<value>
<use>use-clouds</use>
</value>
</uniform>
<uniform>
<name>use_overlay</name>
<type>bool</type>
<value>
<use>use-overlay-textures</use>
</value>
</uniform>
<uniform>
<name>use_cloud_shadows</name>
<type>bool</type>
<value>
<use>use-cloud-shadows</use>
</value>
</uniform>
<uniform>
<name>gamma</name>
<type>float</type>
<value>
<use>gamma</use>
</value>
</uniform>
<uniform>
<name>brightness</name>
<type>float</type>
<value>
<use>brightness</use>
</value>
</uniform>
<uniform>
<name>use_filtering</name>
<type>bool</type>
<value>
<use>use_filtering</use>
</value>
</uniform>
<uniform>
<name>use_night_vision</name>
<type>bool</type>
<value>
<use>use_night_vision</use>
</value>
</uniform>
<uniform>
<name>use_IR_vision</name>
<type>bool</type>
<value>
<use>use_IR_vision</use>
</value>
</uniform>
<uniform>
<name>delta_T</name>
<type>float</type>
<value>
<use>delta_T</use>
</value>
</uniform>
<uniform>
<name>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>
</pass>
</technique>
<technique n="8">
<technique n="9">
<pass>
<lighting>true</lighting>
<material>
@ -454,7 +168,8 @@
-->
</pass>
</technique>
<technique n="9">
<technique n="18">
<scheme>als-lighting</scheme>
<predicate>
<and>
<or>
@ -755,4 +470,291 @@
</uniform>
</pass>
</technique>
<technique n="19">
<scheme>als-lighting</scheme>
<predicate>
<or>
<less-equal>
<value type="float">2.0</value>
<glversion/>
</less-equal>
<and>
<extension-supported>GL_ARB_shader_objects</extension-supported>
<extension-supported>GL_ARB_shading_language_100</extension-supported>
<extension-supported>GL_ARB_vertex_shader</extension-supported>
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
</predicate>
<pass>
<lighting>true</lighting>
<material>
<active>
<use>material/active</use>
</active>
<ambient>
<use>material/ambient</use>
</ambient>
<diffuse>
<use>material/diffuse</use>
</diffuse>
<specular>
<use>material/specular</use>
</specular>
<emissive>
<use>material/emissive</use>
</emissive>
<shininess>
<use>material/shininess</use>
</shininess>
<color-mode>
<use>material/color-mode</use>
</color-mode>
</material>
<blend>
<use>transparent</use>
</blend>
<alpha-test>
<active type="bool">false</active>
</alpha-test>
<shade-model>
<use>shade-model</use>
</shade-model>
<cull-face>
<use>cull-face</use>
</cull-face>
<rendering-hint>
<use>rendering-hint</use>
</rendering-hint>
<texture-unit>
<unit>0</unit>
<type>
<use>texture[0]/type</use>
</type>
<image>
<use>texture[0]/image</use>
</image>
<filter>
<use>texture[0]/filter</use>
</filter>
<wrap-s>
<use>texture[0]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[0]/wrap-t</use>
</wrap-t>
</texture-unit>
<texture-unit>
<unit>1</unit>
<image>
<use>texture[1]/image</use>
</image>
<type>
<use>texture[1]/type</use>
</type>
<filter>
<use>texture[1]/filter</use>
</filter>
<wrap-s>
<use>texture[1]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[1]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[1]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>2</unit>
<image>
<use>texture[2]/image</use>
</image>
<type>
<use>texture[2]/type</use>
</type>
<filter>
<use>texture[2]/filter</use>
</filter>
<wrap-s>
<use>texture[2]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[2]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[2]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>3</unit>
<image>
<use>texture[3]/image</use>
</image>
<type>
<use>texture[3]/type</use>
</type>
<filter>
<use>texture[3]/filter</use>
</filter>
<wrap-s>
<use>texture[3]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[3]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[3]/internal-format</use>
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/ALS/planet.vert</vertex-shader>
<fragment-shader>Shaders/ALS/planet.frag</fragment-shader>
<fragment-shader>Shaders/ALS/noise.frag</fragment-shader>
<fragment-shader>Shaders/ALS/filters.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>
</attribute>
<attribute>
<name>normal</name>
<index>15</index>
</attribute>
</program>
<uniform>
<name>texture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>shadowtex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>grain_texture</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>colorMode</name>
<type>int</type>
<value>
<use>material/color-mode-uniform</use>
</value>
</uniform>
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>air_pollution</name>
<type>float</type>
<value>
<use>air_pollution</use>
</value>
</uniform>
<uniform>
<name>sun_angle</name>
<type>float</type>
<value>
<use>sun-angle</use>
</value>
</uniform>
<uniform>
<name>use_clouds</name>
<type>bool</type>
<value>
<use>use-clouds</use>
</value>
</uniform>
<uniform>
<name>use_overlay</name>
<type>bool</type>
<value>
<use>use-overlay-textures</use>
</value>
</uniform>
<uniform>
<name>use_cloud_shadows</name>
<type>bool</type>
<value>
<use>use-cloud-shadows</use>
</value>
</uniform>
<uniform>
<name>gamma</name>
<type>float</type>
<value>
<use>gamma</use>
</value>
</uniform>
<uniform>
<name>brightness</name>
<type>float</type>
<value>
<use>brightness</use>
</value>
</uniform>
<uniform>
<name>use_filtering</name>
<type>bool</type>
<value>
<use>use_filtering</use>
</value>
</uniform>
<uniform>
<name>use_night_vision</name>
<type>bool</type>
<value>
<use>use_night_vision</use>
</value>
</uniform>
<uniform>
<name>use_IR_vision</name>
<type>bool</type>
<value>
<use>use_IR_vision</use>
</value>
</uniform>
<uniform>
<name>delta_T</name>
<type>float</type>
<value>
<use>delta_T</use>
</value>
</uniform>
<uniform>
<name>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>
</pass>
</technique>
</PropertyList>

View file

@ -15,6 +15,7 @@
<use_geo_light type="int">0</use_geo_light>
</parameters>
<technique n="5">
<scheme>als-lighting</scheme>
<pass>
<program>
<vertex-shader n="0">Shaders/ALS/space-ultra.vert</vertex-shader>
@ -951,6 +952,7 @@
</pass>
</technique>
<technique n="6">
<scheme>als-lighting</scheme>
<pass>
<program>
<vertex-shader n="0">Shaders/ALS/space-base.vert</vertex-shader>

View file

@ -3,7 +3,8 @@
<PropertyList>
<name>Effects/space</name>
<inherits-from>Effects/model-default</inherits-from>
<technique n="7">
<technique n="18">
<scheme>als-lighting</scheme>
<pass>
<program>
<vertex-shader n="0">Shaders/ALS/space-base.vert</vertex-shader>

View file

@ -2108,7 +2108,7 @@
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/ALS/terrain-base.vert</vertex-shader>
<vertex-shader>Shaders/ALS/generic-base.vert</vertex-shader>
<vertex-shader>Shaders/ALS/shadows-include.vert</vertex-shader>
<fragment-shader>Shaders/ALS/terrain-base.frag</fragment-shader>
<fragment-shader>Shaders/ALS/hazes.frag</fragment-shader>

View file

@ -1,5 +1,7 @@
#version 120
uniform float fg_Fcoef;
uniform sampler2D baseTexture;
uniform float scattering;
@ -12,6 +14,8 @@ varying float bottom_shade;
varying vec3 internal_pos;
varying vec3 hazeColor;
varying float flogz;
vec3 filter_combined (in vec3 color) ;
void main(void)
@ -81,4 +85,6 @@ void main(void)
gl_FragColor.rgb = finalColor.rgb;
gl_FragColor.a = mix(0.0, finalColor.a, 1.0 - 0.5 * (1.0 - fogFactor));
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -1,8 +1,6 @@
// -*-C++-*-
#version 120
uniform float fg_Fcoef;
varying float fogFactor;
varying vec3 hazeColor;
varying float mie_frag;
@ -11,6 +9,8 @@ varying vec3 internal_pos;
varying float bottom_shade;
varying float z_pos;
varying float flogz;
uniform float range; // From /sim/rendering/clouds3d-vis-range
uniform float detail_range; // From /sim/rendering/clouds3d_detail-range
uniform float scattering;
@ -154,7 +154,7 @@ void main(void)
vec3 relVector = gl_Position.xyz - ep.xyz;
gl_Position = gl_ModelViewProjectionMatrix * gl_Position;
// logarithmic depth
gl_Position.z = (log2(max(1e-6, 1.0 + gl_Position.w)) * fg_Fcoef - 1.0) * gl_Position.w;
flogz = 1.0 + gl_Position.w;
// Light at the final position

View file

@ -1,10 +1,14 @@
#version 120
uniform float fg_Fcoef;
uniform sampler2D baseTexture;
varying float fogFactor;
varying vec3 hazeColor;
varying float flogz;
vec3 filter_combined (in vec3 color) ;
void main(void)
@ -20,5 +24,7 @@ void main(void)
gl_FragColor.rgb = finalColor.rgb;
gl_FragColor.a = mix(0.0, finalColor.a, 1.0 - 0.5 * (1.0 - fogFactor));
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -1,11 +1,11 @@
// -*-C++-*-
#version 120
uniform float fg_Fcoef;
varying float fogFactor;
varying vec3 hazeColor;
varying float flogz;
uniform float range; // From /sim/rendering/clouds3d-vis-range
uniform float detail_range; // From /sim/rendering/clouds3d_detail-range
uniform float scattering;
@ -137,7 +137,7 @@ void main(void)
vec3 relVector = gl_Position.xyz - ep.xyz;
gl_Position = gl_ModelViewProjectionMatrix * gl_Position;
// logarithmic depth
gl_Position.z = (log2(max(1e-6, 1.0 + gl_Position.w)) * fg_Fcoef - 1.0) * gl_Position.w;
flogz = 1.0 + gl_Position.w;
// Light at the final position

View file

@ -661,6 +661,7 @@ fragColor.rgb = mix(hazeColor + secondary_light * fog_backscatter(mvisibility),
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -524,6 +524,7 @@ fragColor.rgb = mix(hazeColor+secondary_light * fog_backscatter(mvisibility), fr
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -1,6 +1,8 @@
// -*-C++-*-
#version 120
uniform float fg_Fcoef;
uniform sampler2D texture;
uniform float color_base_r;
@ -25,6 +27,8 @@ varying vec3 vertex;
varying vec3 relPos;
varying vec3 normal;
varying float flogz;
const float terminator_width = 200000.0;
float Noise2D(in vec2 coord, in float wavelength);
@ -202,6 +206,7 @@ birdTexel.a = domainTexel.a * shapeTexel.a * transmission;
gl_FragColor = birdTexel;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -9,6 +9,8 @@ varying vec3 vertex;
varying vec3 relPos;
varying vec3 normal;
varying float flogz;
uniform float osg_SimulationTime;
void main()
@ -33,6 +35,8 @@ normal = gl_NormalMatrix * gl_Normal;
gl_Position.xyz += gl_Vertex.z * w;
gl_Position = gl_ModelViewProjectionMatrix * gl_Position;
// logarithmic depth
flogz = 1.0 + gl_Position.w;
//vec4 offset = gl_ModelViewProjectionMatrix * vec4 (0.05* osg_SimulationTime, 0.0, 0.0, 1.0);

View file

@ -12,6 +12,8 @@
#version 120
#define fps2kts 0.5925
uniform float fg_Fcoef;
uniform sampler2D water_normalmap;
uniform sampler2D water_reflection;
uniform sampler2D water_dudvmap;
@ -54,6 +56,8 @@ varying float yprime_alt;
varying float mie_angle;
varying float steepness;
varying float flogz;
vec3 specular_light;
float fog_func (in float targ, in float alt);
@ -439,6 +443,7 @@ if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColo
finalColor.rgb = filter_combined(finalColor.rgb);
gl_FragColor = vec4(finalColor.rgb, alpha0.a * 1.35);
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -26,6 +26,8 @@ varying vec3 relPos;
varying float yprime_alt;
varying float mie_angle;
varying float flogz;
uniform int colorMode;
uniform float hazeLayerAltitude;
uniform float terminator;
@ -285,7 +287,8 @@ else // the faster, full-day version without lightfields
gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0;
gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0;
gl_Position = gl_ModelViewProjectionMatrix * vertex;
// logarithmic depth
flogz = 1.0 + gl_Position.w;
}

View file

@ -618,6 +618,7 @@ fragColor.rgb = mix(hazeColor + secondary_light * fog_backscatter(mvisibility),
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -4,6 +4,8 @@
varying float fogFactor;
varying vec3 hazeColor;
varying float flogz;
uniform float terminator;
uniform float altitude;
uniform float cloud_self_shading;
@ -65,6 +67,8 @@ void main(void)
vec3 relVector = gl_Position.xyz - ep.xyz;
gl_Position = gl_ModelViewProjectionMatrix * gl_Position;
// logarithmic depth
flogz = 1.0 + gl_Position.w;
// Light at the final position

View file

@ -4,6 +4,8 @@
varying float fogFactor;
varying vec3 hazeColor;
varying float flogz;
uniform float terminator;
uniform float altitude;
uniform float cloud_self_shading;
@ -62,6 +64,8 @@ void main(void)
vec3 relVector = gl_Position.xyz - ep.xyz;
gl_Position = gl_ModelViewProjectionMatrix * gl_Position;
// logarithmic depth
flogz = 1.0 + gl_Position.w;
// Light at the final position

View file

@ -1,6 +1,8 @@
// -*-C++-*-
#version 120
uniform float fg_Fcoef;
uniform sampler2D baseTexture;
uniform float ring_factor;
@ -12,6 +14,8 @@ varying float eShade;
varying vec3 hazeColor;
varying float flogz;
vec3 filter_combined (in vec3 color) ;
void main(void)
@ -56,4 +60,6 @@ void main(void)
fragColor.rgb = filter_combined(fragColor.rgb);
//fragColor.rgb = vec3 (1.0, 0.0, 0.0);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -6,6 +6,8 @@ varying float mie_frag;
varying float eShade;
varying vec3 hazeColor;
varying float flogz;
uniform float terminator;
uniform float altitude;
uniform float cloud_self_shading;
@ -61,6 +63,8 @@ void main(void)
vec3 relVector = gl_Position.xyz - ep.xyz;
gl_Position = gl_ModelViewProjectionMatrix * gl_Position;
// logarithmic depth
flogz = 1.0 + gl_Position.w;
// Light at the final position

View file

@ -1,10 +1,14 @@
#version 120
uniform float fg_Fcoef;
uniform sampler2D baseTexture;
varying float fogFactor;
varying vec3 hazeColor;
varying float flogz;
vec3 filter_combined (in vec3 color) ;
void main(void)
@ -17,4 +21,6 @@ void main(void)
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -4,6 +4,8 @@
varying float fogFactor;
varying vec3 hazeColor;
varying float flogz;
uniform float terminator;
uniform float altitude;
uniform float cloud_self_shading;
@ -62,6 +64,8 @@ void main(void)
vec3 relVector = gl_Position.xyz - ep.xyz;
gl_Position = gl_ModelViewProjectionMatrix * gl_Position;
// logarithmic depth
flogz = 1.0 + gl_Position.w;
// Light at the final position

View file

@ -1,4 +1,4 @@
#version 150
#version 140
uniform usampler3D fg_ClusteredLightGrid;
uniform usamplerBuffer fg_ClusteredLightIndices;

View file

@ -503,6 +503,7 @@ fragColor.rgb = mix(hazeColor +secondary_light * fog_backscatter(mvisibility) ,
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -28,6 +28,7 @@ varying vec3 relPos;
varying float yprime_alt;
varying float mie_angle;
varying float flogz;
uniform int colorMode;
uniform float osg_SimulationTime;
@ -138,6 +139,8 @@ void main()
rotationmatrix(-relWinddir, RotationMatrix);
pos *= RotationMatrix;
gl_Position = gl_ModelViewProjectionMatrix * pos;
// logarithmic depth
flogz = 1.0 + gl_Position.w;
//do the colour and fog
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;

View file

@ -11,6 +11,10 @@ varying float splash_angle;
varying float Mie;
varying float ambient_fraction;
varying float flogz;
uniform float fg_Fcoef;
uniform sampler2D texture;
uniform sampler2D frost_texture;
uniform sampler2D func_texture;
@ -250,6 +254,7 @@ fragColor.a = max(outerColor.a, fog_texel.a);
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = clamp(fragColor,0.0,1.0);
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -11,6 +11,8 @@ varying float splash_angle;
varying float Mie;
varying float ambient_fraction;
varying float flogz;
uniform float ground_scattering;
uniform float hazeLayerAltitude;
uniform float moonlight;
@ -126,7 +128,8 @@ ambient_fraction = length(light_ambient.rgb)/(length(light_diffuse.rgb +light_am
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
// logarithmic depth
flogz = 1.0 + gl_Position.w;
vec4 diffuse_color = gl_FrontMaterial.diffuse;
vec4 ambient_color = gl_FrontMaterial.ambient;

View file

@ -2,9 +2,10 @@
#version 120
#define BLADE_FRACTION 0.1
#define MAX_LAYERS 30
#define MAX_DISTANCE 1000.0
uniform float fg_Fcoef;
uniform float visibility;
uniform float scattering;
uniform float overlay_bias;
@ -33,6 +34,8 @@ varying vec2 g_rawpos; // Horizontal position in model space
varying float g_distance_to_eye; // Distance to the camera. Layers were disregarded
varying float g_layer; // The layer where the fragment lives (0-1 range)
varying float flogz;
float rand2D(in vec2 co);
float Noise2D(in vec2 co, in float wavelength);
vec3 filter_combined (in vec3 color) ;
@ -172,4 +175,6 @@ void main()
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -2,9 +2,9 @@
#version 120
#extension GL_EXT_geometry_shader4 : enable
#define MAX_LAYERS 30
#define MAX_LAYERS 20
#define MIN_LAYERS 8
#define MAX_MINUS_MIN_LAYERS 22
#define MAX_MINUS_MIN_LAYERS 12
uniform float max_height;
@ -14,6 +14,8 @@ varying out vec2 g_rawpos;
varying out float g_distance_to_eye;
varying out float g_layer;
varying out float flogz;
uniform mat4 fg_LightMatrix_csm0;
uniform mat4 fg_LightMatrix_csm1;
@ -60,6 +62,8 @@ void main()
setupShadows(gl_ModelViewMatrix * pos);
gl_Position = gl_ModelViewProjectionMatrix * pos;
// logarithmic depth
flogz = 1.0 + gl_Position.w;
gl_TexCoord[0] = gl_TexCoordIn[i][0];
EmitVertex();
}

View file

@ -11,6 +11,10 @@ varying float splash_angle;
varying float Mie;
varying float ambient_fraction;
varying float flogz;
uniform float fg_Fcoef;
uniform sampler2D texture;
uniform sampler2D frost_texture;
uniform sampler2D func_texture;
@ -284,6 +288,7 @@ fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = clamp(fragColor,0.0,1.0);
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -11,6 +11,8 @@ varying float splash_angle;
varying float Mie;
varying float ambient_fraction;
varying float flogz;
uniform float ground_scattering;
uniform float hazeLayerAltitude;
uniform float moonlight;
@ -126,6 +128,8 @@ ambient_fraction = length(light_ambient.rgb)/(length(light_diffuse.rgb +light_am
gl_Position = ftransform();
// logarithmic depth
flogz = 1.0 + gl_Position.w;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
vec4 diffuse_color = gl_FrontMaterial.diffuse;

View file

@ -1,6 +1,8 @@
// -*-C++-*-
#version 120
uniform float fg_Fcoef;
uniform sampler2D texture;
uniform float light_color_base_r;
@ -37,6 +39,8 @@ varying vec3 vertex;
varying vec3 relPos;
varying vec3 normal;
varying float flogz;
float Noise2D(in vec2 coord, in float wavelength);
float fog_func (in float targ, in float alt);
@ -227,6 +231,7 @@ vec3 light_color = mix(light_color_base, light_color_center, intensity*intensity
gl_FragColor = vec4 (light_color.rgb, intensity * transmission );
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -16,6 +16,7 @@ varying vec3 vertex;
varying vec3 relPos;
varying vec3 normal;
varying float flogz;
void main()
@ -39,6 +40,8 @@ normal = gl_NormalMatrix * gl_Normal;
gl_Position.xyz += gl_Vertex.y * r;
gl_Position.xyz += gl_Vertex.z * w;
gl_Position = gl_ModelViewProjectionMatrix * gl_Position;
// logarithmic depth
flogz = 1.0 + gl_Position.w;
//gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;

View file

@ -8,12 +8,16 @@ varying vec3 normal;
varying vec3 relPos;
varying vec4 ecPosition;
uniform float fg_Fcoef;
uniform sampler2D texture;
varying float yprime_alt;
varying float mie_angle;
varying float flogz;
uniform float visibility;
uniform float avisibility;
@ -323,6 +327,7 @@ fragColor.rgb = addClusteredLightsContribution(fragColor.rgb, ecPosition.xyz, no
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -1,254 +0,0 @@
// -*-C++-*-
#version 120
// Shader that uses OpenGL state values to do per-pixel lighting
//
// The only light used is gl_LightSource[0], which is assumed to be
// directional.
//
// Diffuse colors come from the gl_Color, ambient from the material. This is
// equivalent to osg::Material::DIFFUSE.
// Haze part added by Thorsten Renk, Oct. 2011
#define MODE_OFF 0
#define MODE_DIFFUSE 1
#define MODE_AMBIENT_AND_DIFFUSE 2
uniform float fg_Fcoef;
// The constant term of the lighting equation that doesn't depend on
// the surface normal is passed in gl_{Front,Back}Color. The alpha
// component is set to 1 for front, 0 for back in order to work around
// bugs with gl_FrontFacing in the fragment shader.
varying vec4 diffuse_term;
varying vec3 normal;
varying vec3 relPos;
varying vec4 ecPosition;
varying float yprime_alt;
varying float mie_angle;
uniform int colorMode;
uniform float hazeLayerAltitude;
uniform float terminator;
uniform float terrain_alt;
uniform float avisibility;
uniform float visibility;
uniform float overcast;
uniform float ground_scattering;
uniform float moonlight;
void setupShadows(vec4 eyeSpacePos);
// This is the value used in the skydome scattering shader - use the same here for consistency?
const float EarthRadius = 5800000.0;
const float terminator_width = 200000.0;
float earthShade;
float light_func (in float x, in float a, in float b, in float c, in float d, in float e)
{
//x = x - 0.5;
// use the asymptotics to shorten computations
if (x < -15.0) {return 0.0;}
return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d));
}
void main()
{
vec4 light_diffuse;
vec4 light_ambient;
vec3 shadedFogColor = vec3(0.55, 0.67, 0.88);
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
//float yprime_alt;
float yprime;
float lightArg;
float intensity;
float vertex_alt;
float scattering;
// this code is copied from default.vert
ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
// logarithmic depth
gl_Position.z = (log2(max(1e-6, 1.0 + gl_Position.w)) * fg_Fcoef - 1.0) * gl_Position.w;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = gl_NormalMatrix * gl_Normal;
vec4 ambient_color, diffuse_color;
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;
}
// here start computations for the haze layer
// we need several geometrical quantities
// first current altitude of eye position in model space
vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0);
// and relative position to vector
relPos = gl_Vertex.xyz - ep.xyz;
// unfortunately, we need the distance in the vertex shader, although the more accurate version
// is later computed in the fragment shader again
float dist = length(relPos);
// altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m
vertex_alt = max(gl_Vertex.z,100.0);
scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt);
// branch dependent on daytime
if (terminator < 1000000.0) // the full, sunrise and sunset computation
{
// establish coordinates relative to sun position
vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz;
vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0));
// yprime is the distance of the vertex into sun direction
yprime = -dot(relPos, lightHorizon);
// this gets an altitude correction, higher terrain gets to see the sun earlier
yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt);
// two times terminator width governs how quickly light fades into shadow
// now the light-dimming factor
earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4;
// parametrized version of the Flightgear ground lighting function
lightArg = (terminator-yprime_alt)/100000.0;
// directional scattering for low sun
if (lightArg < 10.0)
{mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;}
else
{mie_angle = 1.0;}
light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0);
light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
light_diffuse.a = 1.0;
light_diffuse = light_diffuse * scattering;
light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33);
light_ambient.g = light_ambient.r * 0.4/0.33;
light_ambient.b = light_ambient.r * 0.5/0.33;
light_ambient.a = 1.0;
// correct ambient light intensity and hue before sunrise
if (earthShade < 0.5)
{
//light_ambient = light_ambient * (0.7 + 0.3 * smoothstep(0.2, 0.5, earthShade));
intensity = length(light_ambient.xyz);
light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.8,earthShade) ));
light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade));
intensity = length(light_diffuse.xyz);
light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.7,earthShade) ));
}
// the haze gets the light at the altitude of the haze top if the vertex in view is below
// but the light at the vertex if the vertex is above
vertex_alt = max(vertex_alt,hazeLayerAltitude);
if (vertex_alt > hazeLayerAltitude)
{
if (dist > 0.8 * avisibility)
{
vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist));
yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt);
}
}
else
{
vertex_alt = hazeLayerAltitude;
yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt);
}
}
else // the faster, full-day version without lightfields
{
//vertex_alt = max(gl_Vertex.z,100.0);
earthShade = 1.0;
mie_angle = 1.0;
if (terminator > 3000000.0)
{light_diffuse = vec4 (1.0, 1.0, 1.0, 0.0);
light_ambient = vec4 (0.33, 0.4, 0.5, 0.0); }
else
{
lightArg = (terminator/100000.0 - 10.0)/20.0;
light_diffuse.b = 0.78 + lightArg * 0.21;
light_diffuse.g = 0.907 + lightArg * 0.091;
light_diffuse.r = 0.904 + lightArg * 0.092;
light_diffuse.a = 1.0;
light_ambient.r = 0.316 + lightArg * 0.016;
light_ambient.g = light_ambient.r * 0.4/0.33;
light_ambient.b = light_ambient.r * 0.5/0.33;
light_ambient.a = 1.0;
}
light_diffuse = light_diffuse * scattering;
yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude);
}
// default lighting based on texture and material using the light we have just computed
diffuse_term = diffuse_color* light_diffuse;
vec4 constant_term = gl_FrontMaterial.emission + ambient_color *
(gl_LightModel.ambient + light_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;
setupShadows(gl_ModelViewMatrix * gl_Vertex);
}

View file

@ -7,6 +7,7 @@ varying vec4 diffuse_term;
varying vec3 normal;
varying vec3 relPos;
uniform float fg_Fcoef;
uniform sampler2D texture;
uniform samplerCube cube_texture;
@ -14,6 +15,8 @@ uniform samplerCube cube_texture;
varying float yprime_alt;
varying float mie_angle;
varying float flogz;
uniform float visibility;
uniform float avisibility;
@ -179,6 +182,7 @@ void main()
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -9,6 +9,8 @@ varying vec3 relPos;
varying vec3 rawpos;
uniform float fg_Fcoef;
uniform sampler2D texture;
uniform sampler2D lightmap_texture;
uniform sampler2D grain_texture;
@ -18,6 +20,8 @@ uniform samplerCube cube_texture;
varying float yprime_alt;
varying float mie_angle;
varying float flogz;
uniform float visibility;
uniform float avisibility;
@ -237,7 +241,8 @@ void main()
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -15,8 +15,6 @@
#define MODE_DIFFUSE 1
#define MODE_AMBIENT_AND_DIFFUSE 2
uniform float fg_Fcoef;
// The constant term of the lighting equation that doesn't depend on
// the surface normal is passed in gl_{Front,Back}Color. The alpha
// component is set to 1 for front, 0 for back in order to work around
@ -29,6 +27,8 @@ varying vec3 rawpos;
varying float yprime_alt;
varying float mie_angle;
varying float flogz;
uniform int colorMode;
uniform int irradiance_map_type;
uniform int ra_irradiance_map_type;
@ -88,7 +88,7 @@ void main()
//vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
// logarithmic depth
gl_Position.z = (log2(max(1e-6, 1.0 + gl_Position.w)) * fg_Fcoef - 1.0) * gl_Position.w;
flogz = 1.0 + gl_Position.w;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = gl_NormalMatrix * gl_Normal;
vec4 ambient_color, diffuse_color;

View file

@ -8,6 +8,8 @@ varying vec3 normal;
varying vec3 relPos;
uniform float fg_Fcoef;
uniform sampler2D texture;
uniform sampler2D dust_texture;
uniform sampler2D lightmap_texture;
@ -18,6 +20,8 @@ uniform samplerCube cube_texture;
varying float yprime_alt;
varying float mie_angle;
varying float flogz;
uniform float visibility;
uniform float avisibility;
@ -356,7 +360,8 @@ void main()
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -0,0 +1,51 @@
// -*-C++-*-
// Ambient term comes in gl_Color.rgb.
#version 120
varying vec4 diffuse_term;
varying vec3 normal;
varying float flogz;
uniform float fg_Fcoef;
uniform sampler2D texture;
void main()
{
vec3 n;
float NdotL, NdotHV;
vec4 color = gl_Color;
vec3 lightDir = gl_LightSource[0].position.xyz;
vec3 halfVector = gl_LightSource[0].halfVector.xyz;
vec4 texel;
vec4 fragColor;
vec4 specular = vec4(0.0);
// If gl_Color.a == 0, this is a back-facing polygon and the
// normal should be reversed.
n = (2.0 * gl_Color.a - 1.0) * normal;
n = normalize(n);
NdotL = dot(n, lightDir);
if (NdotL > 0.0) {
color += diffuse_term * NdotL;
NdotHV = max(dot(n, halfVector), 0.0);
if (gl_FrontMaterial.shininess > 0.0)
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
// saturated. Clamping the color before modulating by the texture
// is closer to what the OpenGL fixed function pipeline does.
color = clamp(color, 0.0, 1.0);
texel = texture2D(texture, gl_TexCoord[0].st);
fragColor = color * texel + specular;
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -0,0 +1,65 @@
// -*-C++-*-
// Shader that uses OpenGL state values to do per-pixel lighting
//
// The only light used is gl_LightSource[0], which is assumed to be
// directional.
//
// 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
// The constant term of the lighting equation that doesn't depend on
// the surface normal is passed in gl_{Front,Back}Color. The alpha
// component is set to 1 for front, 0 for back in order to work around
// bugs with gl_FrontFacing in the fragment shader.
varying vec4 diffuse_term;
varying vec3 normal;
varying float flogz;
uniform int colorMode;
////fog "include"////////
//uniform int fogType;
//
//void fog_Func(int type);
/////////////////////////
void main()
{
gl_Position = ftransform();
// logarithmic depth
flogz = 1.0 + gl_Position.w;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = gl_NormalMatrix * gl_Normal;
vec4 ambient_color, diffuse_color;
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;
}
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);
}

View file

@ -17,6 +17,10 @@ varying vec3 vertVec;
varying float alpha;
varying float flogz;
uniform float fg_Fcoef;
uniform sampler2D BaseTex;
uniform sampler2D LightMapTex;
uniform sampler2D NormalTex;
@ -682,4 +686,6 @@ void main (void)
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -13,11 +13,11 @@ varying vec3 vertVec;
varying float alpha;
varying float flogz;
attribute vec3 tangent;
attribute vec3 binormal;
uniform float fg_Fcoef;
uniform float pitch;
uniform float roll;
uniform float hdg;
@ -116,7 +116,7 @@ void main(void)
gl_Position = ftransform();
// logarithmic depth
gl_Position.z = (log2(max(1e-6, 1.0 + gl_Position.w)) * fg_Fcoef - 1.0) * gl_Position.w;
flogz = 1.0 + gl_Position.w;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
setupShadows(ecPosition);

View file

@ -16,6 +16,8 @@ varying vec3 vertVec;
varying float alpha;
varying float flogz;
attribute vec3 tangent;
attribute vec3 binormal;
@ -163,6 +165,8 @@ void main(void)
gl_FrontColor = gl_Color;
}
gl_Position = gl_ModelViewProjectionMatrix * vertex;
// logarithmic depth
flogz = 1.0 + gl_Position.w;
//gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}

View file

@ -4,6 +4,8 @@ varying vec3 vertex;
varying vec3 normal;
varying vec3 relVec;
uniform float fg_Fcoef;
uniform float osg_SimulationTime;
uniform float arc_id;
@ -25,4 +27,6 @@ void main()
gl_Position = gl_ModelViewProjectionMatrix * vert_out;
// logarithmic depth
gl_Position.z = (log2(max(1e-6, 1.0 + gl_Position.w)) * fg_Fcoef - 1.0) * gl_Position.w;
}

View file

@ -21,6 +21,8 @@ varying vec3 normal;
varying vec3 ecViewDir;
varying vec3 VTangent;
uniform float fg_Fcoef;
uniform int colorMode;
attribute vec3 tangent;//, binormal;
@ -34,6 +36,8 @@ void main()
ecViewDir = (gl_ModelViewMatrix * (ep - gl_Vertex)).xyz;
gl_Position = ftransform();
// logarithmic depth
gl_Position.z = (log2(max(1e-6, 1.0 + gl_Position.w)) * fg_Fcoef - 1.0) * gl_Position.w;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = gl_NormalMatrix * gl_Normal;
VTangent = gl_NormalMatrix * tangent;

View file

@ -1,10 +1,14 @@
#version 120
uniform float fg_Fcoef;
uniform sampler2D baseTexture;
varying float fogFactor;
varying vec3 hazeColor;
varying vec3 relVector;
varying float flogz;
vec3 filter_combined (in vec3 color) ;
uniform bool is_lightning;
@ -62,5 +66,6 @@ void main(void)
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -5,6 +5,8 @@ varying float fogFactor;
varying vec3 hazeColor;
varying vec3 relVector;
varying float flogz;
uniform float range; // From /sim/rendering/clouds3d-vis-range
uniform float scattering;
uniform float terminator;
@ -57,7 +59,8 @@ void main(void)
relVector = gl_Position.xyz - ep.xyz;
gl_Position = gl_ModelViewProjectionMatrix * gl_Position;
// logarithmic depth
flogz = 1.0 + gl_Position.w;
// Light at the final position

View file

@ -19,6 +19,10 @@ varying vec3 vertVec;
varying float alpha;
varying float flogz;
uniform float fg_Fcoef;
uniform sampler2D BaseTex;
uniform sampler2D NormalTex;
uniform sampler2D ReflMapTex;
@ -864,5 +868,6 @@ void main (void)
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -677,6 +677,7 @@ fragColor.rgb = mix(hazeColor + secondary_light * fog_backscatter(mvisibility),
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -530,6 +530,7 @@ fragColor.rgb = mix(hazeColor +secondary_light * fog_backscatter(mvisibility), f
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -8,12 +8,16 @@ varying vec3 normal;
varying vec3 relPos;
uniform float fg_Fcoef;
uniform sampler2D texture;
varying float yprime_alt;
varying float mie_angle;
varying float flogz;
uniform float visibility;
uniform float avisibility;
@ -355,6 +359,7 @@ fragColor.rgb = mix(hazeColor + secondary_light * fog_backscatter(mvisibility),
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -27,6 +27,8 @@ varying float yprime_alt;
varying float mie_angle;
varying float alt_factor;
varying float flogz;
uniform int colorMode;
uniform float hazeLayerAltitude;
uniform float terminator;
@ -77,6 +79,8 @@ void main()
//vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
// logarithmic depth
flogz = 1.0 + gl_Position.w;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = gl_NormalMatrix * gl_Normal;
vec4 ambient_color, diffuse_color;

View file

@ -17,6 +17,10 @@ varying vec3 vertVec;
varying float alpha;
varying float flogz;
uniform float fg_Fcoef;
uniform sampler2D BaseTex;
uniform sampler2D LightMapTex;
uniform sampler2D NormalTex;
@ -673,6 +677,7 @@ void main (void)
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -13,6 +13,8 @@ varying vec3 vertVec;
varying float alpha;
varying float flogz;
attribute vec3 tangent;
attribute vec3 binormal;
@ -110,5 +112,7 @@ void main(void)
gl_FrontColor = gl_Color;
gl_Position = ftransform();
// logarithmic depth
flogz = 1.0 + gl_Position.w;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}

View file

@ -1,6 +1,8 @@
// -*-C++-*-
#version 120
uniform float fg_Fcoef;
uniform sampler2D texture;
uniform float visibility;
@ -17,6 +19,8 @@ varying vec3 relPos;
varying vec2 rawPos;
varying float pixelSize;
varying float flogz;
float alt;
float Noise2D(in vec2 coord, in float wavelength);
@ -173,6 +177,7 @@ void main()
light_color = mix(light_color, vec3 (1.0, 1.0, 1.0), 0.5 * intensity * intensity);
gl_FragColor = vec4 (clamp(light_color.rgb,0.0,1.0), intensity * transmission * dist_att);
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -13,12 +13,16 @@ varying vec3 relPos;
varying vec2 rawPos;
varying float pixelSize;
varying float flogz;
bool light_directional = true;
void main()
{
gl_FrontColor= gl_Color;
gl_Position = ftransform();
// logarithmic depth
flogz = 1.0 + gl_Position.w;
vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0);
relPos = gl_Vertex.xyz - ep.xyz;

View file

@ -249,6 +249,7 @@ fragColor.rgb = mix(hazeColor, fragColor.rgb,transmission);
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -504,6 +504,7 @@ fragColor.rgb = mix(clamp(hazeColor,0.0,1.0) , clamp(fragColor.rgb,0.0,1.0),tran
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -1,9 +1,10 @@
// -*-C++-*-
#version 120
#define MAX_LAYERS 8
#define MAX_DISTANCE 3000.0
uniform float fg_Fcoef;
uniform float visibility;
uniform float avisibility;
uniform float scattering;
@ -39,6 +40,8 @@ varying vec3 g_normal;
varying float g_altitude;
varying float g_layer; // The layer where the fragment lives (0-1 range)
varying float flogz;
float rand2D(in vec2 co);
float Noise2D(in vec2 co, in float wavelength);
@ -168,4 +171,6 @@ void main()
fragColor = clamp(fragColor, 0.0, 1.0);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -16,6 +16,8 @@ varying out vec3 g_normal;
varying out float g_altitude;
varying out float g_layer;
varying out float flogz;
float min3(in float a, in float b, in float c)
@ -50,6 +52,8 @@ void main()
g_altitude = gl_PositionIn[i].z;
gl_Position = gl_ModelViewProjectionMatrix * pos;
// logarithmic depth
flogz = 1.0 + gl_Position.w;
gl_TexCoord[0] = gl_TexCoordIn[i][0];
EmitVertex();
}

View file

@ -666,6 +666,7 @@ fragColor.rgb = mix(hazeColor+secondary_light * fog_backscatter(mvisibility) , f
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -0,0 +1,12 @@
#version 120
uniform float fg_Fcoef;
varying float flogz;
void main()
{
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -0,0 +1,10 @@
#version 120
varying float flogz;
void main()
{
gl_Position = ftransform();
// logarithmic depth
flogz = 1.0 + gl_Position.w;
}

View file

@ -5,6 +5,10 @@
varying vec3 vertex;
varying vec3 viewDir;
varying float flogz;
uniform float fg_Fcoef;
uniform float osg_SimulationTime;
uniform float thrust_collimation;
uniform float flame_radius_fraction;
@ -139,4 +143,6 @@ color = mix(color, vec3(base_flame_r, base_flame_g, base_flame_b), density1);
vec4 finalColor = vec4 (color.rgb, density);
gl_FragColor = finalColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -5,6 +5,8 @@
varying vec3 vertex;
varying vec3 viewDir;
varying float flogz;
void main()
{
@ -14,6 +16,8 @@ vertex = gl_Vertex.xyz;
viewDir = normalize(vertex - ep.xyz);
gl_Position = ftransform();
// logarithmic depth
flogz = 1.0 + gl_Position.w;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_FrontColor = vec4 (1.0,1.0,1.0,1.0);

View file

@ -25,6 +25,8 @@ varying float earthShade;
varying float yprime_alt;
varying float mie_angle;
varying float flogz;
uniform float osg_SimulationTime;
uniform float WindE, WindN, spd, hdg;
uniform float hazeLayerAltitude;
@ -105,6 +107,8 @@ void main(void)
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_Position = ftransform();
// logarithmic depth
flogz = 1.0 + gl_Position.w;
// here start computations for the haze layer

View file

@ -560,5 +560,6 @@ if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColo
finalColor.rgb = filter_combined(finalColor.rgb);
gl_FragColor = finalColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -742,6 +742,7 @@ finalColor.rgb = filter_combined(finalColor.rgb);
gl_FragColor = finalColor;
// logarithmic depth
gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5;
}

View file

@ -1,9 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This Compositor pipeline imitates the classic forward pipeline used before
multi-pass rendering was introduced. It doesn't involve any FBOs and all the
rendering happens in two passes rendering directly to the screen.
The precision of the Z-buffer deteriorates with huge near-far spreads, so
two passes with different depth ranges are used to avoid Z-fighting and
other unpleasantness.
-->
<PropertyList>
<name>low-spec</name>
<pass>
<name>display</name>
<pass n="0">
<name>far</name>
<type>scene</type>
<z-near>100.0</z-near>
</pass>
<pass n="1">
<name>near</name>
<type>scene</type>
<cull-mask>0xfff7ff</cull-mask> <!-- Cull the sky (bit 11 off) -->
<!-- Only clear the depth buffer so color information isn't overwritten -->
<clear-mask>depth</clear-mask>
<z-far>100.0</z-far>
</pass>
</PropertyList>