I am trying to import an .obj model that has has a .mtl file with several textures/materials. For reference, here is a link to the resource I am trying to import:
I’ve been able to import the .obj but am having trouble getting all of the textures to apply as you can see here:
Hey @sebavan! Wow, that’s something I had no idea about. So that I can learn a thing or two from this experience, could you comment on how you could tell from the files:
that this model needed a normal map/bump textures to render correctly and
that the normal map/bump textures were missing?
For example, did you realize 1) because - I’m making this up because I just don’t know - all .mtl files always require a ‘normal map’ and there was no normal map?
I looked at the material in the inspector and it looks like the map where broken.
Digging into it more, this is using an unsupported flag in babylon “-bm 0.4000” in the mtl file so the name happens to be wrong but anyway the bump in use is incorrect as it is using the same texture than diffuse.
I would advise to remove map_bump lines from the mtl.
I have done a bit of work on the obj loader… I wonder if it’s some functionality missing in the loader itself. Does it load in other software correctly? The sandbox isn’t reliable from my experience as it won’t be able to load the MTL files as separate downloads or possibly I was uploading incorrectly
For a multi-textured multi-component 3d model like this, what would be the preferred way for me to load such a model in Babylon? Is this a limitation of the .obj format?
UPDATE 2: And the winner is .glTF file format (at least in the sandbox)
UPDATE 1: here is what the model looks like in Blender now. It seems to have all the textures so I will try exporting as .glTF file and see how that goes
Sounds good! Let me know if there’s anything I can do to help. I can confirm that I could successfully import the textured model in my own code using the .glb format
How did you generate your MTL file? There were some file names incorrect (spaces that should be underscore and underscores that should be dashes). Other than that it looks like there may be a parameter (-bm 0.4000) we may need to apply to the bump map instead using as a rootUrl.
Looks like those are unsupported parameters that should be passed through. I think -bm may need to be assigned to: detailMap.bumpLevel. Other parameters like scaling and offset are also not handled it looks like.
Can you look at, for example your wood texture bump map and see if you have adjusted the bump scale/level?
Should be able to support that once I know where to map those parameters.
edit: or if you can share the glTF and I can look in inspector
edit2: looks like that file was created in 2013 in 3ds Max In that case maybe just your file names in the zip were wrong? (still I can add support for bm parameter)!
Yeah, I found those meshes on the internet but I didn’t realize they were that old! But since I didn’t make them unfortunately I can’t comment on the bump maps / the build process. Here’s are the .glbs in if they would still be helpful!
Thanks for the .glb files. I did a PR - I was expecting the bump map to be the spiral pattern on those posts, but from the wireframe mesh looks to be part of geometry.
Meanwhile I did not see a bump texture on the GLB file. I suspect the ‘level’ may not be correct place to set, but see how the PR goes.