Fix weird culling of fluid interior top planes
muzikbike opened this issue ยท 2 comments
Request Description
Build the following structure:
Now enter it in Spectator mode:
You'll notice something strange pretty quickly - the top faces of the water are visible from outside (as they should be, as they aren't coplanar with the ceiling and therefore hidden), but are completely invisible from the inside.
Things get even weirder if you knock out one of the corner blocks - one of the planes will be visible, whereas the other will not, separated by an abrupt cutoff at the block edge.
Here's another setup demonstrating much the same issue:
This is vanilla bug https://bugs.mojang.com/browse/MC-81654. May be within the scope of Sodium to fix - this is game graphics being weird and unintuitive, after all.
Vanilla's FluidState.shouldRenderBackwardUpFace
calculates when the down-facing quad for the top water surface should be generated. It's functioning as designed, but that design has unintended side effects as you've documented. What it does is check every block in a 3x3 area 1 block above the fluid block for being a different fluid and not a solid block, and only then does it generate this face. In sodium this check is called here.
I can confirm that removing this check and unconditionally generating this face fixes the issue in your cases. However, I don't think we want to change this given that it would produce a lot more geometry for flooded caves and make them look significantly different from the inside.
If we want to fix the "normal" case that you've presented in various flowing liquid situations, we (or Mojang) will have to come up with a better heuristic that can distinguish under water caves from other cases.