2

The issue:

I have a glTF (ver. 2.0) mesh (converted from ply to dae to glTF) with triangles coordinates in EPSG:4978 that doesn't show up in Cesium (ver. 1.42).

The code:

This is the code in the main js app:

var model = scene.primitives.add(Cesium.Model.fromGltf({
    url : 'meshes/MESH_4978.gltf', // MESH_3857.gltf
    show: true,
    modelMatrix : Cesium.Matrix4.IDENTITY,
    scale : 1.0,
    debugWireframe: true
}));

The glTF file itself is well rendered here: https://gltf-viewer.donmccurdy.com/ (but the horizontal plane is vertical at start).

And I can see that the glTF file is well loaded with a Status=200 in the Firefox browser network monitor (or in Chrome).

The question:

So, where am I wrong?
Which coordinates system does Cesium use?

Other try:

I also tried with mesh coordinates in EPSG:3857; the exact same thing happens, i.e. file is loaded but nothing shows up.

1 Answer 1

1

Cesium's lowest-level internal coordinate system is Cartesian3 coordinates: the Earth-fixed frame, typically with a WGS84 ellipsoid, optionally with terrain on top, expressed in 3D Cartesian coordinates.

So your modelMatrix : Cesium.Matrix4.IDENTITY statement is placing the origin of your glTF file at the center of the Earth's core.

You can try placing the model at a specific location like this:

// Radians, not degrees, for HPR here
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);

// Degrees (since we asked) and meters, WGS84 lon/lat/alt here.
var origin = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height);

var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, hpr);
2
  • Thanks. But when using the EPSG:4978 (ECEF), the origin is at the earth center. So when having a 3D model with coordinates relatives to this origin, it should be positionned directly at the right place, on the earth surface where the points really are. A vertice of the mesh typically looks like : v 4353343 623753.56 4608244 in an *.obj file for example (coordinates expressed in meters). But it does not seem to be the case. Commented Sep 3, 2018 at 6:16
  • 1
    This is not recommended, because glTF position coordinates are single-precision 32-bit floats. This is not enough precision to give better than about 1 to 10 meter resolution at the Earth's surface. It's better to limit the model geometry to be within some reasonable distance (even if it's many kilometers, but not half an Earth radius) away from the glTF origin. This way Cesium can use 64-bit math to calculate the relationship of the model origin to the camera, and then the 32-bit offsets for vertex positions will be reasonable.
    – emackey
    Commented Sep 4, 2018 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.