Sodium

Sodium

44M Downloads

Fix weird culling of fluid interior top planes

muzikbike opened this issue ยท 2 comments

commented

Request Description

Build the following structure:
2024-05-05_20 42 08
2024-05-05_20 42 19

Now enter it in Spectator mode:
2024-05-05_20 42 31
2024-05-05_20 42 33

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.
2024-05-05_20 42 50
2024-05-05_20 43 02

Here's another setup demonstrating much the same issue:
2024-05-05_20 46 24
2024-05-05_20 46 33

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.

commented

Hasn't be fixed yet.(sodium1.20.6-5.9)

commented

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.

Here's a comparison image:
2024-11-04_20 52 06

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.