CZML model located at origin

Hi all,

I am working on a CZML code to display some models that represent historical data, but I’ve run into the following situation:

  • The models tend to “wander” about their assigned coordinates as I adjust my view instead of the model’s origin being “pinned” to their coordinates. As I rotate the image, the model’s volume appears to continually center itself between my eye and the coordinates.
    When using a billboard, we can assign the horizontalOrigin and verticalOrigin, which seems to keep the billboard “pinned.” Other geometries (point, ellipse, etc) don’t display this same behavior.

Is there a way, in CZML, to tame these unruly models? Any other thoughts?

NOTE - You can see this (unfinished) project at www.geo-animate.com/Commonweath-War-Graves. I have in total 120,000 spanning the five years, and I’d like to replace the points that you see with models that have a different behavior. Then I want to move the KML project on www.geo-animate.com/War-of-Movement to Cesium as well, but as this is all new to me I’ll need a bit of time.

It’s hard to know for sure what’s going on without an example of the problem, but what you describe sounds like it could be a parallax effect caused by the models actually being placed far beneath the surface of the earth. Visually it could look like you describe, because the model and surface of the earth are actually at different distances from the camera, which is only noticeable when moving the camera. Check to make sure the 3D position of the model is actually at the surface.

Scott,

Thanks for your note. I will place a version on the website tomorrow and send out a link for all to see. Cheers, erik

Scott,

Here is a sample of the CZML that has puzzled me. The coordinates are for a cemetery between Bapaume, France and Albert, France and the model is called on September 14th. Pause the animation after that and rotate or zoom to better see what I’ve tried to describe.

I’ve also attached the <<column.gltf>> file.

Many thanks, erik

[{

“id”:“document”,

“name”:“Model_Sample”,

“version”:“1.0”,

“clock” :{

“interval”:“1914-08-01T00:00:00Z/1914-12-31T23:59:59Z”,

“currentTime”:“1914-08-01T00:00:00Z”,

“multiplier”:140000,

“range”:“LOOP_STOP”,

“step”:“SYSTEM_CLOCK_MULTIPLIER”

}

},

{

“id”:“A.I.F. BURIAL GROUND, FLERS”,

“name”:“A.I.F. BURIAL GROUND, FLERS”,

“availability”:“1914-09-14T00:00:00Z/1914-12-31T23:59:59Z”,

“description”:"\r\n

Testing 1 2 3

",

“model”: {

“scale”:{

“interval”:“1914-09-14T00:00:00Z/1914-10-31T23:59:59Z”,

“number”:[

“1914-09-14T00:00:00Z”,300,

“1914-09-21T23:59:59Z”,500,

“1914-09-28T23:59:59Z”,0

]

},

“gltf”:“column.gltf”

},

“position”:{

“cartographicDegrees”:[

2.83119, 50.05985, 0

]

}

}

]

column.gltf (13.4 KB)

As I suspected, the issue is that the column is actually being drawn entirely below the surface of the earth. You can try changing your 3D model to flip the orientation, so that the origin is the bottom of the column, instead of the top.

Great Scott! :wink: thanks.

Scott et al.,

I have parallax problems, still. I’ve read with interest Scott’s comments about this subject written six months ago in this forum to Alessio Pierluigi Placitell:.

“I took a look at your code sample, and yes, I think it’s the same parallax issue. You create the modelMatrix using a Cartographic that has 0 height, which means 0 meters above the WGS84 ellipsoid. The actual surface of the terrain is above the ellipsoid, so the result is that the model is drawn below the surface… If you increase the height, you should see the sliding effect go away. You can use the sampleTerrain function to calculate the height of the terrain at a given position, and use that height for the model.” This remedy fixed Allessio’s problem.

Hit the nail on the head. Concept understood. My problem has to do with implementing a fix.

As my data is coming to life through CZML, unless I am mistaken Cesium’s sampleTerrain function referred to above does not help me.

I build my simple models in SketchUp and convert them from COLLADA to GLTF. I can move the origin point as I like in SketchUp, and these changes flow through to the Viewer just fine. But this does not address what I believe is the core of my problem – my CZML models are moving in relation to the WGS84 Ellipsoid as opposed to the STK World Terrain Mesh.

I’ve tried setting the STK World Terrain Mesh as the default with no success. Is there another setting with which the elevation of my CZML models will always move in relation to the earth’s surface?

Best to all, erik

Currently, CZML does not have the ability to specify the height reference for objects as being defined relative to terrain instead of the ellipsoid. It’s on the roadmap, however: https://github.com/AnalyticalGraphicsInc/cesium/issues/1045 This may be added to CZML along the way in order to support clampToGround in KML.

In the meantime, one option is to post-process the CZML objects after loading to adjust their height. This discussion has some sample code that may help. I used GeoJson in my example, but the height adjustment code is the same for both, since it happens on the Entities after they are loaded.

https://groups.google.com/d/topic/cesium-dev/VwgC-w_WnPE/discussion

Another possibility, if you can write more sophisticated code when creating your CZML file, is to compute the appropriate height values up front and send them down in the CZML instead of using height zero.