Support logarithmic depth buffer (#199)

* Support `logarithmicDepthBuffer`

* Use `#include <logdepthbuf_pars_vertex>`

* use includes everywhere if possible or reasonable
This commit is contained in:
Philipp Mildenberger
2025-10-23 19:15:00 +02:00
committed by GitHub
parent 589b6bcc00
commit 018a3ed422
2 changed files with 10 additions and 0 deletions
+2
View File
@@ -3,6 +3,7 @@ precision highp float;
precision highp int;
#include <splatDefines>
#include <logdepthbuf_pars_fragment>
uniform float near;
uniform float far;
@@ -93,4 +94,5 @@ void main() {
fragColor = rgba;
#endif
}
#include <logdepthbuf_fragment>
}
+8
View File
@@ -4,6 +4,7 @@ precision highp int;
precision highp usampler2DArray;
#include <splatDefines>
#include <logdepthbuf_pars_vertex>
attribute uint splatIndex;
@@ -35,6 +36,12 @@ uniform float focalAdjustment;
uniform usampler2DArray packedSplats;
uniform vec4 rgbMinMaxLnScaleMinMax;
#ifdef USE_LOGDEPTHBUF
bool isPerspectiveMatrix( mat4 m ) {
return m[ 2 ][ 3 ] == - 1.0;
}
#endif
void main() {
// Default to outside the frustum so it's discarded if we return early
gl_Position = vec4(0.0, 0.0, 2.0, 1.0);
@@ -215,4 +222,5 @@ void main() {
vSplatUv = position.xy * maxStdDev;
vNdc = ndc;
gl_Position = vec4(ndc.xy * clipCenter.w, clipCenter.zw);
#include <logdepthbuf_vertex>
}