Obj import in sandbox

Hi everyone,

I don’t understand why my rendering is really bad when I import .obj files in the sandbox. I import all the files (obj, mtl, jpg textures)…

for instance, here’s the preview of the object :


and here’s the import in the sandbox :

Could you help me ?

Thanks in advance,


Yes, indeed. I guess the issue is with the import of mtl. There are lots of limitations to these, many or most part of an mtl will not load in BJS.
Another possibility is that your textures do not load with the link from a ‘secure source’.
To be honest, (and this would be my recom) I have stopped attempting to bring in parts of mtl materials since most are not working. The best is to create/reproduce the material in BJS and assign it to your mesh/submesh(es).

All the textures seem to be loaded in the sandbox and each mesh seem to have the right material.

I’ve found what happens. The value of specular power in all my materials is 0. I don’t understand why but…

and now…

Is it possible to save my object after changes ?

Well, this is precisely one of those parameters (specular) that does not make it through.

I’m not sure I understand the question? You are working in the sandox right? You can export the scene to babylon scene or also export to GLB, from the ‘inspector’. If you want to export to OBJ you will need to run a script.
From the ‘inspector’, you can also record the changes you did and export a JSON of all your changes. Either reinject the changes in your scene/script or use it as a reference to manually change your script.

Thank you, i will export my object to glb format.

The conclusion is that i have to work on my meshes before importing them into BABYLON, change their materials…

Do you know a tool that is easy to use (not Blender please :slight_smile: ) ?

No, I do the exact contrary. I don’t work the material (i.e. in C4D) because I know most of it will not import in BJS. I just assign a basic material to create my UVs. Next, in BJS, I create the true material and assign it to my imported meshes/submeshes. That would be my recom to make the process not all too long when working with OBJ. Else, I’m afraid only Blender will have you go the straight path and import all materials except of course for 3ds.
Edit: Apologies, went a bit fast. I believe Adobe Dimension and Substance can both export materials you can import for BJS/WebGL2

Ok, may be i have to change the format of my objects if the .obj format is not efficient.

Could you tell me which formats are totally compatible with BJS ? Only GLTF ?

This section of the doc will tell you all about import formats.
In short, yes, GLTF is the only one that has received a ‘special treatment’ for integration so far :cry:
3ds is also not all too bad (but very expensive :money_mouth_face:

1 Like

GLTF is also good because it’s standardized by Khronos (the same commitee who works on OpenGL), so its behaviors are very well defined and compatible everywhere :slight_smile:

1 Like