NASA-AMMOS / 3DTilesRendererJS

Renderer for 3D Tiles in Javascript using three.js
https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/mars.html
Apache License 2.0
1.63k stars 290 forks source link

I am not able to find my 3dModel in 3d space... #333

Closed undefinedSolutions closed 1 year ago

undefinedSolutions commented 1 year ago

I know this sounds stupid but I am not able to find my 3dModel in 3d space...

I am working to switch from three-loader-3dtiles to this project.

I am not able to find my 3d Model, with position i only get {x: 0, y: 0, z: 0} and there are no children.

When I load the tileset.json from example/mars.js and place the camera manually I see the model but with my own models it does not work. For [example](https://undefined-solutions.de/Schlosskirche/tileset.json generated) I host my own generated with Agisoft.

My Code looks like with (within an angular application):

load3DTileset() {
  const dracoLoader = new DRACOLoader();
  dracoLoader.setDecoderPath( 'https://unpkg.com/three@0.123.0/examples/js/libs/draco/gltf/' );
  this.tilesRenderer = new TilesRenderer( 'https://undefined-solutions.de/Schlosskirche/tileset.json' );
  const loader = new GLTFLoader( this.tilesRenderer.manager );
  loader.setDRACOLoader( dracoLoader );

  this.tilesRenderer.manager.addHandler( /\.gltf$/, loader );
  this.tilesRenderer.fetchOptions.mode = 'cors';
  this.scene.add( this.tilesRenderer.group );
}

and within the renderer:

if (this.tilesRenderer) {
  this.tilesRenderer.setCamera( this.camera );
  this.tilesRenderer.setResolutionFromRenderer( this.camera, this.renderer );

  this.tilesRenderer.errorTarget = 12;
  this.tilesRenderer.displayBoxBounds = true;
  this.tilesRenderer.update();
}
//renderer.render( scene, camera );
this.renderer.render(this.scene, this.camera);
requestAnimationFrame(this.renderingLoop.bind(this));
gkjohnson commented 1 year ago

Are there any errors in the console? Otherwise you can retrieve the tileset bounds using the "getBounds" or "getBoundingSphere" functions. I'm able to see the tileset in the following page but there are CORS errors:

https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/#https://undefined-solutions.de/Schlosskirche/tileset.json

image
undefinedSolutions commented 1 year ago

Thank you for your support! I do not get an error, when I load the model. I implement my model for testing directly in the angular app. So my problem is not caused by a CORS problem.

Thanks for the suggestion with getBounds and getBoundingSphere:

console.log(this.tilesRenderer.getBoundingSphere())
setTimeout(() => {
  console.log(this.tilesRenderer.getBoundingSphere())
}, 4000);

But when I use them I get at first a false (because the root is not loaded) and after a setTimout I got this error message:

Screenshot from 2023-05-25 16-48-10

Also an other question, my goal I to create a viewer for the photogrammetry data with all captures images as icons. Is there a way to display the 3DTiles in Web Mercator(EPSG 3857) or an other projection like cesium is offering? In the past I used three-geo as baseMap.

gkjohnson commented 1 year ago

Please read the documentation. The getBoundingSphere function takes an argument.

gkjohnson commented 1 year ago

Is there a way to display the 3DTiles in Web Mercator(EPSG 3857) or an other projection like cesium is offering?

I missed this. If you're looking for other projections you will need a different map. This project is only intended to support the rendering of 3d tiles data.