Closed muzikbike closed 3 months ago
This seems like a fix that does not only touch the renderer, as the water layers touch the block while vanilla doesn't, as it does seem like something with the server side though...
I showed some screenshots on Discord last night to demonstrate how this would look in actual gameplay situations, so it might be worth posting them here as well for clarity.
Here's how a platform over water would look from above. Top image is the vanilla behaviour, bottom image is the new proposed behaviour. The difference here is virtually unnoticeable.
Here is it from just the right angle at the water's surface to expose the visual differences in height. The vanilla behaviour has a relatively clear gap here, which would not exist with the proposed fix as the water would bulge upwards by a pixel or so to fill it.
Here it is from below while in the water. Due to #2470, vanilla's behaviour is rather ugly since it renders a bunch of extra, unneeded planes around the edges, which randomly cut off as you go deeper under the shape. The fix would cut them off right as soon as the water is under the blocks, making edges clearer and perhaps cleaner.
Here's how things look if we clip into the blocks in Spectator mode. With the fix, we cull every top texture since it's no longer visible from the outside. Doing this will allow for the elimination of a lot of geometry in flooded overworld water and lava caves, and even more so in nether lava lakes.
Finally, here's one more graphic that shows the result of a fix for this and #2470. We have a 5x2x5 space here, and the 16 outer top blocks are water sources. There are no water sources on the bottom layer. With the current vanilla behaviour, due to erroneously culled internal planes, we cannot see the funnel shape from within the water - this issue is resolved with the changed behaviour. (Fixing just #2470 and not this would still make things look far better than in current vanilla, but the upper edges of the texture planes would stop just a few pixels shy of the top rather than stopping at the exact top as seen here.)
Again, as stated in last night's Discord conversation, more input is needed here to determine whether this change is worthwhile and preferable to vanilla's current way of handling fluids.
We discussed this issue yesterday and consensus between contributors is that this is not a desired change for Sodium. Nevertheless, various other fluid rendering issues can remain open as they are potentially valid in their own right.
Request Description
While testing out fluid shape handling recently, I've noticed a bunch of weird, undesirable quirks of how vanilla does it, and have come up with a potential fix for all of these.
The solution is as follows: if a fluid source block (not a flowing fluid) is directly below a block with a full 16x16 solid bottom face, then the fluid source block should visually "snap" upwards to that block by itself becoming a 16x16 cube on its own.
Here's a visual demonstration of how this would work. The current behaviour:![2024-05-05_21 31 23](https://github.com/CaffeineMC/sodium-fabric/assets/52297970/68bb6c1b-be7f-45bb-952b-45b5b4046a5f)
The fixed behaviour:![2024-05-05_21 31 25](https://github.com/CaffeineMC/sodium-fabric/assets/52297970/974c8fc3-364b-4aa9-9e8a-fbe2c9158ef7)
This would fix, or allow for the fixing of, a handful of undesirable quirks of vanilla's fluid models. For starters, we'd already have fixed https://bugs.mojang.com/browse/MC-249344, a Bedrock Edition parity issue of sorts. Lava in a glass cube would now look as follows (no weird gap above it):![image](https://github.com/CaffeineMC/sodium-fabric/assets/52297970/048adcad-b921-4d1e-ab57-ff42de189617)
Secondly, this would permit more intuitive behaviour for face culling. Since the top face of water or lava would now be coplanar with any solid, opaque blocks above it (no more visual gap), then both the interior and exterior top faces can be outright culled if the block above would cull any other block below it. This would get rid of the following nonsense (https://bugs.mojang.com/browse/MC-175133), where water/lava inner top faces sometimes render against solid blocks even though they shouldn't (with the fix they would continue to render against the glass as before):![2024-05-05_21 38 30](https://github.com/CaffeineMC/sodium-fabric/assets/52297970/d1783074-da8e-4280-a6a5-3e3a3a1377bd)
Since the top faces of fluids would be culled by solid blocks, we'd get rid of this other annoyance where flooded caves display the top face of the fluid at every instance, but don't display any of the others (not even the inner planes). It might make it harder to tell if a cave is flooded when outside of it and in Spectator but since we can cull more unnecessary planes this way and it resolves an inconsistency this isn't a major loss by any means.
![2024-05-05_20 53 14](https://github.com/CaffeineMC/sodium-fabric/assets/52297970/c78ae6b7-7427-4aa5-b8e0-84d922fefd37)
If it's possible to explicitly exclude flowing liquids (minecraft:flowing_water and minecraft:flowing_lava) from being culled at all times, while having it enabled for source units (minecraft:water and minecraft:lava), then this would also resolve #2470.