ka_sc
April 26, 2022, 10:39pm
1
hi,
Similar to this old thread i am trying to read gltf tiles and I cannot get them into WGS84 properly.
opened 10:36PM - 23 Jan 18 UTC
closed 01:36PM - 11 May 18 UTC
Hi,
I'm working on a 3D Tiles exporter and renderer. I'm trying to understan… d the relationship between the `3D Tiles coordinate frame` and the `glTF coordinate frame`, especially in relation to bounding volumes and the gltfUpAxis property.
As an example, lets say we have a box stored in a glTF file with Y as the up axis. Our goal is to create a tileset containing this box. In our tileset, we need to store the bounding volume for the box. My understanding is that the bounding volume needs to be stored in `3D Tiles Frame` (z-up) NOT in `glTF frame` (y-up). So in this case, in our exporter we first compute the glTF files bounds in `glTF frame` and then apply a `glTF to 3D Tiles` transform to get it into `3D Tiles frame`. In the renderer, we then need to apply the opposite of this transform when we read the glTF file to convert it into `3D Tiles frame` at runtime.
I've made the following diagram to illustrate the process of going from `glTF Frame` to `3d Tiles Frame` as I understand it.
![image](https://user-images.githubusercontent.com/6226387/35303363-8fc234d0-0046-11e8-9a7d-f8fb7d363abe.png)
In the diagram, I assume we want to render the box n the given orientation regardless of how we define the coordinate frame. However, there are many configurations for a right handed coordinate system in which Z is up. I've created two examples (A) and (B). Depending on which of these we choose, our `glTF to 3D Tiles` transform will be different. This presents a problem because the tileset generator and renderer need to use the same convention. Based on [this changeset](https://github.com/AnalyticalGraphicsInc/cesium/pull/4962/files), it looks like cesium uses (B) but I don't see this documented in the specification anywhere.
I haven't fully worked this out, but it seems like things would only get more confusing once the options for gltfUpAxis get added to the mix.
Please let me know if I've misunderstood how this works.
I think it would be very useful to add some additional text to the README about these transformations and when they should be applied (both during tileset creation and rendering). I'm assuming this should be applied right after loading the glTF file before applying the Tile.transform property.
Overall, I've found it pretty confusing that `3D Tiles` uses a different frame then the underlying content storage mechanism. It almost feels like each tile or the tileset could specify a `content to tileset` matrix to be used when converting the content into tileset frame.
Thanks for the help!
Cheers,
-Alex
Is there an example somewhere or more explanation? I remember having trouble on the writer site before but unfortunately forgot the details. Using my own gltf reader/writer.
So i apply the node transforms in gltf to the mesh and then rotate to y up and it should work? My tile set doesnt specify a matrix.
Is tileset.modelMatrix identity by default?
ka_sc
April 27, 2022, 12:40am
2
Actually, i am just looking to get the gltf data into WGS84.
it should already be that just with the wrong axes?
So the steps are
glTF node hierarchy transformations
glTF y -up to z -up transform
Any tile format specific transforms.
Batched 3D Model Feature Table may define RTC_CENTER
which is used to translate model vertices.
Instanced 3D Model Feature Table defines per-instance position, normals, and scales. These are used to create per-instance 4x4 affine transform matrices that are applied to each instance.
Tile transform
assuming no tile transform,
ka_sc
April 27, 2022, 10:43am
3
solved in a sandcastle it just stay in gltf axes order