CesiumGS / obj2gltf

Convert OBJ assets to glTF
Apache License 2.0
1.7k stars 305 forks source link

chinese file name don't support #182

Open tonyDx opened 5 years ago

tonyDx commented 5 years ago

my mtl file's name is chinese so the obj2gltf can't find this file

lilleyse commented 5 years ago

@tonyDx I created a test model to see if I could find the problem but it seemed to work fine. Does this model work for you?

白盒子.zip

chenzaichun commented 4 years ago

@lilleyse the model you provided is working, but my model not working, the output as following:

/objs/大地形obj文件 # /root/.npm-global/bin/obj2gltf -i 大地形-20200708.obj ENOENT: no such file or directory, open '/objs/大地形obj文件/�ӹ�����-20200708.mtl' Could not read material file at /objs/大地形obj文件/�ӹ�����-20200708.mtl. Attempting to read the material file from within the obj directory instead. ENOENT: no such file or directory, open '/objs/大地形obj文件/�ӹ�����-20200708.mtl' Could not read material file at /objs/大地形obj文件/�ӹ�����-20200708.mtl. Using default material instead.

the file '大地形-20200708.mtl' is present in the same directory.

lilleyse commented 4 years ago

@chenzaichun are you able to share your model? I can help investigate.

chenzaichun commented 4 years ago

The model I used is more that 1G. I think it's encoding issue, for mtl issue, I could use iconv to convert gbk to utf-8, then I convert the mtl to utf-8, the file missing issue could be solved.

iconv -f gbk -t utf-8 xxx.obj -o xxxx-utf8.obj
iconv -f gbk -t utf-8 xxx.mtl -o xxxx-utf8.mtl
# backup the orginal mtl and use the xxx-utf-8.mtl instead
mv xxxx-utf8.mtl xxxx.mtl

I'll find some smaller model if you need.