Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Well, this isn't the big refactoring I wanted to do in #1293, but at least it fixes #1236.
Fixing that bug, refactoring the octree finalization and changing how we handle water levels at once was a pain, so I just fixed the bug instead and at least improved variable naming.
Water angles/levels in Chunky don't match Minecraft's water angles, which are pretty complex and depend on the surrounding blocks per corner. If somebody wants to work on that, feel free. After putting many hours into that, I'll focus on other things for now.
This PR also fixes a finalization inconsistency that would cause water blocks below solid blocks to have full height at chunk borders (the two lava-reflecting blocks are water blocks at the chunk edge):

Having all water blocks below blocks have full height might be desirable for underwater world renders. However, this would cause full height water blocks to be shown at the water surface (similar to the image above).
Minecraft works around this by simply not rendering the water surface when viewed from below for such water blocks (no air in the 3x3 blocks above), but we can't have one-sided water surfaces in a path tracer. Maybe a follow-up PR could add an underwater mode where we apply full block height to all water blocks with a non-air block above them.