Sodium Reloaded (Unofficial)

Sodium Reloaded (Unofficial)

0 Downloads

Use a Reverse-Z depth buffer by default

jellysquid3 opened this issue ยท 5 comments

commented

Currently, Minecraft suffers from slight depth buffer precision issues even with a render distance of 32 chunks, and these issues are exacerbated when using any kind of zooming or spy-glass like functionality. For mods like Nvidium, the problem is even more extreme due to the dramatically increased render distance.

This is because OpenGL is rather funny and uses clip-space of [-1, +1], which has historically been a problem. The ARB_clip_control extension (merged in OpenGL 4.5 Core) provides a way to re-configure the clip-space to something more reasonable, like [0, 1].

Open questions:

  • How does this affect Z-fighting with blocks such as Iron Bars? Maybe it could help. It does not.
  • Are other mods going to break if we enable it by default?
commented

This is no longer being considered -- the changes required are too dramatic for Sodium to justify for the minimal improvement it provides.

commented

For the record, it would seem that enabling this would just involve using glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE) to reconfigure the clip-space.

commented

Ah. Simple experimentation shows that Minecraft relies on a bunch of depth-buffer hacks for the inventory. So this will be really hard to pull off...

commented

This sounds like a cool feature and would probably fix your depth issues (I know Far Plane 2 did something like this).
However as a Distant Horizons dev I am a bit worried about how this would affect something like Distant Horizons and Iris

On the DH side:
Being able to drastically increase the far clip plane without loosing Z precision would be amazing and would allow DH to potentially render in the same depth space as vanilla MC.
But I'm not sure how much changing the Z buffer would affect rendering and if we would have to explicitly add support for two different depth spaces, which sounds like it could get messy.

On the Iris side:
Since shaders assume a certain Depth format I anticipate this might require additional work on Iris' end to support and/or might cause issues with backwards Optifine compatibility.
Although @IMS212 would be able to comment on this more than me.

commented

Just to be clear, if we did implement this, we would provide some way to disable it (or at least allow mods to signal that it needs to be disabled) as it has a non-zero chance of breaking stuff.