-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello developer, I would like to ask a question about the location of tiles #120
Comments
this is my tiles file |
This is not really an issue of the However, I did have a short look at the tileset that you provided. And I have to add a disclaimer here: I have to make a few guesses, due to the lack of technical background information. But the problem is very likely caused by the fact that the tileset has a structure that is ... not ideal for "runtime manipulations". The tileset consists of a single root node/tile. And it has several child tiles. (Each child tile refers to one B3DM file). The child tiles do have a I tried to illustrate this here: The question now is: How can this be solved? And there is probably no easy, one-fits-all solution. But for the specific tileset that you attached, there may be a way to accomplish the desired goal. Since the structure of the tileset is very simple, you can easily create a new one that has a structure that makes this kind of manipulation easier. You can use the This tileset will be located at the origin. This means that it will not include any tile
The following is a sandcastle that shows how this can be done: const viewer = new Cesium.Viewer("cesiumContainer");
const tileset = viewer.scene.primitives.add(
await Cesium.Cesium3DTileset.fromUrl(
"http://localhost:8003/tileset-new.json", {
debugShowBoundingVolume: true,
})
);
// Move the tileset to a certain position on the globe
const transform = Cesium.Transforms.eastNorthUpToFixedFrame(
Cesium.Cartesian3.fromDegrees(-75.152408, 39.946975, 20)
);
const scale = 1.0;
const modelMatrix = Cesium.Matrix4.multiplyByUniformScale(
transform,
scale,
new Cesium.Matrix4()
);
tileset.modelMatrix = modelMatrix;
// Zoom to the tileset, with a small offset so that
// it is fully visible
const offset = new Cesium.HeadingPitchRange(
Cesium.Math.toRadians(-22.5),
Cesium.Math.toRadians(-22.5),
560.0
);
viewer.zoomTo(tileset, offset); The result will be the tileset, rendered at the given cartographic position: |
Thank you for your reply! I think I will listen carefully to your suggestions. For the issue of correcting the position of tiles, I think the root cause of the problem may be the inconsistency of the coordinate axes applied when creating the tile set. I will study this and would like to know if you have any good suggestions? Thank you! |
I assume that refers to the question of which axis is the 'up' axis. And yes, this can be confusing. Every tool and every 3D format has its own convention. For example, glTF (which is contained in B3DM) defines the Y-axis as 'up' (at least, in version 2.0). In 3D Tiles, the Z-axis is the 'up' axis. And there are further details of the conventions that may cause confusion. Some of that is summarized at https://github.com/CesiumGS/3d-tiles/tree/main/specification#y-up-to-z-up , but ... regardless of how clearly it is specified, it will always lead to bugs. However, in the level of the tileset itself, changing the 'rotation' could be simple. In a CesiumJS Sandcastle, you can set the Do you happen to know which tool was used for creating this tileset? |
The screenshot that you showed already seems to be from the |
Sorry, I didn't use the createTilesetJson command to perform a tileset.json update. I just added a matrix for the root node on top of the original tileset.json, and didn't do anything else. So, I'm curious why adding a matrix allows me to rotate and transform it as a whole. Here is the modified JSON |
I see. I was confused by the screenshot: It shows a
In general, you have to be a bit careful when "manually" editing a tileset JSON file: It can easily happen that the tileset becomes "inconsistent" in terms of the bounding volumes and transforms. In this case, adding a But two things are still raising some questions:
I assume that you are using https://github.com/NASA-AMMOS/3DTilesRendererJS for rendering the tileset, is that correct? (Maybe I'll have a short look at this, and what |
I'm very sorry, I forgot something. After adding the matrix to tileset.json, I don't need to manipulate the position of the model in the scene. I just need to modify the newly added matrix to change the position of the model at will. Therefore, the previous rotateX is no longer used (if it is necessary to use it, there will still be a problem of position confusion). I do use 3dtilesrenderjs, which makes it easy for me to load tiles in Threejs. Thank you for your reply! |
this is the situation where I directly loaded tiles without making any modifications:
you can see that the position of the building is vertical.Here is a demonstration of my model after making positional changes in the code:
You can see that the positions of some subcomponents have been misplaced,How can I perform the correct position transformation of tiles?Thank you!
The text was updated successfully, but these errors were encountered: