I am part of a team trying to place some georeferenced Wavefront OBJ files (converted to 3D Tiles), in Cesium, on their precise locations. Our approach doesn’t seem to place the 3D object on its exact position and hence, would like to get some comments / suggestions on that.
The OBJ files are georeferenced using EPSG:7855. By georeferenced, I mean that the vertices (X, Y, Z) for an object are composed of its georeferenced (Easting, Northing, Height) values. We chose a case study building footprint and created a simple 3D geometry that depicts a building constructed on that site. The following image shows the building footprint we chose for our case study and the corresponding 3D object that we constructed. The (X, Y, Z) for some of the visible vertices are shown as well.
The OBJ file is converted to 3D Tiles and the origin for the tileset is chosen to be one of the points on the object. i.e.,
- the Easting / Northing of a selected vertex is converted to WGS84.
- The resulting Longitude / Latitude is used as the origin for the tileset.
However, using this approach, the tileset seems to be offset from the actual position when viewed in Cesium. The following screenshots show the offset that occurred when using each of the four ground-level (bottom) vertices as the origin. OSM background imagery is used in this case.
I am looking for the potential reasons why the 3D Tiles is not placed on the intended building footprint. I kindly welcome any comments on the approach that is used. Also, I would like to know whether at all, it is possible to place such georeferenced OBJ files, as 3D Tiles, precisely on the map using the coordinates information present in the OBJ files.
normally, the 3D objects (glTF in case of 3D Tiles) do not contain any georeferenced coordinates. Position/rotation/scale of the objects is defined in tileset.json
Yes, I agree with you. As I mentioned in my post, the origin for the tileset (and not the glTF) is chosen to be one of the (ground-level / bottom) points on the 3D object - By this I meant that, one of the points on the 3D object is used for the position (translation) component of the root transform matrix in tileset.json.
ok I did something similar see https://bertt.github.io/cesium_3dtiles_samples/samples/street/
I’ve calculated the centroid point of all buildings for the root.transform, the transform per b3dm tile contains the relative position.
Was this 3D Tiles generated from a georeferenced Wavefront OBJ file? Also, can you please clarify whether the 3D Tiles, in your link, is placed on it’s exact geographical location? Because, some buildings seem to be located in the middle of a road.
these models come from IFC, it’s just a demo for a new construction site. One thing to check: the 3D model origin (0,0,0) is used when placing it (using the tile transform). The origin can be visualised by making the BoundingVolume small (for example 1, I’ve used 10 in the demo).
@smonikantara how are you converting the OBJ to 3D Tiles in this case?
@omar The OBJ is converted to glTF using obj2gltf. The generated glTF is converted to 3D Tiles using the 3D Tiles Samples Generator (with some customisations). While converting from glTF to 3D Tiles, the origin for the 3D Tiles is set as one of the points on that object (as described in my post. i.e., we take the georeferenced vertex from OBJ, convert that vertex from EPSG:7855 to WGS84 and use the WGS84 lon/lat as the 3D Tiles origin in the Samples Generator).
I think this approach in principle should work. Another approach you can try is to normalize your model coordinates about (0, 0, 0), but keep track of where that origin should be on the globe, and pass that origin to Cesium ion when tiling: Support tiling georeferenced 3D models into 3D Tiles.
Thank you for the suggestion and the link. I’ll give this a try.
Hi @smonikantara , may I ask if this approach worked well?