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

Perform server occlusion culling as spatial and temporal sampling #14186

Closed
wants to merge 2 commits into from

Conversation

lhofhansl
Copy link
Contributor

@lhofhansl lhofhansl commented Dec 29, 2023

This changes the current occlusion culling to a sampling approach.
Sampling is spatial, in that it sends a couple of rays to a random point inside the target block.
Sampling is also temporal in each round of going through map send cycle another rays is sent.

  • Goal of the PR
    Improve both performance and accuracy of occlusion culling. Remove the hack that requires encountering two solid nodes before declaring a block invisible - not needed with the sampling.

  • How does the PR work?
    Instead of a fixed set of culling rays, send a set of random rays.

  • Does it resolve any reported issue?
    No. Although sometimes we complain about occlusion culling being inaccurate.

  • Does this relate to a goal in the roadmap?
    No

  • If not a bug fix, why is this PR needed? What usecases does it solve?

To do

This PR is Ready for Review (and for Testing)

How to test

Load any world. Set a large viewing_range (like 1000), and observe how the world is loaded.
Notice that blocks near-by are culled fairly accurately, whereas in the distance some "holes" are visible that filled in over time.

Whether this is annoying or not is subjective, so please test and let me know.

@lhofhansl
Copy link
Contributor Author

Any takers for testing?
I know doing this randomly seems weird, but it is both more accurate and faster.
If we wanted to we could even trade accuracy for performance.

@lhofhansl
Copy link
Contributor Author

lhofhansl commented Jan 4, 2024

I just realized the same code is used on the client (when client_mesh_chunk is < 4 and/or the viewing_range is all).

Unlike on the server, on the client the culling is not "additive". So on the client it needs to be deterministic or it leads to flickering.

Hmm... I could have slightly different client and server implementation (in clientmap and servermap, resp.), but I am starting not to like this as much anymore.

@lhofhansl lhofhansl added the WIP The PR is still being worked on by its author and not ready yet. label Jan 4, 2024
@lhofhansl
Copy link
Contributor Author

I separated client and server side occlusion culling. The client part is back to the original, completely deterministic, the server accumulates blocks by sampling (for accuracy and performance).

@lhofhansl lhofhansl removed the WIP The PR is still being worked on by its author and not ready yet. label Jan 4, 2024
@lhofhansl
Copy link
Contributor Author

I might just close this...

@lhofhansl
Copy link
Contributor Author

Closing this in favor of #14212.
In turns out the main improvement from this is using needed_count of 1 when sampling, and #14212 achieves that as well.

@lhofhansl lhofhansl closed this Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant