Globe picking is very slow
See original GitHub issueThe current approach for globe picking is intersect the ray against all rendered tiles (using their bounding spheres) and sort the intersected tiles by closeness to ray. Then, for the closest tile do ray-triangle intersection tests against all of its triangles and return the closest. If there was none, test the next tile. And repeat.
This could be optimized some more. ScreenSpaceCameraController
does one or two globe picks per frame and that alone can slow down Cesium severely with detailed terrain providers like ArcGIS
.
Some ideas on how to improve this:
- Custom intersection test for heightmap providers since we know their triangles are on a grid
- Per-tile octree for non-heightmap providers (too slow to generate?)
- Remove
TerrainEncoding
quantization for faster position decode from vertex buffer (only affects nearby tiles) - Cache recently used triangles in a form that makes future picks faster, maybe by pre-calculating some of the math from
IntersectionTests.rayTriangleParametric
. - Unroll picking math
Sandcastle (console prints how long each pick takes with left click). Select ArcGIS
from the dropdown for some seriously slow speeds.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:14 (10 by maintainers)
Top Results From Across the Web
Why Arcgis tile terrain make my globe is super slow
When i use ArcGIS Tiled Terrain my globe is being super slow. Super low frame almost 2~3 fps. But just change terrain to...
Read more >Speeding up pickables, lots and lots of ... - WorldWind Forum
I have been analyzing ways to speed up performance and the biggest slow down right now is picking. If I disable picking on...
Read more >Why Your Internet Slows Down at Night (and How to Fix It)
Slower internet speeds at night are often the due to network congestion. Just like rush hour traffic, when everyone uses the internet at...
Read more >how to use watering globes (we tested for ourselves)
As the water trickles out, a weak vacuum is formed within the globe, stopping too much water from escaping at once. As the...
Read more >Everything I know about slow and steady living, I learned ...
Have a story to tell? See our guidelines at tgam.ca/essayguide. The Globe and Mail.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Those two optimization ideas are good. I agree with the plan to optimize the JS version first, and then convert to WebAssembly if necessary. And yeah, draco is the only one so far. So then it’s a matter of deciding what programming language to use, etc, etc and may involve input from other team members. So that’s more for the distant future, even though I think it could speed things up a decent amount.
I’d like to avoid calling
triangleVerticesCallback
for every triangle by instead passing a vertex grid directly to a new function calledaddTrianglesFromHeightmap
. CurrentlytriangleVerticesCallback
insideHeightmapTessellator
figures out the vertex index from the triangle index, but it’s not very optimized.I’m in the same situation as you, only able to work on this in my spare time. I want to get back to this in around 2-3 weeks, but even then I’m not positive. I’ll give an update then.
This actually came up twice this week on the forum: