Make camera controls respond only to 3D tileset pick and not to globe pick.

1. A concise explanation of the problem you’re experiencing.

I would like to have the camera controls respond only when mouse is clicking on a given 3D tileset I added to the scene, and not when mouse is clicking on the globe (default ellipsoid, no terrain provider). See context for why, I basically would like to use the cesium viewer for an asset which is not linked to a geographical context - therefore an asset which is like hanging in the air on a black background, a bit like sketchfab viewer.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

Not a bug, but here is what I tried so far. I’ve tried playing with viewer.scene.globe.depthTestAgainstTerrain = false with no luck. I’ve also seen mentions of depthFailMaterial, but used for polylines and polygons and not the globe directly. Could it be used in my case?

After digging through code and github, here is probably the best bet. I am using default camera controls (through scene.screenSpaceCameraController), which probably perform a test based on z-buffer at mouse coordinate when clicking. The controller is probably calling viewer.scene.pickPosition which in turn calls viewer.scene.globe.pick. What I would like to do is basically prevent globe.pick to return anything so camera controls would only work when mouse is clicking on the 3Dtiles asset, and not on the globe.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I am using the cesium viewer to display a 3D tiles mesh (100M polys tiled with ion) which should not be linked to any geospatial context. So I disabled imagery providers, set terrain to ellipsoid, set sky, atmosphere, world to black, etc. When I use middle mouse button to rotate around the 3D tileset, it works correctly, but I would like to disable it when clicking outside the tileset (on the terrain), which sometimes induce a really large camera motion since the pick point is far from camera center.

4. The Cesium version you’re using, your operating system and browser.

Latset build available, 1.67 (on firefox and chrome, on windows)

Sorry for being not so concise. Best,

Jonathan

I think a simpler thing you can do is just lock the camera to that 3D Tileset’s origin (like its boundingSphere.center) as described here:

https://groups.google.com/d/msg/cesium-dev/USaQJKNHdME/eOVTMBIbBwAJ

That way the user can freely rotate and zoom out but will never lose track of it. You could also turn off the globe (by passing globe:false to the Viewer constructor).

Is this like a BIM/CAD application where you’re visualizing a design that doesn’t have a defined world-location?

Hi Omar, and thanks for the quick reply.

I cannot use your first trick to lock the camera origin, as I want to be able to move (pan, rotate, zoom). If I try to use what is described in your other post, then I can only look around and zoom, but I cannot pan anymore.

And if I delete the globe (I already tried using globe.destroy(), but the same happens when doing so at viewer creation), then the camera motion are hugely amplified (maybe it has to do with false height reference ?).

The model is that of a mosaicked standing wall. By the way, I am working with a 1M polygon mesh I tiled with my Cesium Ion free account. I’m trying to tile a 100M version of the same model, but the gltf versions had errors during tiling, and the obj version has been blocked at 9% processing for a day. Do you have an idea where this can come from ? Asset it is 85811 (and I deleted the gltf versions to not count against my 5Gb quota).

Thanks again,

Jonathan

HI Omar,

Do you have another hint regarding the restriction of the controls to the tileset and not the globe?

And most important, do you have an idea about why the tiling fails on Cesium Ion? If you can share your email with me, I can send you multiple versions of the 3D files so you can try them out and understand why it fails.

Best and talk to you soon,

Jonathan