-
Notifications
You must be signed in to change notification settings - Fork 948
Fix rendering of UP face for waterlogged blocks with translucent sides #3775
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
Open
Auth0x78
wants to merge
4
commits into
CaffeineMC:dev
Choose a base branch
from
Auth0x78:fix-culled-fluid-up-face
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0e8788f
Fix issue where UP face of water in waterlogged block with translucen…
Auth0x78 d565857
Remove redundant height info by improving the fluid VoxelShape
Auth0x78 8c24f80
Merge branch 'dev' into fix-culled-fluid-up-face
Auth0x78 90b65be
Replace manual voxel shape construction with fluid.getShape()
Auth0x78 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the reason for this change? I think this changes the behavior.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main reason for this was even when the
ShapeComparisonCache.isFullShape(fluidShape)returnedFALSE, we fall through to the linereturn this.occlusionCache.get().lookup(fluidShape, selfShape)We check in occlusion cache, but the issue is that during first render, the cache is empty (no block data as 1st render), so the
lookup()in cache create a new entry and the default creation value isFALSE.Hence the function returns false and the UP face of the fluid is not visible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we simplify this logic to simply return
falsewhenShapeComparisonCache.isFullShape(selfShape)? The check forShapeComparisonCache.isFullShape(fluidShape)seems redundant to me when the full self shape already culls everything.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to keep it as in the case of the issue that this resolves there might be the case that the where
ShapeComparisonCache.isFullShape(selfShape)returns true, but as the sides of the selfBlock are transparent we need to render the UP face. So in that aspect we need to keep theShapeComparisonCache.isFullShape(fluidShape)there.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either we check the
isFullShape(fluidShape)or other way is we can check each side wall of the block and see if its full shape or not, but it will require us to loop over North, South, East and West facing wall surfaces of the current block, which might be less optimal than the current approach although a bit more accurate.Sorry for the delayed response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The culling shape of a block should match what the actual model represents. If the model says it's full, then we should be allowed to rely on that fact to cull anything within it as determined by the culling shape.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But here
var selfShape = selfBlockState.getFaceOcclusionShape(facing);as we can see that the selfShape is a VoxelShape of the surface in the direction offacingand not the entire block's VoxelShape.