CesiumGS / 3d-tiles-tools

Apache License 2.0
289 stars 43 forks source link

The merged 3dtileset can't be used #145

Closed Zhouy-zy closed 1 month ago

Zhouy-zy commented 1 month ago

Hello developers! I took a very large scene in Realitycapture and exported them separately as Cesium 3dtiles, and then I used the merge command of 3d-tiles-tools to merge the two blocks. Then I use CesiumJs to load them, the strange thing is that the console does not report an error, but the model is not successfully loaded, but switching to the original single model can be successfully loaded, what is the reason for this?

屏幕截图 2024-07-24 135538
javagl commented 1 month ago

Without any error messages or further details, it's hard to say what might be the problem here.

(There is a pending PR for the merge command at https://github.com/CesiumGS/3d-tiles-tools/pull/143 , but this should be unrelated: The PR mainly affects the mergeJson command).

Can you post the tileset.json (and only that JSON file) that was generated as the output? (Note that this tileset.json should not contain any "confidential" information - it should just be a small wrapper that refers to two other tilesets)

Zhouy-zy commented 1 month ago

tileset.json tileset_lugulake-38.json [Uploading tileset_lugulake-37.json…]() These are the json files I created and used, and I don't think there should be anything wrong with them, at least I didn't find them. Thank you for your help

  var palaceTileset = new Cesium.Cesium3DTileset({
        //url: './merge/tileset.json'
        // url: './merge/37/tileset_lugulake-37.json'
        });
          
        var longitude = 100.75840910;
        var latitude = 27.54129280;
        // height = 4454.9;
        height = 3500;
        var heading = 2;
        console.log('=================================1');
        palaceTileset.readyPromise.then(function(argument) {
              var position = Cesium.Cartesian3.fromDegrees(longitude, latitude, height);
              var mat = Cesium.Transforms.eastNorthUpToFixedFrame(position);
              var rotationX = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(heading)));
              Cesium.Matrix4.multiply(mat, rotationX, mat);
              palaceTileset._root.transform = mat;
        })
          
        viewer.scene.primitives.add(palaceTileset); 
        viewer.zoomTo(palaceTileset);

This is the API I use for loading,'./merge/37/tileset_lugulake-37.json' is exported from Reality capture,And it was able to load successfully,But './merge/tileset.json' can‘t be use

(Edited for formatting)

Zhouy-zy commented 1 month ago

I used the new loading API and now the model is able to load successfully, thanks

javagl commented 1 month ago

From that comment, I assume that you changed the part

var palaceTileset = new Cesium.Cesium3DTileset({
  url: './merge/tileset.json'
});

to something like

const palaceTileset = await Cesium.Cesium3DTileset.fromUrl(
    "./merge/tileset.json"
);

This reflects a change in the API that was introduced in version 1.107.

(It's not entirely clear why the old approach should have worked with one tileset but not the other, but I assume that the issue is resolved now in any case...)