In Ion, I have created one 3D Tiles asset (lets call it Asset A), which contains two GLTF source files File 1 and File 2. In reality the Asset A also contains other files, but it contains at least files 1 and 2.
I have also created two other 3D Tiles assets, which each contain only one of the same files.
So I have three assets, which contain these files:
- Asset A: File 1 + File 2
- Asset B: File 1
- Asset C: File 2
I have not set a location for any of the assets in Ion.
VIEWER 1: When I open the hello world example for Asset A, the models from files 1 and 2 seem to be aligned correctly in relation to each other. The asset is loaded like this:
var viewer = new Cesium.Viewer('cesiumContainer');
var tileset = viewer.scene.primitives.add(
modelMatrix: Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(0, 0))
VIEWER 2: In a separate hello world example, when I open Asset B and C in the same way, meaning I call
viewer.scene.primitives.add( ... .fromAssetId() ...) twice, with the Asset B and C IDs, the assets are both rendered BUT the assets are aligned differently in relation to each other than in VIEWER 1.
What am I missing here? Why are the source files/models rendered in different positions in VIEWER 1 and VIEWER 2?
Do all assets have the same options selected when you uploaded them to Cesium ion? If so, what were the upload options? (Were they tiled as
3D Model or as
3D Capture etc.?)
It’s possible you’re running into this issue where Cesium ion will create a new origin to normalize your geometry:
All assets have been uploaded with the same settings, “3D Model (tile as 3D Tiles)”. Files are GLTF models generated from IFC by IfcConvert -> DAE -> COLLADA2GLTF -> GLTF.
The original issue was with real life IFC models of a building.
But here is a simplified example with SampleHouse.ifc and SampleHouseExtension.ifc from here: https://github.com/xBimTeam/XbimSamples/tree/master/BasicCreate
VIEWER 3 Both SampleHouse files in a single asset:
(… continued in next message because I am not allowed to put two images in one post …)
VIEWER 4 SampleHouse files as two assets with a single file in them:
I don’t know if that VIEWER 3 is even how it is intended, because it is not aligned, but anyways it is different than VIEWER 4. Why?
PS I have no idea what I am doing.
This is happening because Cesium ion will normalize the model geometry during tiling. When you upload both models together they retain their relative positioning when this new origin is computed.
I am confused.
Uploaded models must be in local coordinates and upon uploading Cesium Ion will somehow fiddle with those coordinates.
So is there any supported way of rendering two assets which have been aligned in the local coordinates? eg that house + extension OR eg some model of walls + model of pipes + model of whatever.
Is there documentation about what the “normalization” means?
I agree that this is confusing. We have this GitHub issue open to improve this process: https://github.com/CesiumGS/cesium-ion-community/issues/282.
In the meantime what you’d need to do to get these two assets to show up in the correct position as separate assets is to use the REST API, which allows you to pass in a longitude/latitude/height. If you pass in the same lon/lat point for both assets, they should retain their relative positioning.