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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
@ -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,6 +11,12 @@ varying vec3 VBinormal;
|
|||
uniform sampler2D tex_color;
|
||||
uniform sampler2D tex_normal;
|
||||
|
||||
////fog "include" /////
|
||||
uniform int fogType;
|
||||
|
||||
vec3 fog_Func(vec3 color, int type);
|
||||
//////////////////////
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec4 ns = texture2D(tex_normal, gl_TexCoord[0].st);
|
||||
|
@ -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,6 +18,12 @@ 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)
|
||||
{
|
||||
|
||||
|
@ -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 /////////
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -31,5 +31,5 @@ void main(void)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
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);
|
||||
|
@ -60,6 +67,8 @@ void main()
|
|||
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;
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -20,9 +20,9 @@ attribute vec3 tangent;
|
|||
attribute vec3 binormal;
|
||||
|
||||
////fog "include"////////
|
||||
uniform int fogType;
|
||||
|
||||
void fog_Func(int type);
|
||||
// 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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
@ -31,5 +31,5 @@ void main(void)
|
|||
+ gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
|
||||
gl_Position = ftransform();
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
fog_Func(fogType);
|
||||
// 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);
|
||||
/////////////////////////
|
||||
|
||||
|
||||
|
@ -73,5 +73,5 @@ 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);
|
||||
|
@ -100,13 +106,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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue