Question

Georeferenced glTF/glb

  • 14 May 2024
  • 5 replies
  • 107 views

Badge +5

I want to create a glTF/glb mesh georeferenced, these are my parameters into the writer.

Even though, the .prj file has the coordinate system tipe, they don't display the model georeferenced, any suggestion? Thanks in advance


5 replies

Userlevel 3
Badge +17

Hi @edwin_medina,

What application are you using the view the output glTF file in? Does this application support the use of PRJ files to georeference the data?

Userlevel 5
Badge +32

So a couple of things to note here:

  1. The vertex storage of gltf data (and a lot of 3D formats) is float 32 - this means that the format itself done not contain the required precision to store the geometry/vertices in a projected way. For mm precision coordinates you can only have values in the range ∓ 32768. Anything above that and you’ll start to lose precision. Coordinate systems can often have values in the millions of meters.
  2. In order to have a GLTF file keep it’s precision at large coordinates you can create a transformation matrix. The matrix will be applied to the meshes in the file but keep the actual coordinates low. You can achieve this in FME by using an Offsetter transformer - the matrix applied by FME will be added into the GLTF file (small snippet below). 
     
    	"nodes" : [
    {
    "matrix" : [ 1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 12344325.1234567, 0, -12344325.1234567, 1 ],
    "mesh" : 0
    }

     

  3. Here you can see that a transformation matrix has not actually been applied to the data itself.

     

  4. The next thing to note is related to what @daveatsafe mentioned which is that GLTF does not have a concept of coordinate systems. FME here creates a prj file which contains the coordinate system definition but this is outside of the files and I don’t actually know of any platforms which support the .prj file in the context of GLTF.  

 

Perhaps you can elaborate on how you are trying to work with georeferenced gltf files?

Badge +5

Hi @edwin_medina,

What application are you using the view the output glTF file in? Does this application support the use of PRJ files to georeference the data?

Hi @daveatsafe, I´m using CESIUM ion

Badge +5

So a couple of things to note here:

  1. The vertex storage of gltf data (and a lot of 3D formats) is float 32 - this means that the format itself done not contain the required precision to store the geometry/vertices in a projected way. For mm precision coordinates you can only have values in the range ∓ 32768. Anything above that and you’ll start to lose precision. Coordinate systems can often have values in the millions of meters.
  2. In order to have a GLTF file keep it’s precision at large coordinates you can create a transformation matrix. The matrix will be applied to the meshes in the file but keep the actual coordinates low. You can achieve this in FME by using an Offsetter transformer - the matrix applied by FME will be added into the GLTF file (small snippet below). 
     
    	"nodes" : [
    {
    "matrix" : [ 1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 12344325.1234567, 0, -12344325.1234567, 1 ],
    "mesh" : 0
    }

     

  3. Here you can see that a transformation matrix has not actually been applied to the data itself.

     

  4. The next thing to note is related to what @daveatsafe mentioned which is that GLTF does not have a concept of coordinate systems. FME here creates a prj file which contains the coordinate system definition but this is outside of the files and I don’t actually know of any platforms which support the .prj file in the context of GLTF.  

 

Perhaps you can elaborate on how you are trying to work with georeferenced gltf files?

Hi @virtualcitymatt t, I’m trying to create georeferenced high-definition meshes for display on my own server. Previously, I tried the 3D Tiles transformer, but it didn’t work very well. Now, I’m looking for another 3D format to achieve my objective.

Userlevel 5
Badge +32

Hmm, if you're working with cesium ion then depending on the model you should be able to upload a gltf/glb. But in this case if you want cesium to do the tiling then it needs to be in a local coordinate system (not projected).

https://cesium.com/learn/3d-tiling/ion-tile-3d-models/

Depending on the size/extent of the model the georefererencing might not work so well. I'm also not familiar with how their tiling pipeline works

Reply