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

Fix #2266 by sorting regions after render list generation #2780

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

Conversation

douira
Copy link
Collaborator

@douira douira commented Sep 29, 2024

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.

Copy link
Member

@jellysquid3 jellysquid3 left a 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.

@douira
Copy link
Collaborator Author

douira commented Sep 29, 2024

Renamed those methods, good to go now.

@MeeniMc
Copy link
Contributor

MeeniMc commented Sep 29, 2024

confirm it fixes #2266

…ing issues stemming from bfs traversal with frustum not producing fully correct results
@douira
Copy link
Collaborator Author

douira commented Oct 3, 2024

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.
In my test scene with 4875 sections, the render list finalization only takes 24µs, of which 7µs are spent on region sorting and the rest on section sorting.

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

Successfully merging this pull request may close these issues.

Section sorting is incorrect
3 participants