nytimes / three-loader-3dtiles

This is a Three.js loader module for handling OGC 3D Tiles, created by Cesium. It currently supports the two main formats, Batched 3D Model (b3dm) - based on glTF Point cloud.
Other
439 stars 62 forks source link

the Problem of resetTransform in Loadoptions #163

Open AHSss opened 2 months ago

AHSss commented 2 months ago

when I used the version1.1.17, the loadoptions had a parameter-geoTransform. I set this parameter to 1, my tileset model can be in 0,0,0. but now I use the version1.2.3 the parameter-geoTransform can't be find,and there is a new parameter-resetTransform. I set this parameter to true,my tileset model can't be find. but when I use the example's model(https://int.nyt.com/data/3dscenes/ONA360/TILESET/0731_FREEMAN_ALLEY_10M_A_36x8K__10K-PN_50P_DB/tileset_tileset.json),it's can also be find in 0,0,0. I can't find the problem.I need u help! @wanyanyan @Avnerus this is my code:

    async loadTileset() {
      const result = await Loader3DTiles.load({
        url: './models/terra_b3dms/tileset.json',
        renderer: this.renderer,
        options: {
          dracoDecoderPath: './draco',
          basisTranscoderPath: './basis',
          maximumMemoryUsage: 4096,
          maximumScreenSpaceError: 1, 
          viewDistanceScale: 1,  
          geoTransform: 1,  
          // resetTransform: true,
        },
      }
      )
      const { model, runtime } = result;
      model.rotation.set(-Math.PI / 2, 0, Math.PI / 2);
      this.tilesRuntime = runtime;
      this.scene.add(model);
    }
Avnerus commented 2 months ago

Hi @AHSss! The library hasn't been tested lately with DJI Terra exports, so it might be there is a bug in the new resetTransform functionality. If you would like, you could share your scan so I can test it. You could also try calling the Runtime.orientToGeocoord() method with the lat/long of your scan. If the tileset is in WGS84 coordinates, it should transform it so that the scanned location is at (0, 0, 0).

AHSss commented 2 months ago

Tnank you for answering my question.I had try to use runtime.orientToGeocoord(),but it dosen't work. Am I using it wrong?There is my code:

async function loadTileset() {
    const result = await Loader3DTiles.load({
        url: '/models/51jixiao_terra_b3dms/tileset.json',
        renderer: renderer,
        options: {
            dracoDecoderPath: '/draco',
            basisTranscoderPath: '/basis',
            maximumMemoryUsage: 4096,
            maximumScreenSpaceError: 1,  
            viewDistanceScale: 1,  
            resetTransform: true,
        },
    }
    )
    const { model, runtime } = result;
    model.rotation.set(-Math.PI / 2, 0, Math.PI / 2);
    runtime.orientToGeocoord({ height: 0, lat: 0, long: 0 })
    tilesRuntime.value = runtime;
    scene.add(model);
    console.log(model);
}

And this it my scan.It's so large,I compressed the files.And you should change the file's name .z01.zip to .z01 for zip.You can test it for me if you want. Thanks! @Avnerus test_terra_b3dms.zip test_terra_b3dms.z01.zip [Uploading test_terra_b3dms.z02.zip…]() [Uploading test_terra_b3dms.z03.zip…]()

Avnerus commented 2 months ago

in orientToGeocoord you should input the cartographic location of your model. From your tileset.json, I think it might be around {lat: 29.3637161, long: 106.53427913}

AHSss commented 2 months ago

Do you mean like this?

    const { model, runtime } = result;
    model.rotation.set(-Math.PI / 2, 0, Math.PI / 2);
    runtime.orientToGeocoord({ height: 0, lat: 29.3637161, long: 106.53427913 })
    tilesRuntime.value = runtime;

I do this, but still can't see the model. Is there something wrong in my code? And I have tried other versions, only 1.1.17 can see the model with geoTransform set 1. @Avnerus