Geoferenced GLTF model does not exactly match lat lon reference points

70 views
Skip to first unread message

romo...@gmail.com

unread,
Apr 1, 2020, 7:18:22 PM4/1/20
to cesium-dev
1. A concise explanation of the problem you're experiencing.
I'm using a czml to display a set of points in cartographic degrees along a gltf georeferenced model. The model appears to be rendered correctly but the vertices do not exactly match the reference points. This is very noticeable when zooming in. I created a dummy example to illustrate the problem. The mismatch between the model vertices and the reference points can be seen in the attached screenshots. With other models I have been testing the model is also rotated with respect to the reference points.

model_and_points.png

model_and_points_zoomed_in.png


The model data is in utm zone 10 coordinate system (I made it by transforming the wgs84 reference points to utm using proj4). I'm using a node transform to convert the z-up data to y-up as required in the gltf spec. In Cesium I'm locating the model on the globe with the position property of the czml entity that references my gltf model, I use the centroid of the model in WGS84 coordinates as the cartographic degrees position.  


What do I have to do to make the model and the points match exactly?

Is there a preferred coordinate system I should use for this scenario? 

Is there any way to use wgs84 directly in the gltf data?


2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
var czml = [{
    "id" : "document",
    "name" : "CZML Model",
    "version" : "1.0"
    }, 
    {
        "id":"Point 1",
        "name":"Point A",
        "position": {
          "cartographicDegrees": [-122.37266385,37.82411625,10]
        },
        "point": {
            "outlineWidth":1,
            "pixelSize":5
        }
    },
    {
        "id":"Point 2",
        "name":"Point B",
        "position": {
          "cartographicDegrees": [-122.3709471,37.8215564,10]
        },
        "point": {
            "outlineWidth":1,
            "pixelSize":5
        }
    },
    {
        "id":"Point 3",
        "name":"Point C",
        "position": {
          "cartographicDegrees": [-122.36826735,37.82268672,10]
        },
        "point": {
            "outlineWidth":1,
            "pixelSize":5
        }
    },
    {
    "id" : "Model",
    "name" : "Gltf model",
    "position" : {
        "cartographicDegrees": [-122.3704656010898475, 37.8228363356576978, 10.0000000000000000]
    },
    "model": {
        "gltf" : "triangle.gltf",
        "scale" : 1,
        "minimumPixelSize": 1,
        "nodeTransformations": {
            "root": {
                "rotation": {
                    "unitQuaternion":[ 0, 0, 0, 1 ]
                }
            }
        }
    }
}];

var viewer = new Cesium.Viewer('cesiumContainer', {
    shouldAnimate : true
});

var dataSourcePromise = viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));

dataSourcePromise.then(function(dataSource){
    viewer.trackedEntity = dataSource.entities.getById('Point 2');
}).otherwise(function(error){
    window.alert(error);
});

The model used for the example is attached (triangle.gltf)

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I want to display a georeferenced gltf model along some reference points I have in WGS84 coordinates.


4. The Cesium version you're using, your operating system and browser.
Cesium 1.67
Ubuntu 18.04
Google Chrome Version 80.0.3987.106 (Official Build) (64-bit)


triangle.gltf
Reply all
Reply to author
Forward
0 new messages