CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
13.01k stars 3.51k forks source link

No Clamp To Ground for Google's 3D Tiles #11305

Closed ryanhlewis closed 1 year ago

ryanhlewis commented 1 year ago

Trying to use both markers or billboards with Google's Photorealistic 3D Tiles makes all entities appear under the surface of the tiles. Adjusting z height doesn't work, while old fixes like CLAMP_TO_GROUND error out because we have the globe disabled.

Using other fixes, like .clampToHeightMostDetailed or .clampToHeight also do not work, and still put the point under the surface.

The only one that seemed to work was using scene.pickPosition(movement.position), which in context, made a marker wherever I clicked from the example code, and this always seemed to be on top of the terrain. However, I can't simulate the same movement.position for all the dynamically generated markers I wish to put on the terrain on load.

Is there some fix to this? I've seen Google's implementation using CesiumJS on their demo page, which seems to have markers on top of the terrain correctly. However, as with all things Google, their code is heavily obfuscated.

ggetz commented 1 year ago

Hi @ryanhlewis, thanks for the request!

Google's examples make use of classification, such as in this sandcastle examples.

However, I agree that we're lacking the cohesive ability to clamp to 3D Tiles as terrain, such as the use case with Google's Photorealistic 3D Tiles, throughout all of the API.

Any luck with Scene.sampleHeight? I would suggest using scene.pickPosition or that as a workaround in the meantime.

ggetz commented 1 year ago

Actually, I believe this is a duplicate of https://github.com/CesiumGS/cesium/issues/7044.

I'm going to close your issue now to keep the discussion in one place. If you have any further input on this, please post it there instead.