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?
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?
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 mesh.obj -RASTERIZE -GRID_STEP 1.0 -VERT_DIR 1 -PROJ MAX -EMPTY_FILL INTERP -OUTPUT_RASTER_Z How can I fix this? Is there some argument I also need to add? 2. Is it possible to also output it as a grayscale image, the image option gives me a RGB one. If no, what is the best way to convert the tif to something like png (when I open the raster with GIMP, it looks pretty different than with QGIS etc.)?
– Til W. Aug 27 '21 at 16:20CloudCompare -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).
– Atm
Aug 27 '21 at 17:03