Add missing include_fog.[vert/frag] to the forest, glacier, and herbtundra effects.
adapt forest.[vert/frag] shader to the common fog. Thanks Stuart for reporting it. Signed-off-by: Emilian Huminiuc <emilianh@gmail.com>
This commit is contained in:
parent
6261badedb
commit
eb6672f313
5 changed files with 249 additions and 37 deletions
|
@ -34,13 +34,33 @@
|
||||||
<depth-factor type="float">0.04</depth-factor>
|
<depth-factor type="float">0.04</depth-factor>
|
||||||
<canopy-height type="float">15.0</canopy-height>
|
<canopy-height type="float">15.0</canopy-height>
|
||||||
<quality-level><use>/sim/rendering/shaders/transition</use></quality-level>
|
<quality-level><use>/sim/rendering/shaders/transition</use></quality-level>
|
||||||
|
|
||||||
<!-- sets the season color -->
|
<!-- sets the season color -->
|
||||||
<season-red type="float">0.12</season-red>
|
<season-red type="float">0.12</season-red>
|
||||||
<season-green type="float">0.86</season-green>
|
<season-green type="float">0.86</season-green>
|
||||||
<season-blue type="float">0.22</season-blue>
|
<season-blue type="float">0.22</season-blue>
|
||||||
<!-- end season color -->
|
<!-- end season color -->
|
||||||
|
<!--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>
|
</parameters>
|
||||||
<generate>
|
<generate>
|
||||||
<tangent type="int">6</tangent>
|
<tangent type="int">6</tangent>
|
||||||
|
@ -128,8 +148,10 @@
|
||||||
</internal-format>
|
</internal-format>
|
||||||
</texture-unit>
|
</texture-unit>
|
||||||
<program>
|
<program>
|
||||||
<vertex-shader>Shaders/forest.vert</vertex-shader>
|
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||||
<fragment-shader>Shaders/forest.frag</fragment-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>
|
||||||
<attribute>
|
<attribute>
|
||||||
<name>tangent</name>
|
<name>tangent</name>
|
||||||
<index>6</index>
|
<index>6</index>
|
||||||
|
@ -192,13 +214,57 @@
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>blue</name>
|
<name>blue</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value><use>season-blue</use></value>
|
<value><use>season-blue</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>alpha</name>
|
<name>alpha</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value>0.0</value>
|
<value>0.0</value>
|
||||||
</uniform>
|
</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>
|
</pass>
|
||||||
</technique>
|
</technique>
|
||||||
</PropertyList>
|
</PropertyList>
|
||||||
|
|
|
@ -34,13 +34,34 @@
|
||||||
<depth-factor type="float">0.01</depth-factor>
|
<depth-factor type="float">0.01</depth-factor>
|
||||||
<canopy-height type="float">15.0</canopy-height>
|
<canopy-height type="float">15.0</canopy-height>
|
||||||
<quality-level><use>/sim/rendering/shaders/transition</use></quality-level>
|
<quality-level><use>/sim/rendering/shaders/transition</use></quality-level>
|
||||||
|
|
||||||
<!-- sets the season color -->
|
<!-- sets the season color -->
|
||||||
<season-red type="float">0.12</season-red>
|
<season-red type="float">0.12</season-red>
|
||||||
<season-green type="float">0.86</season-green>
|
<season-green type="float">0.86</season-green>
|
||||||
<season-blue type="float">0.22</season-blue>
|
<season-blue type="float">0.22</season-blue>
|
||||||
<!-- end season color -->
|
<!-- end season color -->
|
||||||
|
|
||||||
|
<!--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>
|
</parameters>
|
||||||
<generate>
|
<generate>
|
||||||
<tangent type="int">6</tangent>
|
<tangent type="int">6</tangent>
|
||||||
|
@ -128,8 +149,10 @@
|
||||||
</internal-format>
|
</internal-format>
|
||||||
</texture-unit>
|
</texture-unit>
|
||||||
<program>
|
<program>
|
||||||
<vertex-shader>Shaders/forest.vert</vertex-shader>
|
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||||
<fragment-shader>Shaders/forest.frag</fragment-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>
|
||||||
<attribute>
|
<attribute>
|
||||||
<name>tangent</name>
|
<name>tangent</name>
|
||||||
<index>6</index>
|
<index>6</index>
|
||||||
|
@ -192,13 +215,57 @@
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>blue</name>
|
<name>blue</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value><use>season-blue</use></value>
|
<value><use>season-blue</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>alpha</name>
|
<name>alpha</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value>0.0</value>
|
<value>0.0</value>
|
||||||
</uniform>
|
</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>
|
</pass>
|
||||||
</technique>
|
</technique>
|
||||||
</PropertyList>
|
</PropertyList>
|
||||||
|
|
|
@ -33,13 +33,34 @@
|
||||||
<snow-level><use>/environment/snow-level-m</use></snow-level>
|
<snow-level><use>/environment/snow-level-m</use></snow-level>
|
||||||
<depth-factor type="float">0.01</depth-factor>
|
<depth-factor type="float">0.01</depth-factor>
|
||||||
<canopy-height type="float">15.0</canopy-height>
|
<canopy-height type="float">15.0</canopy-height>
|
||||||
|
|
||||||
<!-- sets the season color -->
|
<!-- sets the season color -->
|
||||||
<season-red type="float">0.12</season-red>
|
<season-red type="float">0.12</season-red>
|
||||||
<season-green type="float">0.86</season-green>
|
<season-green type="float">0.86</season-green>
|
||||||
<season-blue type="float">0.22</season-blue>
|
<season-blue type="float">0.22</season-blue>
|
||||||
<!-- end season color -->
|
<!-- end season color -->
|
||||||
|
|
||||||
|
<!--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 -->
|
||||||
|
|
||||||
<quality-level><use>/sim/rendering/shaders/transition</use></quality-level>
|
<quality-level><use>/sim/rendering/shaders/transition</use></quality-level>
|
||||||
</parameters>
|
</parameters>
|
||||||
<generate>
|
<generate>
|
||||||
|
@ -128,8 +149,10 @@
|
||||||
</internal-format>
|
</internal-format>
|
||||||
</texture-unit>
|
</texture-unit>
|
||||||
<program>
|
<program>
|
||||||
<vertex-shader>Shaders/forest.vert</vertex-shader>
|
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||||
<fragment-shader>Shaders/forest.frag</fragment-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>
|
||||||
<attribute>
|
<attribute>
|
||||||
<name>tangent</name>
|
<name>tangent</name>
|
||||||
<index>6</index>
|
<index>6</index>
|
||||||
|
@ -192,13 +215,57 @@
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>blue</name>
|
<name>blue</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value><use>season-blue</use></value>
|
<value><use>season-blue</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>alpha</name>
|
<name>alpha</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value>0.0</value>
|
<value>0.0</value>
|
||||||
</uniform>
|
</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>
|
</pass>
|
||||||
</technique>
|
</technique>
|
||||||
</PropertyList>
|
</PropertyList>
|
||||||
|
|
|
@ -22,6 +22,12 @@ uniform float snowlevel; // From /sim/rendering/snow-level-m
|
||||||
const float scale = 1.0;
|
const float scale = 1.0;
|
||||||
int linear_search_steps = 10;
|
int linear_search_steps = 10;
|
||||||
|
|
||||||
|
////fog "include" /////
|
||||||
|
uniform int fogType;
|
||||||
|
|
||||||
|
vec3 fog_Func(vec3 color, int type);
|
||||||
|
//////////////////////
|
||||||
|
|
||||||
float ray_intersect(sampler2D reliefMap, vec2 dp, vec2 ds)
|
float ray_intersect(sampler2D reliefMap, vec2 dp, vec2 ds)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -89,13 +95,13 @@ void main (void)
|
||||||
|
|
||||||
vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000344);
|
vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000344);
|
||||||
vec4 basecolor2 = texture2D(SampleTex2, rawpos.xy*0.000144);
|
vec4 basecolor2 = texture2D(SampleTex2, rawpos.xy*0.000144);
|
||||||
|
|
||||||
basecolor = texture1D(ColorsTex, basecolor.r+0.0);
|
basecolor = texture1D(ColorsTex, basecolor.r+0.0);
|
||||||
|
|
||||||
vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale);
|
vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale);
|
||||||
|
|
||||||
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale);
|
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale);
|
||||||
|
|
||||||
float vegetationlevel = (rawpos.z)+nvL[2]*3000.0;
|
float vegetationlevel = (rawpos.z)+nvL[2]*3000.0;
|
||||||
|
|
||||||
const float LOG2 = 1.442695;
|
const float LOG2 = 1.442695;
|
||||||
|
@ -113,20 +119,20 @@ void main (void)
|
||||||
|
|
||||||
n += noisevec[2]*0.8;
|
n += noisevec[2]*0.8;
|
||||||
n += noisevec[3]*2.1;
|
n += noisevec[3]*2.1;
|
||||||
|
|
||||||
//very low n/biasFactor mix, to keep forest color
|
//very low n/biasFactor mix, to keep forest color
|
||||||
n = mix(0.05, n, biasFactor);
|
n = mix(0.05, n, biasFactor);
|
||||||
|
|
||||||
vec4 c1;
|
vec4 c1;
|
||||||
c1 = basecolor * vec4(smoothstep(-1.3, 0.5, n), smoothstep(-1.3, 0.5, n), smoothstep(-2.0, 0.9, n), 0.0);
|
c1 = basecolor * vec4(smoothstep(-1.3, 0.5, n), smoothstep(-1.3, 0.5, n), smoothstep(-2.0, 0.9, n), 0.0);
|
||||||
|
|
||||||
vec4 c2;
|
vec4 c2;
|
||||||
c2 = basecolor2 * vec4(smoothstep(-1.3, 0.5, n), smoothstep(-1.3, 0.5, n), smoothstep(-2.0, 0.9, n), 0.0);
|
c2 = basecolor2 * vec4(smoothstep(-1.3, 0.5, n), smoothstep(-1.3, 0.5, n), smoothstep(-2.0, 0.9, n), 0.0);
|
||||||
|
|
||||||
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
|
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
|
||||||
vec3 l = gl_LightSource[0].position.xyz;
|
vec3 l = gl_LightSource[0].position.xyz;
|
||||||
vec3 diffuse;
|
vec3 diffuse;
|
||||||
|
|
||||||
//draw floor where !steep, and another blurb for smoothing transitions
|
//draw floor where !steep, and another blurb for smoothing transitions
|
||||||
vec4 c3, c4, c5, c3a, c4a, c5a;
|
vec4 c3, c4, c5, c3a, c4a, c5a;
|
||||||
float subred = 1.0 - red; float subgreen = 1.0 - green; float subblue = 1.0 - blue;
|
float subred = 1.0 - red; float subgreen = 1.0 - green; float subblue = 1.0 - blue;
|
||||||
|
@ -135,39 +141,39 @@ void main (void)
|
||||||
c4a = mix(vec4(n-subred+0.12, n-subgreen-0.52, -n-subblue, 0.3), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.32));
|
c4a = mix(vec4(n-subred+0.12, n-subgreen-0.52, -n-subblue, 0.3), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.32));
|
||||||
c5 = mix(c3, c4, 1.0);
|
c5 = mix(c3, c4, 1.0);
|
||||||
c5a = mix(c3, c4a, 1.0);
|
c5a = mix(c3, c4a, 1.0);
|
||||||
|
|
||||||
|
|
||||||
if (vegetationlevel <= 2200.0) {
|
if (vegetationlevel <= 2200.0) {
|
||||||
c1 = mix(c2, c5, clamp(0.65, n*0.1, 0.5));
|
c1 = mix(c2, c5, clamp(0.65, n*0.1, 0.5));
|
||||||
diffuse = gl_Color.rgb * max(0.7, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
|
diffuse = gl_Color.rgb * max(0.7, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vegetationlevel > 2200.0 && vegetationlevel < 2300.0) {
|
if (vegetationlevel > 2200.0 && vegetationlevel < 2300.0) {
|
||||||
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.35));
|
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.35));
|
||||||
diffuse = gl_Color.rgb * max(0.7, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
|
diffuse = gl_Color.rgb * max(0.7, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vegetationlevel >= 2300.0 && vegetationlevel < 2480.0) {
|
if (vegetationlevel >= 2300.0 && vegetationlevel < 2480.0) {
|
||||||
c1 = mix(c2, c5a, clamp(0.65, n*0.5, 0.30));
|
c1 = mix(c2, c5a, clamp(0.65, n*0.5, 0.30));
|
||||||
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
|
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vegetationlevel >= 2480.0 && vegetationlevel < 2530.0) {
|
if (vegetationlevel >= 2480.0 && vegetationlevel < 2530.0) {
|
||||||
c1 = mix(c2, c5a, clamp(0.65, n*0.5, 0.20));
|
c1 = mix(c2, c5a, clamp(0.65, n*0.5, 0.20));
|
||||||
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
|
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vegetationlevel >= 2530.0 && vegetationlevel < 2670.0) {
|
if (vegetationlevel >= 2530.0 && vegetationlevel < 2670.0) {
|
||||||
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.10));
|
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.10));
|
||||||
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
|
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vegetationlevel >= 2670.0) {
|
if (vegetationlevel >= 2670.0) {
|
||||||
c1 = mix(c2, c5, clamp(0.0, n*0.1, 0.4));
|
c1 = mix(c2, c5, clamp(0.0, n*0.1, 0.4));
|
||||||
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
|
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//adding snow and permanent snow/glacier
|
//adding snow and permanent snow/glacier
|
||||||
if (vegetationlevel > snowlevel || vegetationlevel > 3100.0) {
|
if (vegetationlevel > snowlevel || vegetationlevel > 3100.0) {
|
||||||
c3 = mix(vec4(n+1.0, n+1.0, n+1.0, 0.0), c1, smoothstep(0.990, 0.965, abs(normalize(Normal).z)+nvL[2]*1.3));
|
c3 = mix(vec4(n+1.0, n+1.0, n+1.0, 0.0), c1, smoothstep(0.990, 0.965, abs(normalize(Normal).z)+nvL[2]*1.3));
|
||||||
|
@ -182,8 +188,6 @@ void main (void)
|
||||||
c1 *= ambient_light;
|
c1 *= ambient_light;
|
||||||
vec4 finalColor = c1;
|
vec4 finalColor = c1;
|
||||||
|
|
||||||
if(gl_Fog.density == 1.0)
|
finalColor.rgb = fog_Func(finalColor.rgb, fogType);
|
||||||
fogFactor=1.0;
|
gl_FragColor = finalColor;
|
||||||
|
|
||||||
gl_FragColor = mix(gl_Fog.color,finalColor, fogFactor);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#version 120
|
||||||
varying vec4 rawpos;
|
varying vec4 rawpos;
|
||||||
varying vec4 ecPosition;
|
varying vec4 ecPosition;
|
||||||
varying vec3 VNormal;
|
varying vec3 VNormal;
|
||||||
|
@ -9,6 +10,12 @@ varying vec4 constantColor;
|
||||||
attribute vec3 tangent;
|
attribute vec3 tangent;
|
||||||
attribute vec3 binormal;
|
attribute vec3 binormal;
|
||||||
|
|
||||||
|
////fog "include"////////
|
||||||
|
uniform int fogType;
|
||||||
|
|
||||||
|
void fog_Func(int type);
|
||||||
|
/////////////////////////
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
rawpos = gl_Vertex;
|
rawpos = gl_Vertex;
|
||||||
|
@ -20,7 +27,8 @@ void main(void)
|
||||||
|
|
||||||
gl_FrontColor = gl_Color;
|
gl_FrontColor = gl_Color;
|
||||||
constantColor = gl_FrontMaterial.emission
|
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_Position = ftransform();
|
||||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||||
|
fog_Func(fogType);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue