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

Block occlusion calculation should require neighbor block info. #7

Open
TheDudeFromCI opened this issue Dec 17, 2022 · 0 comments
Open
Labels
optimization Adds a performance enhancement

Comments

@TheDudeFromCI
Copy link
Member

What is the aspect of the project that needs optimization?
Currently, generating a block model for a chunk mesh is done in two passes. The first pass checks the block occlusion for each block while the second pass generates the mesh data for that block based on the occlusion value.

However, more accurate block occlusion data can be calculated by knowing the neighboring block data.

Describe the solution you'd like
When polling the block shape to provide block occlusion ok information, the 26 neighbor chunks of the target block should also be provided in order to take them into account when generating the block occlusion.

Why is this proposal significant, and what are the expected performance benefits?
The hope of this optimization is to increase block occlusion calculation accuracy in hopes of reducing the chunk mesh size where possible. While this might only reduce in the reduction of a few dozen quads per chunk mesh, this reduction may still prove significant in certain edge cases. The cost of this change is negligible as the implementation of this block occlusion can still choose to ignore the neighboring blocks and still maintain the existing mesh generation speed.

A simple example of how this might benefit the project would be having two non-solid blocks touching each other. Imagine the first block is a block that is 0.5 meters tall while the second block is 0.25 meters tall. Currently, both are non-full blocks and thus mark the edges as non-occluding. But with neighbor block data available, the taller block slab can occlude the smaller one, safely.

Additional context
N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization Adds a performance enhancement
Projects
None yet
Development

No branches or pull requests

1 participant