3D Tiles: ModelMatrix to per-tile transform

Hi All,

I’m struggling to change from a modelMatrix tileset to a per-tile transform tileset.json in 3D Tiles. My tileset comprises a large area and the curvature of the earth makes the model hang over the terrain in areas that are far from the center. I’d like to use a transform for every individual tile to make them stick to the globe better.

My original 3D Tile tileset shows fine in Cesium using this modelTransform:

var center = new Cesium.Cartesian3.fromDegrees(-4.8728231291920547, 36.5093837495992);
var posMat = Cesium.Transforms.eastNorthUpToFixedFrame(center);

this.tileset = this.scene.primitives.add(new Cesium.Cesium3DTileset({
    url: this.options.tileset.url,
    modelMatrix: posMat
}));

Then I’ve reencoded the models to change the coordinates’ origin to the tile center. Finally I tried to generate a tileset.json transform property for each tile with

var cartesian = new Cesium.Cartesian3.fromDegrees(tileCenter.X, tileCenter.Y);
var transform = Cesium.Transforms.eastNorthUpToFixedFrame(cartesian);

but when I load the cesium viewer page the models are nowere to be found. The tileset have only one level and root have no transform property (please see attached tileset.json).

Any Insights of how to craft a per-tile transform for tileset.json that is similar to eastNorthUpToFixedFrame?

Thanks in advance

Alvaro

tileset.json (967 KB)

The tileset.json and transform code looks fine to me. Just to be sure, does tileCenter contain the longitude and latitude in degrees? I’m also wondering about the step where you reencode the tile contents to be at the tile center. Did you do that in conjunction with setting the tile transforms?

Feel free to send the tileset over too.

Hi Sean

I’ve attached a couple of sandcastle examples.

  • In original_sandcastle.js.txt the model coordinates are centered on the root tile bounding volume center (with z = 0). The single b3dm model works flawlessly.
  • In transform_sandcastle.js.txt the model coordinates are centered on the child tile bounding box center (z = 0). This one doesn’t work at all.
    Do see anything strange?

Thanks in advance

Alvaro

3dTiles_transform_per_tile.zip (72.3 KB)

This is what I see when viewing model bounding volumes. The model is drawn where the red sphere is. This tells me that the tile transform needs to be fixed to match the tile’s actual position.

Thanks Sean, that did it. My transformation function was using a wrong
center. I just needed the confirmation that the
Cesium.Transforms.eastNorthUpToFixedFrame function was appropriate in this
case.

Thanks for everything and keep up the great work!

Alvaro

Glad it worked out, Avaro! Best of luck with the rest of your project. :slight_smile:

Cheers,

  • Rachel