Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Fluid Shaping #2931

Open
wants to merge 29 commits into
base: dev
Choose a base branch
from
Open

Conversation

douira
Copy link
Collaborator

@douira douira commented Dec 10, 2024

Refactors the fluid renderer to improve fluid shaping in a variety of situations. Profiling shows that the performance impact appears to be negligible.

Screenshots are ordered dev and then this patch.

Regular water slopes look the same.
water 1 dev
water 1 patch
water 2 dev
water 2 patch

Water slopes are nearly identical. I experimented with changing the sloping behavior and it didn't work out well.
water 3 dev
water 3 patch

Water shaping around stairs (foreground) and between stairs (further back): Water height doesn't propagate through the closed sides of block faces, fixing issues with unnecessarily bent water faces and water connecting to waterlogged blocks where it shouldn't.
Fixes #1211
water 4 dev
water 4 patch
water 5 dev
water 5 patch

The cave heuristic has been refined to search 2 blocks around and 1 block up (compared to 1 block around and 1 block up). This improves the appearance of inward up face culling somewhat. Player builds are still somewhat weird but generally improved.
To make the presentation more self-consistent and to avoid situations where seams in the fluid are visible from air spaces that the player could inhabit, some cases now have more fluid quads than before. In other cases, less faces are shown to make glass rendering more consistent. Glass being right above water doesn't constitute enough "air" to make it render inwards facing quads, but outwards facing quads will render to ensure the fluid is visible when viewing it through the glass from above.
Fixes #2470, nearly completely, to the point where I would call it fixed.
Fixes #2935 by providing a feasible yet pretty good cull heuristic.
Fixes #2947 by hiding down-facing fluid up quads against glass in all reasonable cases.
dev
patch
water 6 dev
water 6 patch

Outward up faces are now culled with the refined cave heuristic. This slightly increases rendering performance if there's a lot of flooded visible caves. I have reports of increased fps anywhere up to around 2 to 6%.
water 8 dev
water 8 patch

The test for bottom quad occlusion to show inward water quads on air, but not on glass for example. By using the same test for overlays as the sides, this more consistently shows and hides the inward bottom face.
Fixes #1210
Fixes #1212
water 7 dev
water 7 patch

douira added 24 commits December 8, 2024 00:54
…he fluids towards each other unless they're actually connected
move occlusion test methods out of BlockOcclusionCache and rename to ShapeComparisonCache,
…dundant checks and methods, simplify methods where possible
@douira
Copy link
Collaborator Author

douira commented Dec 15, 2024

ok I'm marking this as ready, what follows will be fixing any bugs we might find in further testing.

@douira douira marked this pull request as ready for review December 15, 2024 19:48
@douira
Copy link
Collaborator Author

douira commented Dec 18, 2024

I've fixed a small bug with the flooded cave heuristic and added detailed documentation to the PR and the fluid renderer class itself.

@douira douira requested a review from jellysquid3 December 18, 2024 02:31
refactor flooded cave heuristic iteration behavior,
make inner and outer up quad independently activated for better results in some cases
@douira douira force-pushed the fix-waterlogging-slants branch from 78b2d82 to 9c9b755 Compare December 22, 2024 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment