Recommendation for creating custom 3d tiling pipeline.

I would like to use Cesium’s tiling system to display cubes. For each cube, I have the vertex data, as follows:

{
“Base Bottom Left”: {
“Altitude”: 842.3900146484375,
“Latitude”: 51.01717268977731,
“Longitude”: -119.12696444693704
},
“Base Bottom Right”: {
“Altitude”: 842.2650146484375,
“Latitude”: 51.0232887823192,
“Longitude”: -119.08631118566916
},
“Base Top Left”: {
“Altitude”: 842.3900146484375,
“Latitude”: 51.04274271426591,
“Longitude”: -119.1367000176318
},
“Base Top Right”: {
“Altitude”: 842.2650146484375,
“Latitude”: 51.04886083640669,
“Longitude”: -119.09602982055007
},
“Top Bottom Left”: {
“Altitude”: 1087.3486328125,
“Latitude”: 51.01717268977731,
“Longitude”: -119.12696444693704
},
“Top Bottom Right”: {
“Altitude”: 1087.2236328125,
“Latitude”: 51.0232887823192,
“Longitude”: -119.08631118566916
},
“Top Top Left”: {
“Altitude”: 1087.3486328125,
“Latitude”: 51.04274271426591,
“Longitude”: -119.1367000176318
},
“Top Top Right”: {
“Altitude”: 1087.3486328125,
“Latitude”: 51.04886083640669,
“Longitude”: -119.09602982055007
}
}

``

What would be the most efficient method of converting this to a B3DM file?

I think the easiest thing might be to create one or more glTF files out of this, then you can upload that to Cesium ion (https://cesium.com/ion/) to get a 3D Tileset.

You can see a link to the glTF specification as well as sample models here:

https://github.com/KhronosGroup/glTF

This sample cube is probably a good start:

https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/Cube

I can generate the mesh, but how do I add the location data so the .B3DM file has the right location?

The way b3dm models are positioned on the globe is using the RTC_Center:

https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/specification/TileFormats/Batched3DModel/README.md#global-semantics

That way, the model vertices are in a local coordinate, and the RTC_center moves it the right place on the globe. If you’re using Cesium ion, I think what you can do is generate the glTF all around some center coordinate, then tile it on ion, so all the boxes are in the right position relative to each other, then use the “Adjust Tileset” tool to move the center of the tileset to the right location on the globe.

Does that work for you?