Google 3D Tiles and Cesium.Globe clipping

This is my first message here, cesium is super cool, congratulations to everybody.

I am trying to use google3d tiles and cesium for a browser game research project. I have entities that move around according to server signals and keep the camera on one item via trackedEntity. This all works pretty good. But I ran into a few issues that I can’t resolve myself and can’t find solutions.

a.) I noticed that a strange filled colored plane that would occur in certain scenarios.


I know now that is the cesium.globe and when i disable the property it goes away. But then I don’t have blue sky anymore;) Using terrain: Cesium.Terrain.fromWorldTerrain() reduces the effect but it’s still very much visible.

Why does it show anyways? How can I show the sky without the globe? I hope this makes sense. Below is my viewer init.

const viewer = new Cesium.Viewer('cesiumContainer', { imageryProvider: false, baseLayerPicker: false, requestRenderMode : true, shouldAnimate: true, timeline: false, animation: false, terrain: Cesium.Terrain.fromWorldTerrain(), }); viewer.scene.primitives.add(await Cesium.Cesium3DTileset.fromUrl( "https://tile.googleapis.com/v1/3dtiles/root.json?key=KEY" ));

b.) This is not specific google3d concern. I am using the velocity orientation property to manage the orientation of the model. Works great. What I don’t understand is how i can keep the camera fixed on the model as well. Say I want the camera on the back always, how can I use the orientation to achieve that?

var transform = Cesium.Transforms.eastNorthUpToFixedFrame(position); viewer.scene.camera.lookAtTransform(transform, new Cesium.HeadingPitchRange(0, -Math.PI/4, 100));

I am using this to fix the camera but I don’t understand how I feed to orientation of my model into the camera. I think it might be simple, famous last words.

Best and thanks a lot,
Stan

Hello,

Thanks for the kind words!

a) Yes, Cesium World Terrain does intersect with Google’s 3D Tiles due to slight differences in reference frames. Using 3D Tiles as the entire globe is a fairly new concept in CesiumJS when compared to terrain datasets. As such, there is a bit of a feature discrepancy, which we are tracking across a few feature requests. In particular, Atmosphere not rendered if globe is not defined · Issue #11266 · CesiumGS/cesium · GitHub is tracking showing the sky without a globe.

b) viewer.trackedEntity will change the camera mode to “lock on” to an entity as in this Cesium Sandcastle example. Does that work for your case?

a) Yes, Cesium World Terrain does intersect with Google’s 3D Tiles due to slight differences in reference frames. Using 3D Tiles as the entire globe is a fairly new concept in CesiumJS when compared to terrain datasets. As such, there is a bit of a feature discrepancy, which we are tracking across a few feature requests. In particular, Atmosphere not rendered if globe is not defined · Issue #11266 · CesiumGS/cesium · GitHub is tracking showing the sky without a globe.

Thank you, understood!

b.) b) viewer.trackedEntity will change the camera mode to “lock on” to an entity as in this Cesium Sandcastle example. Does that work for your case?

Not really, this is because I am struggling with some of concepts of cesium to be honest. My initial plan was to always maintain the same angle on the object even when the object rotates to follow the line (got that work nicely)

Then I realized that is actually not the greatest approach because there might be occlusion. So I created a camera that rotates

const trackCamera = ()=>{ viewer.scene.camera.lookAt(position, new Cesium.HeadingPitchRange(heading, -Math.PI/4, config.cameraRange)); heading+=0.001; }

that works great is also a much better ‘experience’ than a locked view.

But now there is a new problem. Cesium.HeadingPitchRange requires the range in meters, I have it set to 400m. What I thought is that the range is relative to the point but it isn’t so in higher altitude areas i get the scenic view from below:) I can manually adjust that for the entities in that region, but I wish there would be a relative way defining the camera range in respect to the given position. Is there? I can’t use the position.z (which I get from clamping) since it’s not in meters and something entirely different.

Best,
Stan

Hi @whoisstan,

There are a few different coordinate systems that are used in CesiumJS, and in geospatial apps in general.

The position you are getting is in Earth-fixed Cartesian coordinates, so those numbers are in meters. You can easily convert this to longitude/latitude/height above the globe’s ellipsoid. See the “Show Cartographic Position on Mouse Over” example for the details: http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Picking.html&label=Showcases