Clipping Issue

Just found a messy but very functional workaround in 05 b28. Make sure you’re in the forward render preset, and create a giant plane with a couple of kilometers between it and your enormous view clip that obscures the background (in future a sphere will be much better). Then the only z fight will be between the background and that plane. To fix background z fight, you head to ./build_(name)/compiled/Shaders/world_pass.vert.glsl and add the following in main():

gl_Position.z=log(gl_Position.w + 1) / log(1000000/*my view distance*/ + 1) * gl_Position.w;
//might also work just to set it to a constant

Beware - switching to defered will delete the file and the background will break again. There probably is a place that the logarithmic depth of the background for deferred can be added, though.

I only halfway understand why this works, but it works like a charm.

2 Likes