I have got about 20000 small 3D models in form of .glb files.
Is there some way to project them onto heightmaps with GDAL or other software?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityI have got about 20000 small 3D models in form of .glb files.
Is there some way to project them onto heightmaps with GDAL or other software?
TL;DR
.glb -> blender -> .obj -> cloudcompare -> .gtif
Be carefull: this method does not handle coordinates.
More details :
There are several ways to do this, but unfortunately I don't know of one that directly turns a .glb file into a heightmap.
In my opinion, the simplest solution is to use the cloudcompare[1,2] software, which is initially designed to process lidar point clouds. CloudCompare can't read directly a .glb file, it is therefore necessary to transform the gld file into a file type readable by the software, like .obj (or .slt).
To turn the glb into an .obj I used blender. Just import the file, then save it as .obj. As you have many objects you can use the blender CLI to make the convertion (see here).
We can then load the obj file into cloudcompare, then transform it into a heightmap. For this 5 steps :
You can also make this steps with the CLI of cloudcompare (see here).
be carfull: this method does not handle coordinates. It will be necessary to reproject the raster.
1 You could do exactly the same thing using paraview or grass gis, but it is less easy to use.
2free softwares.
CloudCompare -O example.obj -EXTRACT_VERTICES
2. CloudCompare -O example.vertices.bin -RASTERIZE -GRID_STEP 1 -OUTPUT_RASTER_Z -EMPTY_FILL INTERP
(the file "example.vertices.bin" is automaticaly created).