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

A much better "forbid holes" mode #599

Merged
merged 12 commits into from
Mar 16, 2023
Merged

A much better "forbid holes" mode #599

merged 12 commits into from
Mar 16, 2023

Conversation

kring
Copy link
Member

@kring kring commented Mar 2, 2023

Our old "forbid holes" mode worked by loading the tile pyramid strictly from the top down. Before a tile could be refined, all of its children had to be completely loaded. This indeed prevented holes, but it also made loading a lot slower. The user would see a switch to each level-of-detail in turn as each level loaded.

Meanwhile, we also had another option to avoid holes. Disabling frustum culling also achieves the goal of avoiding any holes (after #597). And in this mode, we don't strictly need to load tile levels in order. We can shoot straight down and load the most detailed tiles first. The only caveat is that we load and render a bunch of extra tiles that are outside the view frustum. So this mode is slower to render than the "forbid holes" mode (because it renders more tiles; though culling on the game engine side will avoid some of this), but it loads fewer tiles and gets detail on the screen faster.

This PR eliminates the old "forbid holes" mode entirely and replaces it with a variation of the "disable frustum culling" mode tuned to simply forbidding holes. In this new mode:

  • Culled tiles are not rendered (unlike when frustum culling is disabled)
  • Culled tiles are never refined (with frustum culling disabled, there's a separate target screen-space error driving refinement of culled tiles)
  • Culled tiles that have not been loaded yet prevent rendering of a subtree that contains them, just like non-culled tiles. This is the bit that avoids holes.

With this new mode enabled, and "preload ancestors" disabled, I'm seeing about a 30% increase in tiles loaded and total load time compared to the default mode with all preloading disabled.

In the tables below, the settings are as follows:

  • Old forbidHoles: The main branch with Forbid Holes = true, Preload Ancestors = false, Preload Siblings = false, Enable Frustum Culling = True
  • New forbidHoles: This branch with the same settings as above.
  • Default Settings (with holes): The main branch with Forbid Holes = false, Preload Ancestors = false, Preload Siblings = false, Enable Frustum Culling = True. These are cesium-native's default settings except with all preloading disabled to simplify measurement.
  • Frustum Culling Disabled: The main branch with the same settings as above except Enable Frustum Culling = false and Enforce Culled Screen Space Error = false

In all cases the network cache is warmed up so no network requests are done.

San Francisco scene in Cesium for Unity, default view

Metric Old forbidHoles New forbidHoles Default Settings (with holes) Frustum Culling Disabled
Tiles Rendered 94 94 94 187
Tiles Loaded 233 184 102 184
Total Load Time (ms) 461 273 187 324

Cesium World scene in Cesium for Unity, default view

I deleted the "Dynamic Camera" so titles wouldn't be selected for both the Editor camera and the scene camera.

Note that the number of tiles rendered is higher than the number loaded for Cesium OSM Buildings because it dubiously counts contentless tiles as "rendered" because of the additive refinement.

Metric Old forbidHoles New forbidHoles Default Settings (with holes) Frustum Culling Disabled
Tiles Rendered - CWT 279 279 279 412
Tiles Rendered - OSM 48 48 48 92
Tiles Loaded - CWT 579 475 319 453
Tiles Loaded - OSM 83 42 42 79
Total Load Time (ms) - CWT 1114 931 654 927
Total Load Time (ms) - OSM 691 219 185 283

@joseph-kaile
Copy link
Collaborator

Tested with Unreal, looks good.

@joseph-kaile joseph-kaile merged commit cfd1fac into main Mar 16, 2023
@joseph-kaile joseph-kaile deleted the better-forbid-holes branch March 16, 2023 17:37
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.

2 participants