Importing .ojb into DS, but .mtl doesn't load
jakiblue
Posts: 7,281
I'm importing one of Poisen's SuperSkullz .obj into DS - that works fine, but the .mtl file for it doesn't load. The .mtl and the .obj are in the same folder, so I can't work out why the .mtl doesn't also load on the object.
Anyone have any ideas?
Comments
The mtl files doesn't contain any interesting texture (just colorize the different zones, see screenshot).
You have to assign your own colors/textures/shaders to the imported object (made a quick example with the Gemolocica shaders.
ah! thank you! I get it. :D I thought the mtl file had the textures....
Thanks!
I'd recommend you use Notepad++ to look at and edit the mtl files. That way you can see if it has any image textures in it, then you can delete all the routing to it and just leave the image file name, providing the images are in the same folder as the obj and mtl they'll load up..
Example from mtl.
newmtl g13m4
Ns 100.0
d 1.0
illum 2
Kd 1.0 1.0 1.0
Ka 0.0 0.0 0.0
Ks 1.0 1.0 1.0
Ke 0.0 0.0 0.0
map_Kd cord_hdl_ins.png
I'd work on a backed up copy.
It's very easy to break the .mtl file so that the textures are ignored, or the whole .mtl file is ignored and the .obj mesh imports with all shiny grey plastic or weird random colours.
* Somewhere in the first few lines of the .obj file should be a link to the .mtl file. This should not include a folder path if the two files are in the same folder, but if there is a folder path or the two file names don't precisely match, the .mtl file will not be found.
* It's common for textures of an .obj file to be either in the same folder, or in a subfolder alongside the .obj file. Open the .mtl file and check each material that has texture links; if the links specify a subfolder but the textures are in the same folder, or vice versa, the .mtl base diffuse colours will be obeyed but the textures will not be found.
* Note that this messes up the conventional split of object and texture files into /Runtime/Geometries/ or /Runtime/Textures/ folders — if you do it this way, it is possible to set up the .mtl file with the correct paths between the "proper" two Runtime folders, but it is very easy to get wrong as the paths will get awkwardly long. It's much easier to stuff the whole lot, .obj .mtl and textures, into one folder and put that into either Geometries or Textures. This is what I generally do with .obj files; all in one folder, and no paths in the .mtl file, just the texture filenames.
* One rather tricky gotcha; the lines in the .mtl file that specify the textures will start with a word like "map_Kd" as shown upthread. This is not supposed to be part of a path, it's a command to the .obj file telling it the next word is a texture filename and what kind of texture it is. Don't delete it.
thanks all! :D