0

I have an OBJ file along with a corresponding MTL and several PNG textures. I use meshlab to open it. This mesh file downloaded from free3d does not specify the texture PNG files in the MTL. So I added it on my own like this:

map_Kd [texture_file_name.png]

Since there are multiple textures, I added two lines of map_Kd in two different places. However, I found that if I only use one of the two (whichever) map_Kd commands, meshlab opens the file alright. But if I use two simultaneously, meshlab crashes on start-up.

I tried running it in terminal, it shows the following:

  • Correctly opened (only one map_Kd):
user@computer:~/data/Bikes2/obj_with_text/3/OBJ$ meshlab Sepeda\ Facific\ Invert.obj 
Qt: Session management error: Could not open network socket
Current Plugins Dir is: /snap/meshlab/36/usr/lib/meshlab/plugins 
Shader directory found '/snap/meshlab/36/usr/share/meshlab/shaders', and it contains 19 gdp files
Mesh is Polygonal!
libpng warning: iCCP: known incorrect sRGB profile
LOG: 0 Opened mesh Sepeda Facific Invert.obj in 519 msec
LOG: 0 All files opened in 521 msec
libpng warning: iCCP: known incorrect sRGB profile
  • Crashes on start-up (two map_Kd commands):
user@computer:~/data/Bikes2/obj_with_text/3/OBJ$ meshlab Sepeda\ Facific\ Invert.obj 
Qt: Session management error: Could not open network socket
Current Plugins Dir is: /snap/meshlab/36/usr/lib/meshlab/plugins 
Shader directory found '/snap/meshlab/36/usr/share/meshlab/shaders', and it contains 19 gdp files
Mesh is Polygonal!
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
Segmentation fault (core dumped)

Does anyone know why? Is it a meshlab bug or am I doing something wrong?

I am using Ubuntu20.04 with Meshlab_64bit_fp v2020.12 installed from Ubuntu software center if it matters.


Update 1: Meshlab_64bit_fp v2020.03 on Windows 10 behaves the same.


Update 2:

To make it reproducible, I post my MTL file below. The two map_Kd commands I added are at line 184 (under newmtl col_rangka_wadah_perr) and the last line respectively.

# Blender MTL File: 'Sepeda Facific Invert.blend'
# Material Count: 29

newmtl Material
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl Material.002
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl Material.003
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl Material.004
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl Material.005
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl Material.006
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl Material.007
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl None
Ns 0.000000
Ka 0.000000 0.000000 0.000000
Kd 0.800000 0.800000 0.800000
Ks 0.800000 0.800000 0.800000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl ban_luar.001
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.064007 0.064007 0.064007
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl col_ban
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl col_casing_hp
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl col_jari2
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl col_lantai
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl col_master_btl
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl col_pegangan_stank
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl col_pelek
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl col_rangka_per_sepeda
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2


newmtl col_rangka_wadah_perr
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
#map_Kd uv_rangka.png

newmtl col_uv_btl
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl dominan.001
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl gear.001
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl guma.001
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.301176 0.301176 0.301176
Ks 0.447059 0.447059 0.447059
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl skp_front_defaul.001
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.447059 0.447059 0.447059
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl steel_whiter.001
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.589804 0.589804 0.589804
Ks 0.447059 0.447059 0.447059
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl uv_ban_kanan
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl uv_ban_kiri
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl uv_hp
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl uv_pelek_kanan
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl uv_pelek_kiri
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd uv_pelek_kiri.png
ihdv
  • 1,927
  • 2
  • 13
  • 29
  • Hi, this seems more appropriate for the developers of meshlab, not for users. Please, report it as a bug in the meshlab github page. Anyway, I will try to reproduce your problem. I have used files with multiple textures with meshlab in the past. – Rockcat Dec 03 '20 at 07:38
  • @Rockcat Thank you. Since I am a beginner with 3d graphics, I am not sure if it is a bug yet. So I'd like to make sure before asking the developers. – ihdv Dec 03 '20 at 07:42
  • @Rockcat I posted my version of the MTL file, if it helps to reproduce the problem. – ihdv Dec 03 '20 at 07:54
  • @Rockcat One more question, I just found that when I only use one png file, even though the program opens correctly, but the texture mapping seems to be wrong. I guess there is something wrong with my MTL file? – ihdv Dec 03 '20 at 08:23

1 Answers1

1

Can confirm that this seems to be a bug in meshlab OBJ importer.

I have managed a workaround using the batch meshlabserver program.

  1. I edited the mtl file to add several textures using map_Kd filename.png lines, same way that you did.
  2. Convert the file using the command line:

meshlabserver -i Sepeda\ Facific\ Invert.obj -o fixed.obj -m wt

and got a file which meshlab can load properly: enter image description here

Rockcat
  • 3,002
  • 2
  • 14
  • 28
  • Thanks! this works for me. But what exactly happened with this line of code? Also, I wanted to export the textures into one file after importing it, but meshlab export options don't seem to include this function. I asked a separate question here: https://stackoverflow.com/questions/65125378/a-tool-to-combine-multiple-textures-of-a-3d-model-into-one. Hopefully you can take a look (if you have the time, of course). Thanks again! – ihdv Dec 04 '20 at 06:48