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

Terrain tiles not culled during offscreen pick pass #9032

Open
dennisadams opened this issue Jul 16, 2020 · 1 comment
Open

Terrain tiles not culled during offscreen pick pass #9032

dennisadams opened this issue Jul 16, 2020 · 1 comment

Comments

@dennisadams
Copy link
Contributor

Not much of a bug, but possibly a potenial improvement. Picking.js' getRayIntersection renders the scene from an offscreen camera, typically for clamping or height sampling.
In this process, the 3D tilesets are updated once and non-visible tiles are culled. However, terrain-tile commands are copied as is, although many aren't visible from the offscreen camera. Especially in case of clamping or height sampling, where typically only 1 tile is expected to intersect the orthographic top-down frustum.

The straightforward benefit of culling these tiles, though not major, is saving some rendering work.

Another benefit is that this will allow tighter frustum near/far bounds when executing the commands, and thus better precision. For standard users the precision should be good enough regardless, but while testing a cheap Android device, I had precision issues in the Clamp to 3D Tiles and Sample Height from 3D Tiles sandcastles. What triggered the precision problems is that low-level terrain tiles were spanning over large depth ranges and forcing a maximally-spaced multifrustum. The fact that the offscreen camera is far away from the scene (9000.0m high, the defaultMaxTerrainHeight) also didn't help.

If someone would like to look into it, GlobeSurfaceTileProvider.updateForPick is where the commands are copied. Perhaps a solution would be to check there the tile visibility if passes.pick && passes.offscreen.

If visibility is checked using the bounding volume (like GlobeSurfaceTileProvider.computeTileVisibility does) it will help, but it's still likely that some low-level tiles will be rendered because of big bounding volumes. In the clamping/sampling case we can do better by checking if the camera's cartographic is contained in the tile's rectangle and that should eliminate all rogue tiles and allow tight frustum bounds. But this might be too cumbersome.

@dennisadams
Copy link
Contributor Author

Another benefit is that this will allow tighter frustum near/far bounds when executing the commands, and thus better precision. For standard users the precision should be good enough regardless, but while testing a cheap Android device, I had precision issues in the Clamp to 3D Tiles and Sample Height from 3D Tiles sandcastles.

With #9064 merged, precision is not an issue anymore, even on my device.

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

No branches or pull requests

2 participants