Finally somehow planet is done

This commit is contained in:
Vladislav Khorev committed 2025-12-31 23:02:13 +03:00
1 parent 592e008914
commit 2b40c13c9d
9 files changed
+315 -330

No files matched your search

+7
View File
@@ -32,6 +32,11 @@ void main() {
vec4 bakedTextureColor = texture2D(BakedTexture, finalTexCoord);
vec4 textureColor = texture2D(Texture, TexCoord);
if (bakedTextureColor.x < 0.01 && bakedTextureColor.y < 0.01 && bakedTextureColor.y < 0.01)
{
textureMixFactor = 1.0;
}
vec4 finalColor = textureMixFactor*textureColor + (1 - textureMixFactor) * bakedTextureColor;
float fogFactor;
@@ -65,6 +70,8 @@ void main() {
fogFactor = clamp((realDist - 1000) / (800.0), 0.0, 1.0);
gl_FragColor = mix(vec4(finalColor.rgb, 1.0), FOG_COLOR, fogFactor);
}
//gl_FragColor = vec4(finalColor.rgb, 1.0);
}
-9
View File
@@ -4,8 +4,6 @@ attribute vec3 vPosition;
attribute vec2 vTexCoord;
varying vec2 TexCoord;
varying float viewZ;
varying vec3 pos;
varying vec3 worldPosition;
@@ -17,13 +15,6 @@ void main()
// Преобразование позиции в пространство вида (View Space)
vec4 viewPosition = ModelViewMatrix * vec4(vPosition.xyz, 1.0);
// Сохраняем отрицательную Z-координату. В OpenGL Z-координата (глубина)
// в пространстве вида обычно отрицательна, но для расчета тумана
// удобнее использовать положительное значение.
viewZ = -viewPosition.z;
pos = vPosition.xyz;
gl_Position = ProjectionModelViewMatrix * vec4(vPosition.xyz, 1.0);
TexCoord = vTexCoord;
+1 -3
View File
@@ -1,8 +1,6 @@
// ---Фрагментный шейдер (Fragment Shader)
varying vec2 TexCoord;
varying float viewZ;
varying vec3 pos;
uniform sampler2D Texture;
uniform float uDistanceToPlanetSurface;
@@ -55,5 +53,5 @@ void main()
gl_FragColor = mix(vec4(finalColor.rgb, alphaFactor), FOG_COLOR, fogFactor);
}
//gl_FragColor = vec4(finalColor.rgb, 1.0);
}