fix(globe): sharpen sky mask past depth 0.99999, not >= 1

RGBA8 depth packing rounds near the far plane.
This commit is contained in:
German Khokhlov committed 2026-10-16 15:06:15 +04:00
1 parent 5188e8869d
commit 6dad3894bd
1 file changed
+3 -1
+3 -1
View File
@@ -34,6 +34,7 @@ const fragmentShader = /* glsl */ `
uniform float amount;
uniform sampler2D tSceneDepth;
uniform bool uSkipSky;
const float SKY_DEPTH = 0.99999;
vec3 encodeGamma(vec3 color) {
return pow(max(color, vec3(0.0)), vec3(1.0 / 2.2));
@@ -44,7 +45,8 @@ vec3 sampleGamma(vec2 uv) {
}
void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
if (uSkipSky && unpackRGBAToDepth(texture2D(tSceneDepth, uv)) >= 1.0) {
// The far plane, with a margin: packing to RGBA8 rounds near 1.0.
if (uSkipSky && unpackRGBAToDepth(texture2D(tSceneDepth, uv)) > SKY_DEPTH) {
outputColor = inputColor;
return;
}