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

Update the empty traversal algorithm to match CesiumJS, possible fix for low-res flickering #2847

Merged
merged 2 commits into from
Dec 21, 2023

Conversation

Avnerus
Copy link
Collaborator

@Avnerus Avnerus commented Dec 20, 2023

Hi!
After a year of absence I'm back doing some viz work.
I'm now updating nytimes/three-loader-3dtiles to loaders.gl-4 and support for Google's 3D Tiles (feature/loadersgl-4 branch).
I noticed one issue where low-res tiles flicker above the high-res tiles during traversals, possible related to this issue. It seemed to have come from some glitch in the "empty" traversal mechanism. I updated the algorithm to match the latest CesiumJS one and at least on my tests it seems to fix the issue and does not hinder performance. Could you also run some tests on your side, deck.gl and such?
And if this is good to merge, could you also merge it as a fix to the stable loaders.gl v4?
Thank you!
/Avner

Copy link
Collaborator

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Avnerus Welcome back!

It is possible to add a test case or two? Traversal tests are a weak area in loaders.gl so maybe it is too much to ask but I think we need to start somewhere.

@Kaapp and @belom88 if not a detailed review, would appreciate at least rubberstamps showing that you have scanned the code.

If this doesn't make it into a 4.0 patch release, we are pretty close to releasing 4.1. Let's decide when it lands.

@Avnerus
Copy link
Collaborator Author

Avnerus commented Dec 20, 2023

Thanks @ibgreen.
I pushed another commit, there was a wrong property name taken from CesiumJS.
I looked some more into the code and looks like this was the problematic line:

      while (stack.length > 0 && allDescendantsLoaded) {

And the problematic allDescendantsLoaded condition was added by yours truly here, perhaps copying older code of CesiumJS, or perhaps it was my idea - I'm not sure. But looking toward a test case - there could be a parent tile where one child answers the condition of !allDescendantsLoaded, that breaks the traversal and probably prevents the loading of sibling tiles that do need to be refined.

Copy link
Collaborator

@Kaapp Kaapp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice find! looks good to me 🎉

looking at the linked issue i agree that this was likely also the culprit

@ibgreen ibgreen merged commit 7a4f41f into master Dec 21, 2023
4 checks passed
@ibgreen ibgreen deleted the update-tiles-empty-traversal branch December 21, 2023 00:29
@felixpalmer
Copy link
Collaborator

@Avnerus really great to see this, this issue has been a pain for a while. Will integrate into deck.gl soon

@Avnerus
Copy link
Collaborator Author

Avnerus commented Jan 2, 2024

@ibgreen, do you think this could be a patch for v4.0? I prefer to wait for this merge before updating three-loader-3dtiles to support Google's 3D Tiles.

@felixpalmer
Copy link
Collaborator

@Avnerus it is published in the latest 4.1 alpha

@Avnerus
Copy link
Collaborator Author

Avnerus commented Jan 2, 2024

@felixpalmer Oh I didn't realize that the alpha builds are also published to npm. Thanks! I'll give it a go.

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.

4 participants