Clean up some

This commit is contained in:
Vladislav Khorev committed 2025-12-29 20:40:13 +03:00
1 parent 1af829bf49
commit f197dfcf02
10 files changed
+49 -352

No files matched your search

-1
View File
@@ -6,7 +6,6 @@ attribute vec3 vBinormal;
varying vec2 TexCoord;
varying vec3 vViewDirTangent;
//varying float realDist;
varying vec3 worldPosition;
uniform mat4 ProjectionModelViewMatrix;
+8 -28
View File
@@ -2,10 +2,10 @@ varying vec2 TexCoord;
varying vec3 vViewDirTangent;
uniform sampler2D Texture;
uniform sampler2D BakedTexture;
uniform float uHeightScale;
uniform float uDistanceToPlanetSurface;
uniform float uCurrentZFar;
//varying float realDist;
varying vec3 worldPosition;
uniform vec3 uViewPos;
@@ -25,8 +25,14 @@ void main() {
vec2 finalTexCoord = TexCoord + p;
float realDist = distance(worldPosition, uViewPos);
float textureMixFactor = clamp((2000 - realDist) / 500.0, 0.0, 1.0);
vec4 bakedTextureColor = texture2D(BakedTexture, finalTexCoord);
vec4 textureColor = texture2D(Texture, TexCoord);
vec4 finalColor = texture2D(Texture, finalTexCoord);
vec4 finalColor = textureMixFactor*textureColor + (1 - textureMixFactor) * bakedTextureColor;
float fogFactor;
if (uDistanceToPlanetSurface > 1000)
@@ -61,30 +67,4 @@ void main() {
gl_FragColor = mix(vec4(finalColor.rgb, 1.0), FOG_COLOR, fogFactor);
}
/*
if (realDist < 500)
{
gl_FragColor = vec4(0.5, 0.0, 0.0, 1.0);
}
else if (realDist < 1000)
{
gl_FragColor = vec4(1.0, 0.2, 0.0, 1.0);
}
else if (realDist < 1800)
{
gl_FragColor = vec4(1.0, 0.7, 0.0, 1.0);
}
else if (realDist < 2400)
{
gl_FragColor = vec4(1.0, 0.7, 0.5, 1.0);
}
else if (realDist < 2700)
{
gl_FragColor = vec4(1.0, 0.7, 1.0, 1.0);
}
else
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}*/
}
+6 -7
View File
@@ -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);
}
}