0

我有一个 OBJ 文件以及相应的 MTL 和几个 PNG 纹理。我用meshlab打开它。这个从 free3d 下载的网格文件没有在 MTL 中指定纹理 PNG 文件。所以我像这样自己添加了它:

map_Kd [texture_file_name.png]

由于有多个纹理,我map_Kd在两个不同的地方添加了两条线。但是,我发现如果我只使用两个(无论哪个)map_Kd命令中的一个,meshlab 就可以打开文件。但是如果我同时使用两个,meshlab 在启动时会崩溃。

我尝试在终端中运行它,它显示以下内容:

  • 正确打开(只有一个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
  • 启动时崩溃(两个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
libpng warning: iCCP: known incorrect sRGB profile
Segmentation fault (core dumped)

有谁知道为什么?是meshlab错误还是我做错了什么?

如果重要的话,我正在使用 Ubuntu20.04 和从 Ubuntu 软件中心安装的 Meshlab_64bit_fp v2020.12。


更新 1: Windows 10 上的 Meshlab_64bit_fp v2020.03 的行为相同。


更新 2:

为了使其可重现,我在下面发布了我的 MTL 文件。我添加的两个map_Kd命令分别位于第 184 行(下newmtl col_rangka_wadah_perr)和最后一行。

# 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
4

1 回答 1

1

可以确认这似乎是 meshlab OBJ 导入器中的错误。

我已经使用批处理 meshlabserver 程序管理了一个解决方法。

  1. 我编辑了 mtl 文件以使用 map_Kd filename.png 行添加几个纹理,就像你做的那样。
  2. 使用命令行转换文件:

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

并得到了一个 meshlab 可以正确加载的文件: 在此处输入图像描述

于 2020-12-03T13:41:04.937 回答