melowntech / workshop

Workshop of Melown 3D stack
10 stars 3 forks source link

vef2vts will core dump if the obj file contains non-numeric usemtl [material name] #23

Open dominoc opened 5 years ago

dominoc commented 5 years ago

If a Wavefront .obj file contains a material name with non-numeric characters e.g. "texture0" ...example snippet of obj file.... tllib 000009_000013-L-1.mtl usemtl texture0 v 1945.47076416015625 -2560.4603881826624274 353.8007472991943132 ....etc....

the vef2vts executable will crash with the following messages: _2018-07-30 10:24:50 I3 [8511(main)]: Loading window mesh from: "000009_000013/1/000009_000013-L-1.obj" {vef2vts.cpp:assign():713} terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector >'_ what(): bad lexical cast: source type value could not be interpreted as target Aborted (core dumped)

vaclavblazek commented 5 years ago

It's a documentation error. The mapping between material name and actual texture is defined by manifest. We do not use mtl file, it is not read. Material name must be numeric index into window mesh texture list (atlas in manifest.json), starting from 0.

The only place where mtl file is ever touched by libvef (used in vef2vts, in read-only mode) is when generating VEF data via this library.

Please, change your obj file to use usemtl 0. Also, do not forget it to change it in your mtl file if you want to be able to open it in a viewer.

I'll update documentation.