Correcting vertical positioning of georeferenced model

Hi!

I have some 3D models, representing real buildings, that have been georeferenced by having their position from the origin moved by an amount equal to the real world distance from a known reference point. Using the longitude and latitude of that reference point as position for an entity (or a primitive), i should be able to place these models in their real-world position, but when i tried doing that the model always ended up positioned somewhere higher than it should be, surely because the curvature of the earth wasn’t taken into account. Is there any way to make the vertical positioning of a model adapt and start from the earth surface? I tried using different modelMatrix and heightReference values, but it didn’t help, is it even doable in Cesium?

Any kind of help or pointer is appreciated. Thanks!

Hi Elia,

If I understand you correctly, the issue is that you’re trying to offset a Cartographic point with some 3D value (a Cartesian3?), when you’d like to move along the surface of the earth. Given your lat long point, you can use Cesium’s EllipsoidGeodesic.interpolateUsingSurfaceDistance (https://cesiumjs.org/Cesium/Build/Documentation/EllipsoidGeodesic.html#interpolateUsingSurfaceDistance) to move some distance along the globe’s surface. This should fix your height offset problems.

Hope that helps!

  • Rachel

Hi Rachel.

That solution would be a good idea, but it doesn’t apply to my case, since i have no access to the actual offset values (because they are “inside” the model file), so i can’t use them as parameters for a function.
Gonna rephrase it a bit: i have a model that is georeferenced with a projected coordinate system. That has been done by placing the 3D elements inside the model file at some X and Y coordinates that reflect the distance respectively to the east and to the north from a certain reference point on the globe, for which i know the exact latitude and longitude. The Z coordinate used inside the model represents instead the height of the structure compared to the sea level.
So my question is: is there a way to make Cesium place this kind of georeferenced model in its intended position and height on the 3D globe?
And more generally: is Cesium able to handle georeferenced 3D models at all? This wasn’t much clear for me.

Hi Elia,

Looks like Cesium should be able to support georeferenced models – check out the documentation for models that makes note of support for CESIUM_RTC, a gltf Relative To Center extension, which sounds like what you need.

Here is the model documentation: http://cesiumjs.org/Cesium/Build/Documentation/Model.html?classFilter=mode

And more helpfully, the spec for CESIUM_RTC with examples:

https://github.com/KhronosGroup/glTF/tree/master/extensions/Vendor/CESIUM_RTC

Hope that helps!

  • Rachel

I’m not really sure how am i supposed to implement that RTC system practically (the links in the readme are broken), but i doubt it would be helpful in solving the problem i posted about, that is of a slightly different nature. But that relative-to-center idea sounds like something i might need later for a different problem, so thanks!

Did anyone have any experience with using georeferenced 3D models in Cesium?

Can you post a screenshot? I have an idea… but it could be something else completely.

Since you say the x=east, y=north, and z=height, I think the problem could be that by default Cesium expects glTF models to be y-up in accordance with the glTF spec, but in general this doesn’t work for georeferenced models. Could you try constructing the Model with
upAxis:Cesium.Axis.Z

``

Otherwise it could be related to the curvature of the Earth, in which case it probably won’t work because the height reference only applies to the model’s center.

I don’t think that’s it either, since the model appear in the right orientation and in the right “horizontal” position. Also, what makes me think it’s related to the curvature of the earth is the fact that, as it shows in the screenshot, the X axis of the primitive’s reference frame doesn’t follow the surface but goes on straight. Relatively to that, the model IS positioned correctly! My whole problem came from the fact that i thought there could be a way for Cesium to take the curvature in account and calculate where to put that model. i’m not much knowledgeable on these subjects, maybe i was expecting something that is not doable to begin with. For now i’m gonna stick to non-georeferenced model, that i’ll have to position by supplying the right latitude and longitude myself.

By default, Cesium renders the surface of the earth as an ellipsoid which can differ significantly from the undulating surface that is mean sea level or the geoid (see explanation). If this is the case you have a couple of options: (1) place them on the ellipsoid by adjusting the height or (2) obtain a source of elevation data that will render the surface of the earth more accurately.