18
$\begingroup$

I'm trying to import an OBJ file that has associated MTL and PNG files. There's a similar question here, but the answer is not very helpful, I just see a big blob.

These are the files that I'm trying to import. Inside the textured meshes folder there's a few different versions of the object but none seem to import correctly with the texture applied.

I also don't have access to the material and object (as well as a few other) buttons. (see the picture)

enter image description here

Blender 2.71

$\endgroup$
24
$\begingroup$

1. Check the obj file

In your case the obj is not exported correctly. Obj is a human readable file format it is easy to find the issue. You can check this by open up the file in a text editor of your choice (sublime, gedit...).

To check referenced materials go to these lines:

  • mtllib [external .mtl file name]
  • usemtl [material name]

In your case mtllib line is correct, but usemtl is missing.

# OBJ FILE
...
f 3103/18700/18700 3081/18701/18700 3119/18702/18700
f 279/18703/18703 3118/18704/18703 274/18705/18703
f 265/18706/18706 3101/18707/18706 278/18708/18706

# usemtl material name (reference to the .mtl file)
usemtl MyMaterialName

You can find the material name in the mtl file in this line: newmtl [material name]

# MTL FILE
newmtl MyMaterialName
Ka 1.000 1.000 1.000     # white
Kd 1.000 1.000 1.000     # white
Ks 0.000 0.000 0.000     # black (off)
map_Ka myMap.jpg         # ambient texture map
...

As last step check if the paths to the textures are correct:

map_Ka my-texture.jpg                           # points to texture in obj folder
map_Ka /home/user/images/my-texture.jpg         # absolute path on unix
map_Ka C:\\Users\\user\\images\\my-texture.jpg  # absolute path on windows

Make sure that the filenames of your textures are correct and there are no white spaces in the paths itself. Instead of pointing to the 'absolute path', you can also try Blenders Find Missing Files operator. For further information about all the possibilities of obj's read this wikipedia article.

2. Apply the material

If the material is not applied to the imported object you can select it here:

enter image description here

3. Enable textures in the viewport

$\endgroup$
  • $\begingroup$ I'm having trouble getting this to work, I don't get the material button in the scene as you show... I only get the options shown in the picture I posted. $\endgroup$ – andy mcevoy Jan 30 '15 at 22:34
  • $\begingroup$ ok, got the button thing figured out, but after changing the material it still doesn't display the texture on the mesh. Is there some other option that I need to change? $\endgroup$ – andy mcevoy Jan 30 '15 at 22:47
  • 1
    $\begingroup$ Ok, finally, took me a while since I don't know blender very well. Your solution works great, I was just missing the step to go into the UV/Image Editor and make the changes there as well. $\endgroup$ – andy mcevoy Jan 30 '15 at 23:16
  • $\begingroup$ 1) I changed the texture as you showed. 2) Went into edit 3) changed the image in the UI/Image editor. Then everything looked like it should. Here's a pic showing where I did these things if it's not clear. dl.dropboxusercontent.com/u/65115630/blender.jpeg $\endgroup$ – andy mcevoy Jan 31 '15 at 19:09
  • $\begingroup$ In general texture is applied to diffuse layer(map_Kd) rather than ambient layer(map_Ka) $\endgroup$ – Necktwi Mar 25 '17 at 2:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.