How to use OBJ material part export function?

Already achieve to export to obj file; however, the material file serialization function OBJExport.MTL(scene.meshes) throw following error when used:
Uncaught TypeError: Cannot read properties of undefined (reading ‘specularPower’)
at Function.e.MTL (babylon.serializers.min.js:1)

What am I doing wrong???

This is really hard to tell without a repro. Could you share one in the playground ?

Total shot in the dark but going off of the documentation can you even do scene.meshes as an argument?

or does it only take 1 mesh at a time?

Take any scene and try to export all meshes at same time (scene.meshes) and it will throw the error, or the array must be refined?

Oh. Excuse me. Now I understand. Documentation shows that the Mat function do not let more than a mesh at te same time. My mistake. So sorry to be a PIA

You are completely fine. I hope that was the correct fix? :slight_smile:

Well no really. Documentation shows that massive material export cannot be done, at least with that function. So, have no solution to export more than 1 mesh with different types of material

Can you not just iterate through your the meshes and then just export each separately?

The functions returns a string, so in theory you can take that string each iteration and build on it in whatever format you’d like. I would assume some sort of json.

1 Like

Yes, that would do it. Thanks

1 Like