SHADERS:fix "unified" fog function.
Signed-off-by: Emilian Huminiuc <emilianh@gmail.com>
This commit is contained in:
parent
c56989d0e6
commit
4df2af2cef
55 changed files with 427 additions and 226 deletions
|
@ -316,7 +316,7 @@
|
|||
</texture-unit>
|
||||
|
||||
<program>
|
||||
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
|
||||
<!-- <vertex-shader>Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader>Shaders/wake.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader>Shaders/bowwave.frag</fragment-shader>
|
||||
|
@ -445,7 +445,7 @@
|
|||
<type>sampler-3d</type>
|
||||
<value type="int">1</value>
|
||||
</uniform>
|
||||
|
||||
|
||||
<!-- BEGIN fog include -->
|
||||
<uniform>
|
||||
<name>visibility</name>
|
||||
|
|
|
@ -80,8 +80,9 @@
|
|||
</internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/crop.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/crop.frag</fragment-shader>
|
||||
<vertex-shader n="1">Shaders/crop.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/crop.frag</fragment-shader>
|
||||
</program>
|
||||
<uniform>
|
||||
<name>NoiseTex</name>
|
||||
|
|
|
@ -146,10 +146,10 @@
|
|||
<use>vertex-program-two-side</use>
|
||||
</vertex-program-two-side>
|
||||
<program>
|
||||
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
|
||||
<vertex-shader>Shaders/flutter.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader>Shaders/default.frag</fragment-shader>
|
||||
<!-- <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader n="1">Shaders/flutter.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/default.frag</fragment-shader>
|
||||
</program>
|
||||
<!--<uniform>
|
||||
<name>texture</name>
|
||||
|
@ -217,7 +217,7 @@
|
|||
<use>heading-deg</use>
|
||||
</value>
|
||||
</uniform>
|
||||
|
||||
|
||||
<!-- BEGIN fog include -->
|
||||
<uniform>
|
||||
<name>visibility</name>
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
</internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||
<!-- <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader n="1">Shaders/forest.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/forest.frag</fragment-shader>
|
||||
|
|
|
@ -149,7 +149,7 @@
|
|||
</internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||
<!-- <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader n="1">Shaders/forest.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/forest.frag</fragment-shader>
|
||||
|
|
|
@ -149,7 +149,7 @@
|
|||
</internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||
<!-- <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader n="1">Shaders/forest.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/forest.frag</fragment-shader>
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
</internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||
<!-- <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader n="1">Shaders/landmass-g.vert</vertex-shader>
|
||||
<geometry-shader>Shaders/landmass.geom</geometry-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
|
@ -140,7 +140,7 @@
|
|||
</value>
|
||||
</uniform>
|
||||
<color-mask type="vec4d">0 0 0 0</color-mask>
|
||||
|
||||
|
||||
<!-- BEGIN fog include -->
|
||||
<uniform>
|
||||
<name>visibility</name>
|
||||
|
@ -185,7 +185,7 @@
|
|||
</value>
|
||||
</uniform>
|
||||
<!-- END fog include -->
|
||||
|
||||
|
||||
</pass>
|
||||
<pass>
|
||||
<lighting>true</lighting>
|
||||
|
|
|
@ -11,6 +11,26 @@
|
|||
</material>
|
||||
<condition><use>/sim/rendering/shader/generic</use></condition>
|
||||
<factor>1</factor>
|
||||
<!-- 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="10">
|
||||
<predicate>
|
||||
|
@ -83,7 +103,8 @@
|
|||
</vertex-program-two-side>
|
||||
<program>
|
||||
<vertex-shader>Shaders/lightmap.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/lightmap.frag</fragment-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/lightmap.frag</fragment-shader>
|
||||
</program>
|
||||
<uniform>
|
||||
<name>texture</name>
|
||||
|
@ -110,6 +131,50 @@
|
|||
<type>float</type>
|
||||
<value><use>factor</use></value>
|
||||
</uniform>
|
||||
<!-- BEGIN fog include -->
|
||||
<uniform>
|
||||
<name>visibility</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>visibility</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>avisibility</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>avisibility</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>hazeLayerAltitude</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>lthickness</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>scattering</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>scattering</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>terminator</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>terminator</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>fogType</name>
|
||||
<type>int</type>
|
||||
<value>
|
||||
<use>fogtype</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<!-- END fog include -->
|
||||
</pass>
|
||||
</technique>
|
||||
<technique n="11">
|
||||
|
|
|
@ -366,7 +366,7 @@ please see Docs/README.model-combined.eff for documentation
|
|||
</vertex-program-two-side>
|
||||
|
||||
<program>
|
||||
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||
<!-- <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader n="1">Shaders/ubershader.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/ubershader.frag</fragment-shader>
|
||||
|
@ -391,7 +391,7 @@ please see Docs/README.model-combined.eff for documentation
|
|||
<type>sampler-3d</type>
|
||||
<value type="int">1</value>
|
||||
</uniform>
|
||||
|
||||
|
||||
<uniform>
|
||||
<name>NormalTex</name>
|
||||
<type>sampler-2d</type>
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
<use>vertex-program-two-side</use>
|
||||
</vertex-program-two-side>
|
||||
<program>
|
||||
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||
<!-- <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> -->
|
||||
<!--fog include-->
|
||||
<vertex-shader n="1">Shaders/default.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
|
|
|
@ -215,7 +215,7 @@ EXAMPLES: You can find examples of both usages in the Hunter and Lightning model
|
|||
<use>texture[0]/internal-format</use>
|
||||
</internal-format>
|
||||
</texture-unit>
|
||||
|
||||
|
||||
<texture-unit>
|
||||
<unit>1</unit>
|
||||
<image>
|
||||
|
@ -314,10 +314,10 @@ EXAMPLES: You can find examples of both usages in the Hunter and Lightning model
|
|||
|
||||
|
||||
<program>
|
||||
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
|
||||
<vertex-shader>Shaders/reflect-bump-spec.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader>Shaders/reflect-bump-spec.frag</fragment-shader>
|
||||
<!-- <vertex-shader>Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader n="1">Shaders/reflect-bump-spec.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/reflect-bump-spec.frag</fragment-shader>
|
||||
<attribute>
|
||||
<name>tangent</name>
|
||||
<index>6</index>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
To use a reflection map set <reflect_map> to 1,and the path to the map texture in
|
||||
<texture n="8">
|
||||
|
||||
|
||||
To use a light map set <light_map> to 1,and the path to the map texture in
|
||||
<texture n="2">
|
||||
|
||||
|
@ -213,7 +213,7 @@
|
|||
<use>texture[8]/internal-format</use>
|
||||
</internal-format>
|
||||
</texture-unit>
|
||||
|
||||
|
||||
<texture-unit>
|
||||
<unit>2</unit>
|
||||
<type>
|
||||
|
@ -226,12 +226,12 @@
|
|||
<wrap-s>repeat</wrap-s>
|
||||
<wrap-t>repeat</wrap-t>
|
||||
</texture-unit>
|
||||
|
||||
|
||||
<texture-unit>
|
||||
<unit>3</unit>
|
||||
<type>noise</type>
|
||||
</texture-unit>
|
||||
|
||||
|
||||
<texture-unit>
|
||||
<unit>5</unit>
|
||||
<type>
|
||||
|
@ -288,7 +288,7 @@
|
|||
</texture-unit>
|
||||
|
||||
<program>
|
||||
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||
<!-- <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader n="1">Shaders/reflect.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/reflect.frag</fragment-shader>
|
||||
|
@ -317,7 +317,7 @@
|
|||
<type>sampler-2d</type>
|
||||
<value type="int">1</value>
|
||||
</uniform>
|
||||
|
||||
|
||||
<uniform>
|
||||
<name>Lightmap</name>
|
||||
<type>sampler-2d</type>
|
||||
|
@ -329,7 +329,7 @@
|
|||
<type>sampler-3d</type>
|
||||
<value type="int">3</value>
|
||||
</uniform>
|
||||
|
||||
|
||||
<uniform>
|
||||
<name>Environment</name>
|
||||
<type>sampler-cube</type>
|
||||
|
@ -402,7 +402,7 @@
|
|||
<use>reflect_map</use>
|
||||
</value>
|
||||
</uniform>
|
||||
|
||||
|
||||
<!-- use a light map-->
|
||||
<uniform>
|
||||
<name>light_map</name>
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
<use>texture[1]/internal-format</use>
|
||||
</internal-format>
|
||||
</texture-unit>
|
||||
|
||||
|
||||
<texture-unit>
|
||||
<unit>1</unit>
|
||||
<image>
|
||||
|
@ -147,7 +147,7 @@
|
|||
<unit>2</unit>
|
||||
<type>noise</type>
|
||||
</texture-unit>
|
||||
|
||||
|
||||
<texture-unit>
|
||||
<unit>4</unit>
|
||||
<image>
|
||||
|
@ -230,7 +230,7 @@
|
|||
</cull-face>
|
||||
|
||||
<program>
|
||||
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||
<!-- <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader n="1">Shaders/reflect-bump-spec.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/runway-reflect-bump-spec.frag</fragment-shader>
|
||||
|
@ -261,7 +261,7 @@
|
|||
<type>sampler-3d</type>
|
||||
<value type="int">2</value>
|
||||
</uniform>
|
||||
|
||||
|
||||
<uniform>
|
||||
<name>NormalTex</name>
|
||||
<type>sampler-2d</type>
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
</internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||
<!-- <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader n="1">Shaders/default.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/terrain-nocolor.frag</fragment-shader>
|
||||
|
|
|
@ -229,10 +229,10 @@ parameters :
|
|||
</texture-unit>
|
||||
|
||||
<program>
|
||||
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
|
||||
<vertex-shader>Shaders/transition.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader>Shaders/transition.frag</fragment-shader>
|
||||
<!-- <vertex-shader>Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader n="1">Shaders/transition.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/transition.frag</fragment-shader>
|
||||
</program>
|
||||
|
||||
<uniform>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<use>/sim/rendering/shaders/urban</use>
|
||||
</quality-level>
|
||||
|
||||
<!--fog include-->
|
||||
<!--fog include-->
|
||||
<visibility>
|
||||
<use>/environment/ground-visibility-m</use>
|
||||
</visibility>
|
||||
|
@ -159,7 +159,7 @@
|
|||
<type>noise</type>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||
<!-- <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader n="1">Shaders/urban.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/urban.frag</fragment-shader>
|
||||
|
@ -489,7 +489,7 @@
|
|||
<use>snow-level</use>
|
||||
</value>
|
||||
</uniform>
|
||||
|
||||
|
||||
|
||||
</pass>
|
||||
</technique>
|
||||
|
|
|
@ -195,10 +195,12 @@
|
|||
</internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
|
||||
<!-- <vertex-shader>Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader>Shaders/water.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader>Shaders/water-inland.frag</fragment-shader>
|
||||
</program>
|
||||
|
||||
<uniform>
|
||||
<name>water_reflection</name>
|
||||
<type>sampler-2d</type>
|
||||
|
@ -360,6 +362,7 @@
|
|||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/water-orig.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader>Shaders/water-orig.frag</fragment-shader>
|
||||
</program>
|
||||
<uniform>
|
||||
|
@ -367,6 +370,50 @@
|
|||
<type>sampler-3d</type>
|
||||
<value type="int">0</value>
|
||||
</uniform>
|
||||
<!-- BEGIN fog include -->
|
||||
<uniform>
|
||||
<name>visibility</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>visibility</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>avisibility</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>avisibility</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>hazeLayerAltitude</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>lthickness</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>scattering</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>scattering</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>terminator</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>terminator</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>fogType</name>
|
||||
<type>int</type>
|
||||
<value>
|
||||
<use>fogtype</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<!-- END fog include -->
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
||||
|
|
|
@ -292,7 +292,7 @@
|
|||
</texture-unit>
|
||||
|
||||
<program>
|
||||
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
|
||||
<!-- <vertex-shader>Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader>Shaders/water.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader>Shaders/water_sine.frag</fragment-shader>
|
||||
|
@ -449,7 +449,7 @@
|
|||
</uniform>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- BEGIN fog include -->
|
||||
<uniform>
|
||||
<name>visibility</name>
|
||||
|
@ -658,7 +658,7 @@
|
|||
</texture-unit>
|
||||
|
||||
<program>
|
||||
<vertex-shader>Shaders/include_fog.vert</vertex-shader>
|
||||
<!-- <vertex-shader>Shaders/include_fog.vert</vertex-shader> -->
|
||||
<vertex-shader>Shaders/water.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader>Shaders/water.frag</fragment-shader>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Licence: GPL v2
|
||||
// Author: Frederic Bouvier
|
||||
|
||||
varying float fogCoord;
|
||||
//varying float fogCoord;
|
||||
|
||||
varying vec3 VNormal;
|
||||
varying vec3 VTangent;
|
||||
|
@ -11,7 +11,13 @@ varying vec3 VBinormal;
|
|||
uniform sampler2D tex_color;
|
||||
uniform sampler2D tex_normal;
|
||||
|
||||
void main (void)
|
||||
////fog "include" /////
|
||||
uniform int fogType;
|
||||
|
||||
vec3 fog_Func(vec3 color, int type);
|
||||
//////////////////////
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec4 ns = texture2D(tex_normal, gl_TexCoord[0].st);
|
||||
vec3 N = ns.rgb * 2.0 - 1.0;
|
||||
|
@ -36,11 +42,12 @@ void main (void)
|
|||
color = clamp( color, 0.0, 1.0 );
|
||||
|
||||
|
||||
float fogFactor;
|
||||
const float LOG2 = 1.442695;
|
||||
fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
// float fogFactor;
|
||||
// const float LOG2 = 1.442695;
|
||||
// fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
// fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
// gl_FragColor = mix(gl_Fog.color, color, fogFactor);
|
||||
|
||||
|
||||
gl_FragColor = mix(gl_Fog.color, color, fogFactor);
|
||||
color.rgb = fog_Func(fragColor.rgb, fogType);
|
||||
gl_FragColor = color;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Licence: GPL v2
|
||||
// Author: Frederic Bouvier
|
||||
|
||||
varying float fogCoord;
|
||||
//varying float fogCoord;
|
||||
varying vec3 VNormal;
|
||||
varying vec3 VTangent;
|
||||
varying vec3 VBinormal;
|
||||
|
@ -12,8 +12,8 @@ attribute vec3 binormal;
|
|||
|
||||
void main (void)
|
||||
{
|
||||
vec4 pos = gl_ModelViewMatrix * gl_Vertex;
|
||||
fogCoord = pos.z / pos.w;
|
||||
// vec4 pos = gl_ModelViewMatrix * gl_Vertex;
|
||||
// fogCoord = pos.z / pos.w;
|
||||
|
||||
VNormal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
VTangent = normalize(gl_NormalMatrix * tangent);
|
||||
|
|
|
@ -18,12 +18,18 @@ const float scale = 1.0;
|
|||
#define BLA 1
|
||||
#define BLA2 0
|
||||
|
||||
////fog "include" /////
|
||||
uniform int fogType;
|
||||
|
||||
vec3 fog_Func(vec3 color, int type);
|
||||
//////////////////////
|
||||
|
||||
void main (void)
|
||||
{
|
||||
|
||||
vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000144);
|
||||
basecolor = texture1D(ColorsTex, basecolor.r+0.00);
|
||||
|
||||
|
||||
vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale);
|
||||
|
||||
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale);
|
||||
|
@ -51,10 +57,10 @@ void main (void)
|
|||
// good
|
||||
vec4 c1;
|
||||
c1 = basecolor * vec4(smoothstep(0.0, 1.15, n), smoothstep(0.0, 1.2, n), smoothstep(0.1, 1.3, n), 1.0);
|
||||
|
||||
|
||||
//"steep = gray"
|
||||
c1 = mix(vec4(n-0.42, n-0.44, n-0.51, 1.0), c1, smoothstep(0.970, 0.990, abs(normalize(Normal).z)+nvL[2]*1.3));
|
||||
|
||||
|
||||
//"snow"
|
||||
c1 = mix(c1, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0), smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0));
|
||||
|
||||
|
@ -64,8 +70,10 @@ void main (void)
|
|||
c1 *= ambient_light;
|
||||
vec4 finalColor = c1;
|
||||
|
||||
if(gl_Fog.density == 1.0)
|
||||
fogFactor=1.0;
|
||||
|
||||
gl_FragColor = mix(gl_Fog.color ,finalColor, fogFactor);
|
||||
// if(gl_Fog.density == 1.0)
|
||||
// fogFactor=1.0;
|
||||
//
|
||||
// gl_FragColor = mix(gl_Fog.color ,finalColor, fogFactor);
|
||||
finalColor.rgb = fog_Func(finalColor.rgb, fogType);
|
||||
gl_FragColor = finalColor;
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ varying vec3 normal;
|
|||
uniform int colorMode;
|
||||
|
||||
////fog "include"////////
|
||||
uniform int fogType;
|
||||
|
||||
void fog_Func(int type);
|
||||
//uniform int fogType;
|
||||
//
|
||||
//void fog_Func(int type);
|
||||
/////////////////////////
|
||||
|
||||
void main()
|
||||
|
@ -57,5 +57,5 @@ void main()
|
|||
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);
|
||||
//fog_Func(fogType);
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@ uniform float Offset, AmpFactor, WindE, WindN, spd, hdg;
|
|||
uniform sampler3D Noise;
|
||||
|
||||
////fog "include"////////
|
||||
uniform int fogType;
|
||||
|
||||
void fog_Func(int type);
|
||||
//uniform int fogType;
|
||||
//
|
||||
//void fog_Func(int type);
|
||||
/////////////////////////
|
||||
|
||||
/////// functions /////////
|
||||
|
@ -56,7 +56,7 @@ void relWind(out float rel_wind_speed_kts, out float rel_wind_from_rad)
|
|||
float rel_wind_speed_from_north_kts = WindN*fps2kts + speed_north_kts;
|
||||
|
||||
//combine relative speeds north and east to get relative windspeed in kts
|
||||
rel_wind_speed_kts = sqrt(pow(abs(rel_wind_speed_from_east_kts), 2)
|
||||
rel_wind_speed_kts = sqrt(pow(abs(rel_wind_speed_from_east_kts), 2)
|
||||
+ pow(abs(rel_wind_speed_from_north_kts), 2));
|
||||
|
||||
//calculate the relative wind direction
|
||||
|
@ -138,6 +138,6 @@ void main()
|
|||
gl_BackColor.rgb = ambient_term.rgb; gl_FrontColor.a = 1.0;
|
||||
// fogCoord = abs(ecPosition.z / ecPosition.w);
|
||||
|
||||
fog_Func(fogType);
|
||||
//fog_Func(fogType);
|
||||
|
||||
}
|
||||
|
|
|
@ -10,11 +10,11 @@ varying vec4 constantColor;
|
|||
attribute vec3 tangent;
|
||||
attribute vec3 binormal;
|
||||
|
||||
////fog "include"////////
|
||||
uniform int fogType;
|
||||
|
||||
void fog_Func(int type);
|
||||
/////////////////////////
|
||||
// ////fog "include"////////
|
||||
// uniform int fogType;
|
||||
//
|
||||
// void fog_Func(int type);
|
||||
// /////////////////////////
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -30,5 +30,5 @@ void main(void)
|
|||
+ gl_FrontColor * (gl_LightModel.ambient + gl_LightSource[0].ambient);
|
||||
gl_Position = ftransform();
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
fog_Func(fogType);
|
||||
// fog_Func(fogType);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
//#define fog_FuncTION
|
||||
//default fog
|
||||
//varying float fogCoord;
|
||||
varying vec3 PointPos;
|
||||
//varying vec4 EyePos;
|
||||
//varying vec3 PointPos;
|
||||
|
||||
vec3 fog_Func(vec3 color, int type)
|
||||
{
|
||||
//if (type == 0){
|
||||
const float LOG2 = 1.442695;
|
||||
//vec3 EyePos = vec3(0.0);
|
||||
float fogCoord =length(PointPos);
|
||||
//float fogCoord =length(PointPos);
|
||||
float fogCoord = gl_FragCoord.z / gl_FragCoord.w;
|
||||
float fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
|
||||
if(gl_Fog.density == 1.0)
|
||||
|
|
|
@ -32,9 +32,9 @@ attribute vec3 binormal;
|
|||
uniform float canopy_height;
|
||||
|
||||
////fog "include"////////
|
||||
uniform int fogType;
|
||||
|
||||
void fog_Func(int type);
|
||||
// uniform int fogType;
|
||||
//
|
||||
// void fog_Func(int type);
|
||||
/////////////////////////
|
||||
|
||||
void main(void)
|
||||
|
@ -55,5 +55,5 @@ void main(void)
|
|||
constantColorIn = gl_FrontMaterial.emission
|
||||
+ gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
|
||||
|
||||
fog_Func(fogType);
|
||||
// fog_Func(fogType);
|
||||
}
|
||||
|
|
|
@ -9,12 +9,12 @@ varying vec4 constantColor;
|
|||
attribute vec3 tangent;
|
||||
attribute vec3 binormal;
|
||||
|
||||
////fog "include" /////
|
||||
uniform int fogType;
|
||||
|
||||
void fog_Func(int type);
|
||||
|
||||
//////////////////////
|
||||
// ////fog "include" /////
|
||||
// uniform int fogType;
|
||||
//
|
||||
// void fog_Func(int type);
|
||||
//
|
||||
// //////////////////////
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -27,9 +27,9 @@ void main(void)
|
|||
|
||||
gl_FrontColor = gl_Color;
|
||||
constantColor = gl_FrontMaterial.emission
|
||||
+ gl_FrontColor * (gl_LightModel.ambient + gl_LightSource[0].ambient);
|
||||
+ gl_FrontColor * (gl_LightModel.ambient + gl_LightSource[0].ambient);
|
||||
gl_Position = ftransform();
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
fog_Func(fogType);
|
||||
// fog_Func(fogType);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
varying float fogCoord;
|
||||
#version 120
|
||||
//varying float fogCoord;
|
||||
////fog "include" /////
|
||||
uniform int fogType;
|
||||
|
||||
vec3 fog_Func(vec3 color, int type);
|
||||
//////////////////////
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
varying float fogCoord;
|
||||
// varying float fogCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Vertex);
|
||||
// vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Vertex);
|
||||
|
||||
gl_Position = ftransform();
|
||||
fogCoord = abs(ecPosition.z);
|
||||
// fogCoord = abs(ecPosition.z);
|
||||
}
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
// Ambient term comes in gl_Color.rgb.
|
||||
//
|
||||
// See http://wiki.flightgear.org/index.php/Howto:_Lightmap for details on
|
||||
// See http://wiki.flightgear.org/index.php/Howto:_Lightmap for details on
|
||||
// how to use it.
|
||||
|
||||
varying vec4 diffuse_term;
|
||||
varying vec3 normal;
|
||||
varying float fogCoord;
|
||||
//varying float fogCoord;
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
|
@ -16,6 +16,13 @@ uniform float condition;
|
|||
uniform float lightmap_factor;
|
||||
uniform sampler2D lightmap_texture;
|
||||
|
||||
////fog "include" /////
|
||||
uniform int fogType;
|
||||
|
||||
vec3 fog_Func(vec3 color, int type);
|
||||
//////////////////////
|
||||
|
||||
|
||||
float luminance(vec3 color)
|
||||
{
|
||||
return dot(vec3(0.212671, 0.715160, 0.072169), color);
|
||||
|
@ -53,13 +60,15 @@ void main()
|
|||
color = clamp(color, 0.0, 1.0);
|
||||
texel = texture2D(texture, gl_TexCoord[0].st);
|
||||
fragColor = color * texel + specular;
|
||||
|
||||
|
||||
// The lightmap function
|
||||
if ( condition >= 1.0 ) {
|
||||
vec3 lightmapTexel = texture2D(lightmap_texture, gl_TexCoord[0].st).rgb * lightmap_factor;
|
||||
fragColor.rgb = max(fragColor.rgb, lightmapTexel * gl_FrontMaterial.diffuse.rgb * texel.rgb);
|
||||
}
|
||||
|
||||
fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
|
||||
gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
|
||||
|
||||
// fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
|
||||
// gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
|
||||
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
|
||||
gl_FragColor = fragColor;
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
// Diffuse colors come from the gl_Color, ambient from the material. This is
|
||||
// equivalent to osg::Material::DIFFUSE.
|
||||
//
|
||||
// See http://wiki.flightgear.org/index.php/Howto:_Lightmap for details on
|
||||
// See http://wiki.flightgear.org/index.php/Howto:_Lightmap for details on
|
||||
// how to use it.
|
||||
|
||||
#define MODE_OFF 0
|
||||
|
@ -21,7 +21,7 @@
|
|||
// bugs with gl_FrontFacing in the fragment shader.
|
||||
varying vec4 diffuse_term;
|
||||
varying vec3 normal;
|
||||
varying float fogCoord;
|
||||
//varying float fogCoord;
|
||||
uniform int colorMode;
|
||||
|
||||
void main()
|
||||
|
@ -54,5 +54,5 @@ void main()
|
|||
// gl_FrontFacing in the fragment shader.
|
||||
gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0;
|
||||
gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0;
|
||||
fogCoord = abs(ecPosition.z / ecPosition.w);
|
||||
//fogCoord = abs(ecPosition.z / ecPosition.w);
|
||||
}
|
||||
|
|
|
@ -3,10 +3,17 @@
|
|||
// Shader for use with material animations
|
||||
varying vec4 diffuse, constantColor, matSpecular;
|
||||
varying vec3 normal;
|
||||
varying float fogCoord, alpha;
|
||||
//varying float fogCoord, alpha;
|
||||
varying float alpha;
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
////fog "include" /////
|
||||
uniform int fogType;
|
||||
|
||||
vec3 fog_Func(vec3 color, int type);
|
||||
//////////////////////
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 n, halfV;
|
||||
|
@ -37,6 +44,8 @@ void main()
|
|||
color = clamp(color, 0.0, 1.0);
|
||||
texel = texture2D(texture, gl_TexCoord[0].st);
|
||||
fragColor = color * texel + specular;
|
||||
fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
|
||||
gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
|
||||
//fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
|
||||
//gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
|
||||
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
|
||||
gl_FragColor = fragColor;
|
||||
}
|
||||
|
|
|
@ -14,12 +14,13 @@ vec4 emissionColor();
|
|||
|
||||
varying vec4 diffuse, constantColor, matSpecular;
|
||||
varying vec3 normal;
|
||||
varying float alpha, fogCoord;
|
||||
//varying float alpha, fogCoord;
|
||||
varying float alpha;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
|
||||
vec3 ecPosition3 = vec3(gl_ModelViewMatrix * gl_Vertex) / ecPosition.w;
|
||||
//vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
|
||||
//vec3 ecPosition3 = vec3(gl_ModelViewMatrix * gl_Vertex) / ecPosition.w;
|
||||
gl_Position = ftransform();
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
normal = gl_NormalMatrix * gl_Normal;
|
||||
|
@ -32,6 +33,6 @@ void main()
|
|||
alpha = diffuse.a;
|
||||
constantColor = emissionColor()
|
||||
+ ambientColor() * (gl_LightModel.ambient + gl_LightSource[0].ambient);
|
||||
fogCoord = abs(ecPosition3.z);
|
||||
//fogCoord = abs(ecPosition3.z);
|
||||
matSpecular = specularColor();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// -*-C++-*-
|
||||
#version 120
|
||||
|
||||
vec4 ambientColor()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// -*-C++-*-
|
||||
#version 120
|
||||
|
||||
vec4 ambientColor()
|
||||
{
|
||||
|
|
|
@ -3,10 +3,16 @@
|
|||
// Ambient term comes in gl_Color.rgb.
|
||||
varying vec4 diffuse_term;
|
||||
varying vec3 normal;
|
||||
varying float fogCoord;
|
||||
//varying float fogCoord;
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
////fog "include" /////
|
||||
uniform int fogType;
|
||||
|
||||
vec3 fog_Func(vec3 color, int type);
|
||||
//////////////////////
|
||||
|
||||
float luminance(vec3 color)
|
||||
{
|
||||
return dot(vec3(0.212671, 0.715160, 0.072169), color);
|
||||
|
@ -43,6 +49,8 @@ void main()
|
|||
color = clamp(color, 0.0, 1.0);
|
||||
texel = texture2D(texture, gl_TexCoord[0].st);
|
||||
fragColor = color * texel + specular;
|
||||
fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
|
||||
gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
|
||||
//fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
|
||||
//gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
|
||||
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
|
||||
gl_FragColor = fragColor;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
//
|
||||
// Diffuse colors come from the gl_Color, ambient from the material. This is
|
||||
// equivalent to osg::Material::DIFFUSE.
|
||||
#version 120
|
||||
|
||||
#define MODE_OFF 0
|
||||
#define MODE_DIFFUSE 1
|
||||
|
@ -18,13 +19,13 @@
|
|||
// bugs with gl_FrontFacing in the fragment shader.
|
||||
varying vec4 diffuse_term;
|
||||
varying vec3 normal;
|
||||
varying float fogCoord;
|
||||
//varying float fogCoord;
|
||||
|
||||
uniform int colorMode;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
|
||||
//vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
|
||||
gl_Position = ftransform();
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
normal = gl_NormalMatrix * gl_Normal;
|
||||
|
@ -51,5 +52,5 @@ void main()
|
|||
// gl_FrontFacing in the fragment shader.
|
||||
gl_FrontColor.rgb = ambient_term.rgb; gl_FrontColor.a = 1.0;
|
||||
gl_BackColor.rgb = ambient_term.rgb; gl_FrontColor.a = 0.0;
|
||||
fogCoord = abs(ecPosition.z / ecPosition.w);
|
||||
//fogCoord = abs(ecPosition.z / ecPosition.w);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ float shade = 0.8;
|
|||
float cloud_height = 1000.0;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
{
|
||||
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
//gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0);
|
||||
|
|
|
@ -14,7 +14,7 @@ varying vec3 reflVec;
|
|||
|
||||
varying vec4 Diffuse;
|
||||
varying float alpha;
|
||||
varying float fogCoord;
|
||||
//varying float fogCoord;
|
||||
|
||||
uniform samplerCube Environment;
|
||||
uniform sampler2D Rainbow;
|
||||
|
@ -32,6 +32,12 @@ uniform float ambient_correction;
|
|||
uniform float reflect_map;
|
||||
uniform float normalmap_dds;
|
||||
|
||||
////fog "include" /////
|
||||
uniform int fogType;
|
||||
|
||||
vec3 fog_Func(vec3 color, int type);
|
||||
//////////////////////
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec3 halfV;
|
||||
|
@ -72,12 +78,12 @@ void main (void)
|
|||
color = clamp(color, 0.0, 1.0);
|
||||
|
||||
// calculate the fog factor
|
||||
const float LOG2 = 1.442695;
|
||||
float fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
|
||||
if(gl_Fog.density == 1.0)
|
||||
fogFactor=1.0;
|
||||
// const float LOG2 = 1.442695;
|
||||
// float fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
// fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
//
|
||||
// if(gl_Fog.density == 1.0)
|
||||
// fogFactor=1.0;
|
||||
|
||||
vec3 normal = normalize(VNormal);
|
||||
vec3 viewVec = normalize(vViewVec);
|
||||
|
@ -129,5 +135,7 @@ void main (void)
|
|||
|
||||
reflColor = clamp(reflColor, 0.0, 1.0);
|
||||
|
||||
gl_FragColor = mix(gl_Fog.color, reflColor, fogFactor);
|
||||
// gl_FragColor = mix(gl_Fog.color, reflColor, fogFactor);
|
||||
reflColor.rgb = fog_Func(reflColor.rgb, fogType);
|
||||
gl_FragColor = reflColor;
|
||||
}
|
|
@ -19,10 +19,10 @@ uniform mat4 osg_ViewMatrixInverse;
|
|||
attribute vec3 tangent;
|
||||
attribute vec3 binormal;
|
||||
|
||||
////fog "include"////////
|
||||
uniform int fogType;
|
||||
|
||||
void fog_Func(int type);
|
||||
////fog "include"////////
|
||||
// uniform int fogType;
|
||||
//
|
||||
// void fog_Func(int type);
|
||||
/////////////////////////
|
||||
|
||||
void main(void)
|
||||
|
@ -30,8 +30,8 @@ void main(void)
|
|||
rawpos = gl_Vertex.xyz / gl_Vertex.w;
|
||||
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
|
||||
ecPosition.xyz = ecPosition.xyz / ecPosition.w;
|
||||
fogCoord = ecPosition.z;
|
||||
fog_Func(fogType);
|
||||
//fogCoord = ecPosition.z;
|
||||
//fog_Func(fogType);
|
||||
|
||||
vec3 n = normalize(gl_Normal);
|
||||
vec3 t = cross(gl_Normal, vec3(1.0,0.0,0.0));
|
||||
|
|
|
@ -13,7 +13,7 @@ varying vec3 reflVec;
|
|||
|
||||
varying vec4 Diffuse;
|
||||
varying float alpha;
|
||||
varying float fogCoord;
|
||||
//varying float fogCoord;
|
||||
|
||||
uniform samplerCube Environment;
|
||||
uniform sampler2D Rainbow;
|
||||
|
@ -33,6 +33,12 @@ uniform float lightmap_factor;
|
|||
uniform int light_map;
|
||||
uniform int reflect_map;
|
||||
|
||||
////fog "include" /////
|
||||
uniform int fogType;
|
||||
|
||||
vec3 fog_Func(vec3 color, int type);
|
||||
//////////////////////
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec3 n, halfV;
|
||||
|
@ -62,12 +68,12 @@ void main (void)
|
|||
color = clamp(color, 0.0, 1.0);
|
||||
|
||||
// calculate the fog factor
|
||||
const float LOG2 = 1.442695;
|
||||
float fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
|
||||
if(gl_Fog.density == 1.0)
|
||||
fogFactor=1.0;
|
||||
// const float LOG2 = 1.442695;
|
||||
// float fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
// fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
//
|
||||
// if(gl_Fog.density == 1.0)
|
||||
// fogFactor=1.0;
|
||||
|
||||
vec3 normal = normalize(VNormal);
|
||||
vec3 viewVec = normalize(vViewVec);
|
||||
|
@ -127,5 +133,7 @@ void main (void)
|
|||
reflColor.rgb = max(reflColor.rgb, lightmapTexel * gl_FrontMaterial.diffuse.rgb * mixedcolor.rgb);
|
||||
}
|
||||
|
||||
gl_FragColor = mix(gl_Fog.color, reflColor, fogFactor);
|
||||
// gl_FragColor = mix(gl_Fog.color, reflColor, fogFactor);
|
||||
reflColor.rgb = fog_Func(reflColor.rgb, fogType);
|
||||
gl_FragColor = reflColor;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ varying vec3 reflVec;
|
|||
|
||||
varying vec4 Diffuse;
|
||||
varying float alpha;
|
||||
varying float fogCoord;
|
||||
//varying float fogCoord;
|
||||
|
||||
uniform mat4 osg_ViewMatrixInverse;
|
||||
|
||||
|
@ -37,7 +37,7 @@ void main(void)
|
|||
else
|
||||
alpha = gl_Color.a;
|
||||
|
||||
fogCoord = abs(ecPosition.z);
|
||||
//fogCoord = abs(ecPosition.z);
|
||||
|
||||
// Vertex in eye coordinates
|
||||
vec3 vertVec = ecPosition.xyz;
|
||||
|
|
|
@ -13,7 +13,7 @@ varying vec3 reflVec;
|
|||
|
||||
varying vec4 Diffuse;
|
||||
varying float alpha;
|
||||
varying float fogCoord;
|
||||
//varying float fogCoord;
|
||||
|
||||
uniform samplerCube Environment;
|
||||
uniform sampler2D Rainbow;
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
// -*-C++-*-
|
||||
|
||||
#version 120
|
||||
varying vec4 diffuse, constantColor;
|
||||
varying vec3 normal, lightDir, halfVector;
|
||||
varying float fogCoord, alpha;
|
||||
//varying float fogCoord, alpha;
|
||||
varying float alpha;
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
////fog "include" /////
|
||||
uniform int fogType;
|
||||
|
||||
vec3 fog_Func(vec3 color, int type);
|
||||
//////////////////////
|
||||
|
||||
float luminance(vec3 color)
|
||||
{
|
||||
return dot(vec3(0.212671, 0.715160, 0.072169), color);
|
||||
|
@ -51,7 +58,8 @@ void main()
|
|||
fragColor.a = tex_lum * clamp(lum, 0.01, 1.0);
|
||||
}
|
||||
|
||||
fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
|
||||
gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
|
||||
|
||||
// fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
|
||||
// gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
|
||||
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
|
||||
gl_FragColor = fragColor;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ varying vec4 diffuse_term, RawPos;
|
|||
varying vec3 Vnormal, normal;
|
||||
//varying float fogCoord;
|
||||
|
||||
uniform float SnowLevel, Transitions, InverseSlope, RainNorm, CloudCover0, CloudCover1, CloudCover2, CloudCover3, CloudCover4;
|
||||
uniform float SnowLevel, Transitions, InverseSlope, RainNorm;
|
||||
uniform float CloudCover0, CloudCover1, CloudCover2, CloudCover3, CloudCover4;
|
||||
uniform sampler2D BaseTex, SecondTex, ThirdTex, SnowTex;
|
||||
uniform sampler3D NoiseTex;
|
||||
|
||||
|
@ -143,4 +144,4 @@ void main()
|
|||
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
|
||||
//gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
|
||||
gl_FragColor = fragColor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,11 +22,11 @@ varying vec3 normal, Vnormal;
|
|||
//varying float fogCoord;
|
||||
uniform int colorMode;
|
||||
|
||||
////fog "include"////////
|
||||
uniform int fogType;
|
||||
|
||||
void fog_Func(int type);
|
||||
/////////////////////////
|
||||
// ////fog "include"////////
|
||||
// uniform int fogType;
|
||||
//
|
||||
// void fog_Func(int type);
|
||||
// /////////////////////////
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -61,5 +61,5 @@ void main()
|
|||
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);
|
||||
//fog_Func(fogType);
|
||||
}
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
// color - xyz of tree quad origin, replicated 4 times.
|
||||
#version 120
|
||||
//varying float fogCoord;
|
||||
varying vec3 PointPos;
|
||||
// varying vec3 PointPos;
|
||||
//varying vec4 EyePos;
|
||||
////fog "include"////////
|
||||
uniform int fogType;
|
||||
|
||||
void fog_Func(int type);
|
||||
/////////////////////////
|
||||
// ////fog "include"////////
|
||||
// uniform int fogType;
|
||||
//
|
||||
// void fog_Func(int type);
|
||||
// /////////////////////////
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ void main(void)
|
|||
position.xy = vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr)));
|
||||
position = position + gl_Color.xyz;
|
||||
gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0);
|
||||
vec3 ecPosition = vec3(gl_ModelViewMatrix * vec4(position, 1.0));
|
||||
// vec3 ecPosition = vec3(gl_ModelViewMatrix * vec4(position, 1.0));
|
||||
|
||||
float n = dot(normalize(gl_LightSource[0].position.xyz), normalize(-ecPosition));
|
||||
|
||||
|
@ -41,6 +41,6 @@ void main(void)
|
|||
//fogFactor = exp( -gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
|
||||
//fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
// fog_Func(fogType);
|
||||
PointPos = ecPosition;
|
||||
// PointPos = ecPosition;
|
||||
//EyePos = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0);
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ uniform int nmap_enabled;
|
|||
uniform int shader_qual;
|
||||
|
||||
//////Fog Include///////////
|
||||
uniform int fogType;
|
||||
void fog_Func(int type);
|
||||
// uniform int fogType;
|
||||
// void fog_Func(int type);
|
||||
////////////////////////////
|
||||
|
||||
void rotationMatrixPR(in float sinRx, in float cosRx, in float sinRy, in float cosRy, out mat4 rotmat)
|
||||
|
@ -47,7 +47,7 @@ void main(void)
|
|||
{
|
||||
rawpos = gl_Vertex.xyz;
|
||||
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
|
||||
fog_Func(fogType);
|
||||
//fog_Func(fogType);
|
||||
|
||||
VNormal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
if (nmap_enabled > 0 && shader_qual > 2){
|
||||
|
|
|
@ -13,9 +13,9 @@ varying vec4 constantColor;
|
|||
attribute vec3 tangent, binormal;
|
||||
|
||||
////fog "include"////////
|
||||
uniform int fogType;
|
||||
|
||||
void fog_Func(int type);
|
||||
// uniform int fogType;
|
||||
//
|
||||
// void fog_Func(int type);
|
||||
/////////////////////////
|
||||
|
||||
void main(void)
|
||||
|
@ -28,8 +28,8 @@ void main(void)
|
|||
VBinormal = gl_NormalMatrix * binormal;
|
||||
gl_FrontColor = gl_Color;
|
||||
constantColor = gl_FrontMaterial.emission
|
||||
+ gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
|
||||
+ gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
|
||||
gl_Position = ftransform();
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
fog_Func(fogType);
|
||||
// fog_Func(fogType);
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@ uniform float osg_SimulationTime;
|
|||
uniform float WindE, WindN, spd, hdg;
|
||||
|
||||
////fog "include"////////
|
||||
uniform int fogType;
|
||||
|
||||
void fog_Func(int type);
|
||||
// uniform int fogType;
|
||||
//
|
||||
// void fog_Func(int type);
|
||||
/////////////////////////
|
||||
|
||||
|
||||
|
@ -72,6 +72,6 @@ void main(void)
|
|||
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
gl_Position = ftransform();
|
||||
|
||||
fog_Func(fogType);
|
||||
|
||||
// fog_Func(fogType);
|
||||
}
|
|
@ -15,11 +15,17 @@ uniform float CloudCover0, CloudCover1, CloudCover2, CloudCover3, CloudCover4;
|
|||
varying vec4 waterTex1; //moving texcoords
|
||||
varying vec4 waterTex2; //moving texcoords
|
||||
varying vec4 waterTex4; //viewts
|
||||
varying vec4 ecPosition;
|
||||
//varying vec4 ecPosition;
|
||||
varying vec3 viewerdir;
|
||||
varying vec3 lightdir;
|
||||
varying vec3 normal;
|
||||
|
||||
////fog "include" /////
|
||||
uniform int fogType;
|
||||
|
||||
vec3 fog_Func(vec3 color, int type);
|
||||
//////////////////////
|
||||
|
||||
void main(void)
|
||||
{
|
||||
const vec4 sca = vec4(0.005, 0.005, 0.005, 0.005);
|
||||
|
@ -96,19 +102,19 @@ void main(void)
|
|||
|
||||
//calculate fresnel
|
||||
vec4 invfres = vec4( dot(vNorm, viewt) );
|
||||
vec4 fres = vec4(1.0) + invfres;
|
||||
vec4 fres = vec4(1.0) + invfres;
|
||||
refl *= fres;
|
||||
|
||||
//calculate the fog factor
|
||||
float fogFactor;
|
||||
float fogCoord = ecPosition.z;
|
||||
const float LOG2 = 1.442695;
|
||||
fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
// float fogFactor;
|
||||
// float fogCoord = ecPosition.z;
|
||||
// const float LOG2 = 1.442695;
|
||||
// fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
//
|
||||
// if(gl_Fog.density == 1.0)
|
||||
// fogFactor=1.0;
|
||||
|
||||
if(gl_Fog.density == 1.0)
|
||||
fogFactor=1.0;
|
||||
|
||||
//calculate final colour
|
||||
//calculate final colour
|
||||
vec4 ambient_light = gl_LightSource[0].diffuse;
|
||||
vec4 finalColor;
|
||||
|
||||
|
@ -122,5 +128,7 @@ void main(void)
|
|||
|
||||
finalColor *= ambient_light;
|
||||
|
||||
gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor);
|
||||
// gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor);
|
||||
finalColor.rgb = fog_Func(finalColor.rgb, fogType);
|
||||
gl_FragColor = finalColor;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,11 @@ uniform sampler3D NoiseTex;
|
|||
uniform float osg_SimulationTime;
|
||||
|
||||
//const float scale = 1.0;
|
||||
////fog "include" /////
|
||||
uniform int fogType;
|
||||
|
||||
vec3 fog_Func(vec3 color, int type);
|
||||
//////////////////////
|
||||
|
||||
void main (void)
|
||||
{
|
||||
|
@ -19,18 +24,18 @@ void main (void)
|
|||
vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.00423+vec3(0.0,0.0,osg_SimulationTime*0.035217));
|
||||
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.001223417+(0.0,0.0,osg_SimulationTime*-0.0212));
|
||||
|
||||
float fogFactor;
|
||||
if (gl_Fog.density == 1.0)
|
||||
{
|
||||
fogFactor=1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
float fogCoord = ecPosition.z;
|
||||
const float LOG2 = 1.442695;
|
||||
fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
}
|
||||
// float fogFactor;
|
||||
// if (gl_Fog.density == 1.0)
|
||||
// {
|
||||
// fogFactor=1.0;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// float fogCoord = ecPosition.z;
|
||||
// const float LOG2 = 1.442695;
|
||||
// fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
// fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
// }
|
||||
|
||||
float a=1.0;
|
||||
float n=0.00;
|
||||
|
@ -64,7 +69,7 @@ void main (void)
|
|||
c1 = asin(vec4(smoothstep(0.0, 2.2, n), smoothstep(-0.1, 2.10, n), smoothstep(-0.2, 2.0, n), 1.0));
|
||||
|
||||
vec3 Eye = normalize(-ecPosition.xyz);
|
||||
vec3 Reflected = normalize(reflect(-normalize(lightVec), normalize(VNormal+vec3(0.0,0.0,na*0.10-0.24))));
|
||||
vec3 Reflected = normalize(reflect(-normalize(lightVec), normalize(VNormal+vec3(0.0,0.0,na*0.10-0.24))));
|
||||
|
||||
vec3 bump = normalize(VNormal+vec3(0.0, 0.0, na)-0.9);
|
||||
vec3 bumped = max(normalize(refract(lightVec, normalize(bump), 0.16)), 0.0);
|
||||
|
@ -82,5 +87,7 @@ void main (void)
|
|||
c1 += gl_LightSource[0].specular * eyeFact * 4.0*bumpFact;
|
||||
|
||||
vec4 finalColor = c1;
|
||||
gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor);
|
||||
// gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor);
|
||||
finalColor.rgb = fog_Func(finalColor.rgb, fogType);
|
||||
gl_FragColor = finalColor;
|
||||
}
|
||||
|
|
|
@ -181,13 +181,13 @@ void main(void)
|
|||
refl *= fres;
|
||||
|
||||
//calculate the fog factor
|
||||
float fogFactor;
|
||||
float fogCoord = ecPosition.z;
|
||||
const float LOG2 = 1.442695;
|
||||
fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
|
||||
if(gl_Fog.density == 1.0)
|
||||
fogFactor=1.0;
|
||||
// float fogFactor;
|
||||
// float fogCoord = ecPosition.z;
|
||||
// const float LOG2 = 1.442695;
|
||||
// fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
//
|
||||
// if(gl_Fog.density == 1.0)
|
||||
// fogFactor=1.0;
|
||||
|
||||
//calculate final colour
|
||||
vec4 ambient_light = gl_LightSource[0].diffuse;
|
||||
|
@ -203,7 +203,7 @@ void main(void)
|
|||
//float waveSlope = mix(N0.g, N1.g, 0.25);
|
||||
|
||||
vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 25.0);
|
||||
float waveSlope = N.g;
|
||||
float waveSlope = N.g;
|
||||
|
||||
if (windEffect >= 8.0)
|
||||
if (waveSlope >= foamSlope){
|
||||
|
|
|
@ -20,9 +20,9 @@ uniform float osg_SimulationTime;
|
|||
uniform float WindE, WindN;
|
||||
|
||||
////fog "include"////////
|
||||
uniform int fogType;
|
||||
|
||||
void fog_Func(int type);
|
||||
// uniform int fogType;
|
||||
//
|
||||
// void fog_Func(int type);
|
||||
/////////////////////////
|
||||
|
||||
/////// functions /////////
|
||||
|
@ -66,6 +66,6 @@ void main(void)
|
|||
rotationmatrix(Angle, RotationMatrix);
|
||||
waterTex2 = gl_MultiTexCoord0 * RotationMatrix - t2 * windFactor;
|
||||
|
||||
fog_Func(fogType);
|
||||
// fog_Func(fogType);
|
||||
gl_Position = ftransform();
|
||||
}
|
|
@ -24,7 +24,7 @@ uniform int Status;
|
|||
varying vec4 waterTex1; //moving texcoords
|
||||
varying vec4 waterTex2; //moving texcoords
|
||||
varying vec4 waterTex4; //viewts
|
||||
varying vec4 ecPosition;
|
||||
//varying vec4 ecPosition;
|
||||
varying vec3 viewerdir;
|
||||
varying vec3 lightdir;
|
||||
varying vec3 normal;
|
||||
|
@ -263,7 +263,7 @@ void main(void)
|
|||
|
||||
if(cover >= 1.5){
|
||||
refl= normalize(refTex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
refl = normalize(refTexGrey);
|
||||
|
@ -291,7 +291,7 @@ void main(void)
|
|||
N0 *= windEffect_low;
|
||||
N1 *= windEffect_low;
|
||||
|
||||
N0.r += (ddx + ddx1 + ddx2 + ddx3);
|
||||
N0.r += (ddx + ddx1 + ddx2 + ddx3);
|
||||
N0.g += (ddy + ddy1 + ddy2 + ddy3);
|
||||
|
||||
vec3 N = normalize(mix(Normal + N0, Normal + N1, mixFactor) * waveRoughness);
|
||||
|
@ -335,7 +335,7 @@ void main(void)
|
|||
//float waveSlope = mix(N0.g, N1.g, 0.25);
|
||||
|
||||
vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 25.0);
|
||||
float waveSlope = N.g;
|
||||
float waveSlope = N.g;
|
||||
|
||||
if (windEffect >= 8.0)
|
||||
if (waveSlope >= foamSlope){
|
||||
|
|
Loading…
Reference in a new issue