introlab / rtabmap

RTAB-Map library and standalone application
https://introlab.github.io/rtabmap
Other
2.75k stars 785 forks source link

Export of obj mesh files does not properly export textures. #500

Open marsfan opened 4 years ago

marsfan commented 4 years ago

When exporting obj mesh files to my project, the file path for the associated .mtl files is incorrect, it improperly refers to them being in a sub-directory relative to the .obj files, but they are actually in the same directory.

For an example, in my project, I have the project directory (project). Within that directory is the main database file. Also within that directory is a directory titled meshes, where my exported meshes are stored. When I tell RTABMap to export the as .obj files to the meshes directory, it saves the .obj files, the .mtl files, and the .jpg files to the meshes directory. However, the .obj files internally state that the .mtl files are in a directory within the meshes directory, also called meshes.

Here is an example of the start of the file

####
# OBJ dataFile simple version. File name: D:/Desktop/project/meshes\mesh100.obj
# Vertices: 57934
# Faces: 77566
# Material information:
mtllib meshes\mesh100.mtl
####

when in reality the second to last line should read

mtllib mesh100.mtl

This results in certain programs (MeshLab in my case), from being able to properly display the textures, and defaulting to displaying a white material, as opposed to the RGB textures.

matlabbe commented 4 years ago

I cannot reproduce the problem, there is no prefix in obj file.

####
# OBJ dataFile simple version. File name: /home/mathieu/Documents/RTAB-Map/meshes/mesh.obj
# Vertices: 75921
# Faces: 116781
# Material information:
mtllib mesh.mtl
####

Which RTAB-Map version do you use? Are you exporting from RTAB-Map->File->Export 3D clouds... ?