-
Notifications
You must be signed in to change notification settings - Fork 810
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
Sort render lists for regions and sections after traversal (#2266) #2780
base: dev
Are you sure you want to change the base?
Conversation
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.
Seems fine to me.
common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/region/RenderRegion.java
Outdated
Show resolved
Hide resolved
Renamed those methods, good to go now. |
confirm it fixes #2266 |
I've added code to sort sections as well since they were suffering from the same problem as regions, also caused by subtle errors in the ordering produced by the bfs near the frustum boundary. |
…ing issues stemming from bfs traversal with frustum not producing fully correct results
This fixes #2266 by sorting regions after render list generation. The summary of the bug is that it happens because from certain points of view, the frustum is such that the order in which two regions are visited by equally distant sections depends solely on their order in the queue. See the analysis here for more details and images.
My measurements suggest that sorting regions by distance takes around 5µs and in total generating render lists takes around 1200µs for this scene. So the cost of sorting regions is around 0.5% which seems very acceptable. Measuring something that only takes 5µs with nanoTime is probably not the most precise, but it's averaged and very fast either way.
Obviated by #2887, but I hope this PR can be merged far earlier than the other one so that rendering is less broken until it gets merged. I'll resolve conflicts when the time comes.