mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 11:24:00 +00:00
fix(globe): sharpen sky mask past depth 0.99999, not >= 1
RGBA8 depth packing rounds near the far plane.
This commit is contained in:
1 parent
5188e8869d
commit
6dad3894bd
1 file changed
+3
-1
@@ -34,6 +34,7 @@ const fragmentShader = /* glsl */ `
|
|||||||
uniform float amount;
|
uniform float amount;
|
||||||
uniform sampler2D tSceneDepth;
|
uniform sampler2D tSceneDepth;
|
||||||
uniform bool uSkipSky;
|
uniform bool uSkipSky;
|
||||||
|
const float SKY_DEPTH = 0.99999;
|
||||||
|
|
||||||
vec3 encodeGamma(vec3 color) {
|
vec3 encodeGamma(vec3 color) {
|
||||||
return pow(max(color, vec3(0.0)), vec3(1.0 / 2.2));
|
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) {
|
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;
|
outputColor = inputColor;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user