1

I am trying to convert thousands of .obj + .mtl models of ShapeNet to .ply format. However, as this dataset contains thousands of models, manually converting them is not the best solution. I've already tried many different solution such as using ctmconv or assimp, but they all fail as to best of my understanding they cannot convert mtl to vertex color.

You can find two example of the model here. Is there any efficient way to do this?

rici
  • 234,347
  • 28
  • 237
  • 341
csuo
  • 820
  • 3
  • 16
  • 31
  • in 3D scanner obj files the vertex color is usually not stored in `mtl` but `obj` file itself. For other models the `mtl` lighting coefficients can give you color ... so if your tools does not do it correctly write your own one that does it as should ... see [How do I sort the texture positions based on the texture indices given in a Wavefront (.obj) file?](https://stackoverflow.com/a/51722009/2521214) for some ideas ... – Spektre Mar 12 '19 at 10:41
  • @csuo Were you able to do this in some way ? I also want to achieve the same thing but could not find any script which can do it – mascot Mar 07 '20 at 10:01
  • @mascot, finally I tried in Blender, I merged all the meshes and export them with the format that I wanted. However, you should be careful with the textures, if you need them. – csuo Mar 10 '20 at 13:54
  • @csuo Were you able to get the vertex colors also ? I imported my obj file in blender (mtl file was also loaded), when I export it to .ply format. It does not give me vertex colors; only x,y,z coordinates and faces – mascot Mar 13 '20 at 13:25
  • @mascot, that is what I tried to mention. It is not straight forward, but I think that is more about learning how to export mtl to vertex color in Blender. Some tutorials can be already found in this matter, but as the vertex color was not my main objective, I did not spend much time on it. – csuo Mar 13 '20 at 15:46

1 Answers1

1

Use meshlabserver, the command-line version of meshlab included in the same package. The command you want to use is:

meshlabserver -i inputFilename.obj -o outputFilename.ply

if you want to ensure that color-per-vertex is generated even if it is not present in the mtl file (because you have a color-per-material schema), just add the -m vc option at the end of the command.

Rockcat
  • 3,002
  • 2
  • 14
  • 28