Clean up some
This commit is contained in:
1 parent
1af829bf49
commit
f197dfcf02
10 files changed
+49
-352
No files matched your search
@@ -5,11 +5,8 @@ varying float viewZ;
|
||||
varying vec3 pos;
|
||||
|
||||
uniform sampler2D Texture;
|
||||
uniform float uDistanceToPlanetSurface;
|
||||
uniform float uCurrentZFar;
|
||||
uniform float uDistanceToPlanetSurface;
|
||||
|
||||
// Константы для тумана:
|
||||
//const vec4 FOG_COLOR = vec4(0.0, 0.3, 0.3, 1.0); // Синий туман
|
||||
const vec4 FOG_COLOR = vec4(0.0, 0.5, 1.0, 1.0); // Синий туман
|
||||
|
||||
varying vec3 worldPosition;
|
||||
@@ -23,6 +20,8 @@ void main()
|
||||
vec3 finalColor = textureColor.rgb;
|
||||
|
||||
float realDist = distance(worldPosition, uViewPos);
|
||||
|
||||
float alphaFactor = clamp((2000 - realDist) / 500.0, 0.0, 1.0);
|
||||
|
||||
float fogFactor;
|
||||
if (uDistanceToPlanetSurface > 1000)
|
||||
@@ -35,7 +34,7 @@ void main()
|
||||
|
||||
fogFactor = clamp((realDist - 2400) / (300.0*(1 + 10*t)), 0.0, 1.0);
|
||||
|
||||
gl_FragColor = mix(vec4(finalColor.rgb, 1.0), FOG_COLOR, fogFactor*(1.0 - t));
|
||||
gl_FragColor = mix(vec4(finalColor.rgb, alphaFactor), FOG_COLOR, fogFactor*(1.0 - t));
|
||||
}
|
||||
else if (uDistanceToPlanetSurface > 40)
|
||||
{
|
||||
@@ -48,13 +47,13 @@ void main()
|
||||
|
||||
float fogFactor2 = clamp((realDist - 1000) / 800.0, 0.0, 1.0);
|
||||
|
||||
gl_FragColor = mix(vec4(finalColor.rgb, 1.0), FOG_COLOR, max(fogFactor, fogFactor2*(1.0 - t)));
|
||||
gl_FragColor = mix(vec4(finalColor.rgb, alphaFactor), FOG_COLOR, max(fogFactor, fogFactor2*(1.0 - t)));
|
||||
}
|
||||
else
|
||||
{
|
||||
fogFactor = clamp((realDist - 1000) / (800.0), 0.0, 1.0);
|
||||
|
||||
gl_FragColor = mix(vec4(finalColor.rgb, 1.0), FOG_COLOR, fogFactor);
|
||||
gl_FragColor = mix(vec4(finalColor.rgb, alphaFactor), FOG_COLOR, fogFactor);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user