Issue Loading OBJ Files

Hey,

It’s been a while. Off working on online apps. Now back at it…

So, my issue is that if I use the assetsManager.addMeshTask (with an onSuccess of course) to load an OBJ file (mesh only… no mtl or jpeg) in version v3.2, the mesh loads fine with the expected 404 .mtl file not found. However, I just updated to v3.3, unminified with OBJ and STL support, and the mesh will not load.

Here are the errors I receive:

Error - Unable to load uploads/shuttle.mtl
babylon.custom_3.3.js:118548 Error - Unable to load uploads/shuttle.mtl
(anonymous) @ babylon.custom_3.3.js:118548

Any thoughts? I’d like to take advantage of some features of the new version. I can’t create a Playground repo as I’m syncing files from the backend before loading to multiple users. So I doubt the code would mean much to you. However, I’m still using the assetsManager to load an OBJ as I have for years now.

Cheers,

Galen

There was some code added to the OBJ loader to make it easier to use - I would send you a link to the changes, but it’s hard to find with what looks like some renaming. The MTL files are now loaded before the success handler is invoked, if I’m not mistaken and that’s where it is failing - whereas in the earlier versions it would have failed on the async load (after success was called).

I would suggest removing the MTL file from the OBJ and then it will load and you will also avoid an unnecessary call to server.

Thank you for your suggestion. Of course, when I remove the MTL reference, the OBJ loads. Is there an update coming, or should I try and edit the babylon.js custom file directly? I don’t use TypeScript and haven’t modified the babylon.js file directly in a while. I have a beta version of the software shipping soon, and all users wouldn’t understand how an OBJ file works… even as simple as it is.

Again, thank you for your suggestion, as I’ll temporarily have a solution for demos.

Cheers,

Galen

What would you expect then? A silent fail?
We could perhaps add an option to the loader that will enable this behavior ?

Hi DK,

I hope you and your family are doing well.

A silent fail was good enough in past versions. I very often am working with OBJ files without any MTL or JPEG. The users of the app don’t generally require materials for review.

Cheers,

Galen

I could add that, if there’s no rush; or an option to ignore MTL files. Just need to know default.

1 Like

I would say both actualyl :slight_smile:
Depending on the use case both could be handy

(And thanks a lot @brianzinn)

2 Likes

I’ve managed to get a bit of time to work on it. It’s more or less there, just need to do proper testing and cleanup:

Hope to create PR in next couple of days. I did notice that without this fix the SceneLoader will spin forever on missing materials as the promise was not rejected, so fixes that as well as adds support for OBJ specific settings via implementing ISceneLoaderPluginFactory. Cheers.

1 Like

@brianzinn

Thank you for looking at and coding a non-fail. I just check my notifications, but I will test this tomorrow, and more thoroughly this week.

Again Thanks!

Galen