Is there a way to detect when the highest lod of a tileset is loaded?

I’ve been using GetLoadProgress() to detect when the tileset is loaded, but this seems to be reported as 100% before the highest lod is ready, unless I’m missing something? Which I can understand why since the highest lod will always come and go depending on the location.

Is there a way to get more information about what is loaded at a specific location?

Hi @flav,

I believe that GetLoadProgress() measures the load progress of the tiles are selected by the camera frustum. In short, the camera frustum selects which tiles to load every frame, depending on the Maximum Screen Space Error you choose. This may not necessarily mean the highest LOD is loaded.

It would help to know more about your use case, like what you need LOD information for in your application. Currently it’s not possible to query this information, but we could try to find workarounds or alternate solutions!

1 Like

Thank you @janine, that makes sense.

What I would be looking for, ideally, would be a way to detect load state of arbitrary locations. I’m placing procedural geometry on top of the terrain and need it to be placed correctly (using physics meshes and ray casts), but this is now not always possible due to when my code runs and the highest lod not always being loaded at that time.

I can think of two ways to attempt a solution. The first one would be to place my geometry whenever my code runs and then continue checking the state of the terrain and adjust my geometry when new lods get streamed in. This would still require support for detecting which lod is currently loaded, or at least get notified when the lod changes, which I don’t believe we have at the moment?

The second solution would be to force stream in the highest lod (or whichever will be needed during normal runtime) at a specific location, place my geometry as needed, then let go of the force streamed in terrain. I don’t believe there’s support for manually streaming in parts of the terrain at a specific location either?

Hi @flav,

Thanks for the detailed write-up! This is really helpful.

I’m afraid that you’ve described a common problem that a lot of users run into (that we’re aware of). We usually suggest raycasting a way to clamp geometry to the ground through the LOD changes. But, I should mention that we’re actively working on a better solution on Github! Feel free to track these PRs for progress updates:

But for now, let’s try to find a workaround. Of the solutions you suggested, the first one is unfortunately not possible (as you noted) because we don’t have events for LOD changes. However, your second solution might be possible if you use the Cesium Camera Manager. This actor can track multiple Cesium Camera instances, where a Cesium Camera is a struct that defines a camera frustum in the scene. You can define these cameras so they look down on your desired locations, prompting the tiles in those areas to load.

Note that if you have multiple cameras looking at different areas on the tileset, then GetLoadProgress() will measure the load progress across all of these tiles.

When we release a better clamp-to-ground solution, I’ll be sure to post on this thread with the updates. Until then, I hope this can work sufficiently for your use case. :smile:

Thanks @janine, this is a good idea, but I’m afraid it will be difficult to scale this to many locations, which I need to do.