Unable to load tileset.json with region boundingVolume but it works with sphere and box

I've been working on loading some b3dms in Cesium with a very small tileset.json. It just loads one b3dm - I can't get it to work with the region type boundingVolume, but it works with the other boundingVolume types.

Here is what my tileset.json looks like:

{"asset":{"version":"0.0"},"geometricError":4.0,"root":{"geometricError":0.0,"content":{"url":"13/2462/3043.b3dm"},"refine":"ADD","boundingVolume":{"region":[-1.2538439062179674,0.7221602769097826,-1.2532806187442638,0.7225792257526676,0.0,7.5]}}}

and here is the code that I'm using to load it in Cesium:

const t = viewer.scene.primitives.add(new Cesium3DTileset({
      url : tilesFolder + "test_gltf/tileset.json",
      debugShowBoundingVolume: true,
      debugShowGeometricError: true,
      debugShowUrl: true,
      debugWireframe: true,
    }));

    t.readyPromise.then(() => {
      var lon = -71.7583;
      var lat = 41.9617;
      var cartographic = Cartographic.fromDegrees(lon, lat, 0.0);
      var positions = [cartographic];
      sampleTerrainMostDetailed(viewer.terrainProvider, positions).then(() => {
        var cartesian = Cartographic.toCartesian(cartographic);
        var transform = Transforms.headingPitchRollToFixedFrame(cartesian, new HeadingPitchRoll());
        t._root.transform = transform;
        viewer.zoomTo(t);
      });
    }).otherwise((error) => {
      console.log(error);
    });

I'm hoping to scale this up to use it for dynamic tileset.json generation as part of an osm->3dtiles pipeline, so any hints on doing that would be really helpful as well.

Thanks!

Hey Alexander,

An OSM -> 3D Tiles pipeline sounds pretty cool! Depending on how you’re processing the data, 3D Tiles does have an experimental vector format that might be useful, here’s an example of it:

For your tileset, I don’t see anything wrong with it at a glance. When you say “it doesn’t work”, do you mean it’s throwing an error? If so what’s the error? If not, is it just showing up in the wrong location? With the region, you just have to make sure that your transform is actually putting it inside the bounds defined by the region. You might find the 3D Tiles inspector useful for debugging:

Let me know how it goes! Are you developing this as an open source tool?

Hi Omar,

Thanks for the response. I'll definitely be keeping my eye on the vector format, but right now it's not exactly what I need. Basically, my project extrudes the OSM foot prints based on some of the OSM attribution like height, color, roof type, etc. and then converts it into glb with the vertices relative to some lat/lon origin. I've been trying to work out getting b3dms written out, but I'm still running into some issues there, so, for now I'm just processing them through the glbToB3dm tool.

It wasn't throwing any errors, but it wasn't showing up in the region I thought it would show up in. I didn't really understand how boundingVolumes worked and thought that it would define the origin point for my b3dm, but I don't think that's the case. Do I have to come up with a transformation matrix that translates my lat/lon origin to ECEF? If that's the case, my linear algebra skills are pretty rusty and I haven't been able to figure out how to do that... Can you recommend any resources on creating this transformation?

To get around that, I thought I'd just use bounding spheres instead, but now I'm realizing that I'm not really sure how geometricError works because the models are only showing up at a very specific distance interval from the camera (I'm just using 128 for the root and 64 for the children).

I'm also getting a "DeveloperError: Expected sizeInBytes to be greater than 0, actual value was 0" coming from the createVertexBuffer function. I assume is a problem with how I'm writing out the b3dm, but let me know if you think it could be something else.

And yes, I'd like to develop it as an open source tool once I have a better handle on the entire 3D tiles pipeline!

Alex

Thanks for the extra details and explanation Alex! This sounds like a good approach.

You are correct that the boundingVolumes do not define an origin or transform the tileset in any way. It’s simply a way to mark where the tileset lives, so that engines can do things like only request the tiles when the tileset is in view.

For setting up the matrices, CesiumJS has a bunch of helper functions that could be useful here. This post describes my workflow of using CesiumJS to output the right transform and some sample code:

https://groups.google.com/d/msg/cesium-dev/0K_RXY0gIM4/7oOusxzBAwAJ

For geometric error, the best resource I can give you is the spec’s take on t:

I haven’t implemented it myself so I’m not aware of all the nuances. But one thing you could do to keep moving forward is once you’ve extruded the OSM data is to upload it to cesium ion just to be able to test how it should all look.

Feel free to keep updating this thread with progress!