Git Product home page Git Product logo

Comments (3)

gkjohnson avatar gkjohnson commented on June 4, 2024

The model is visible and loadable in the main "kitchen sink" example in the project:

image

The file is very far offset center because it looks as thought it's designed for use on the surface of a globe tile set. If you'd like to center the model at the origin you'll have to center it based on the bounding boxes (see the example page).

Also see #395 for related discussions.

from 3dtilesrendererjs.

lanvada avatar lanvada commented on June 4, 2024

The model is visible and loadable in the main "kitchen sink" example in the project:

image The file is very far offset center because it looks as thought it's designed for use on the surface of a globe tile set. If you'd like to center the model at the origin you'll have to center it based on the bounding boxes (see [the example page](https://github.com/NASA-AMMOS/3DTilesRendererJS/blob/1ce1070f38dfa3dc0e87f7d93343bf66924dbeab/example/index.js#L540-L551)).

Also see #395 for related discussions.

Thank you for your prompt response and for pointing me towards the example page and issue #395 for guidance on centering the model.
I attempted to center the model at the origin by calculating the bounding box as suggested. However, I seem to be running into an issue extracting the correct values for the bounding box. Here's the TypeScript code snippet I used:

const box = new THREE.Box3();
const sphere = new THREE.Sphere();

// Attempt to update tiles center
if (tilesRenderer.getBoundingBox(box)) {
  box.getCenter(tilesRenderer.group.position).multiplyScalar(-1);
  tilesRenderer.group.position.multiplyScalar(-1);
} else if (tilesRenderer.getBoundingSphere(sphere)) {
  tilesRenderer.group.position.copy(sphere.center).multiplyScalar(-1);
}

console.debug('Bounding Box:', box);
console.debug('Bounding Sphere:', sphere);

When I run this code, the console output for the bounding box and sphere does not seem to reflect the expected values.
image
Could you provide any insights on what might be going wrong? Is there a specific step or adjustment that I might be missing?
Any further assistance would be greatly appreciated.

Additionally, I've noticed that in Cesium, as well as with the 3D Tiles specification, the position of the tileset can be adjusted by modifying the transform attribute in the root tile node. This feature is quite useful for aligning models in non-geospatial contexts.
In my current usage of 3DTilesRendererJS, I couldn't locate a similar attribute or method that allows for such transformations. The ability to manipulate the root transform directly, or at least to clear any transforms present in the root and other tiles, would be incredibly beneficial for displaying models in a non-geographic space within Three.js.
Do you have plans to incorporate a feature in 3DTilesRendererJS that would allow for adjusting the root tile transform? Or is there an existing approach to reset or clear the transforms in the root and other tiles that I might have overlooked?

I look forward to your thoughts on this matter.

from 3dtilesrendererjs.

gkjohnson avatar gkjohnson commented on June 4, 2024

Could you provide any insights on what might be going wrong? Is there a specific step or adjustment that I might be missing?

Additionally, I've noticed that in Cesium, as well as with the 3D Tiles specification, the position of the tileset can be adjusted by modifying the transform attribute in the root tile node. This feature is quite useful for aligning models in non-geospatial contexts.
In my current usage of 3DTilesRendererJS, I couldn't locate a similar attribute or method that allows for such transformations.

Please read the documentation for the class members and functions you are using instead of just copying the code. The descriptions for the bounding box and bounding sphere functions should answer your question. group is also described in the docs as the container group for the 3d tiles objects.

If you have more specific questions from the documentation I can answer those here but please take a look at the README.

from 3dtilesrendererjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.