Material Bug

Hi,

I have a problem where Blender absolutely will not export my OBJ materials properly. Some of the area it recognizes correctly, but some of it it exports as [materialName]_NONE. Deleting all the materials on the object gives me none_NONE and none. Deleting all the materials and trying to add new ones (a sort of material reboot) gives me the newMaterialName and newMaterialName_NONE. Also, it keeps referencing an image that was never associated with any of the materials and was only temporarily associated with a UV map. Is there any way to clear material information fully? Or any information at all about this bug?

I’ve already done a search (here and on the Web), and the only information I could find about this problem was a thread here from October that never got any replies. I’m just hoping I have a little better luck…

Thanks in advance to anyone who replies!

Could you share a simplified version of that file with us (that still shows the problem)?
I tried to trigger this behaviour, but in my tests this problem did not occur.

Just upload the file to pasteall and perhaps we can find out what causes the issue?

Oh, thanks so much for the rapid reply! Yeah, I’m not surprised you couldn’t duplicate it. It’s not happening with every object in the scene, even exporting to one OBJ. It’s only consistent in that I can’t make it stop now that it’s like that. I’m sure there’s a reason behind it, but I can’t figure out what it is.
http://www.pasteall.org/blend/33327
Sorry, it’s still around 4MB.

Just to let you know, I did fix the exported version by opening it in a text editor and consolidating the materials there. So it’s not an urgent problem. But I export from Blender all the time, and so it will make me a whole lot less efficient if that’s my only way to fix it.

Ok… That’s a weird one.

However, when I just export your file to OBJ, the corresponding MTL file will contain four materials:
light, thickness, wall (with a texture that shouldn’t be there) and wall_NONE.

And now I do this: In the UV image editor I just assign the image “Test” to the UV layout…


… and export again. And now not only the additional texture in the wall material is gone, but also the extra wall_NONE material.

Don’t ask me how this worked, but perhaps you assigned a texture to the UV layout that Blender now can’t find?

Make sure you do not have Cycles material leftovers before you export to obj. This might cause such “bugs”.
obj format and Blender’s exporter is not meant to deal with Cycles node materials.

Delete UV-map in object data panel.

IkariShinji - Yay! That did the trick! How interesting. You know, I’d tried things with the test map to get it to replace thing, but I couldn’t seem to kick that out. And no, it seems to find all the images just fine. I think it just got caught with that image in the UV map but not the material. Thanks so much!

eppo - Thanks for sharing that information, though it puzzles me. I’ve used noded Cycles materials on more OBJs than I can count (for years even) and never once had a problem. In fact, this problem only emerged since I started using Blender Internal mode (I’ll try not to do that again). If noded Cycles materials are a problem, then every object in the scene should be having this issue. But it’s only this one piece. Not to mention, the image being called was never assigned to a material, but was temporarily in the UV/Image area (I wanted to look at it without needing to be in front or side view) without a material while in Blender Internal mode.

Could you explain more about these problems with exporting OBJs with Cycles materials that you’ve encountered or heard about? Again, I’ve never once had a problem other than this (which seems to have nothing to do with actual materials) in literally hundreds of exports, so I’m very curious.

JuhaW - You know, I thought of doing that. Unfortunately, I needed the UV map for, well, a UV map, and I’d done a whole lot of work (hours) cleaning it up after generating it. So I’m really glad there was another way.

Thanks to you all!

Cycles materials do not translate into BI materials (effortless) and vv.
Easiest way to check - start in Cycles, assign default Diffuse material to Cube, change color to say Red and switch to BI rendered view. You will get empty space rendered.
If you export to obj there will be material - default gray. And, yes, there wont be any problems exporting, it’s just that the result wont be as you might expect concerning materials.
Here is image- Cube with 2 Cycles materials applied, one is textured. Pay attention to material file contents.

In your file i downloaded default state is BI rendering; object “wall modified” has 2 materials: “thickness” and “wall”, none has image textures used. However if i check in Node editor window (it does look empty but it is not - hit dot on a numpad) there is Image node with texture file “test” used in “wall” material. Here i have to admit i did stop on further digging and suggested to get rid of Cycles materials parts before export.

Image referenced in obj export from your blend file is different one “4195555332_d92994fc3d_o by Romany WG.jpg” and which is even more weird is that this image could be found only in Blend file Datablock (Outliner) - it was used as a background and is not referred anywhere else in Datablocks yet it is present in exported obj. Might be some glitch or even a bug.

Deleting UVs from object has been 100% sure way to get rid of any stubborn texture images so far here too ;). This has some consequences though…

Edit: Another way would be select all wall faces in edit mode and Shift -click on X in UV editor (which would show [FaceAssigned?] problematic file name in use). This cleans up well hidden links between faces and image.

Oh, I know Cycles and BI materials are separate. I am almost always in Cycles mode and almost always work with only Cycles materials. The only reason that file is different is because in the full version (which has all layers full of something and several different pieces for different purposes) I did some texture painting, and all the tutorials I’ve looked at so far said to do that in BI mode. Frankly, it’s caused so many problems, and texture painting seems to work in Cycles mode (knock on wood), so next time I’m going to try just avoiding BI mode.

Yes, I use test images in many of my Cycles materials to preview my UV mapping. Again, that’s something I do all the time with no problem, even after exporting.

I get your meaning now about the Cycles materials. Actually, I prefer that way. It’s much more convenient for me to be able to leave the test image in my materials and export it plain than have to eliminate those every time I want to export. I’ve never found material translation in any app much more than a bare beginning. I always end up building new materials, and I usually have to change paths for textures. So, generally speaking, I usually (though not always) prefer materials not to export.

Oh, I know which image was referenced in the OBJ export. That’s why I knew it could find the image- I used it in my background. And you’re right, it was almost definitely a sort of bug. I think it was brought about by my switching into Bl mode and loading the image in the UV/Image Editor once (and I thought getting rid of it there afterward), and the horrible BI practice of attaching textures to a material if you load them in the UV/Image window.

I hope that changes one day. Just because you want to look at an image doesn’t mean you want it to be part of the materials in the object you’re working on. We have two different interfaces to add images to a material if we want. I got rid of that image afterward, but it still kept the association. I think I just hadn’t selected every single face when I replaced it, because when I did that as IkariShinji suggested, it worked. But frankly, it never should have happened. All I wanted to do was look at a reference image while not in front or side view. I should be able to do that without changing my materials. Adding an image to the UV/Image Editor window should have nothing to do with materials. That, or they should separate the two purposes: UV Editing and Image Editing, and also update the material editing interfaces to reflect the automatic change.

Yes, I can see how deleting the UV map would work, but since I often find making a good UV map by far the most time consuming aspect of working in Blender and I’d already had to work on that one twice, it wasn’t worth it. It was quicker to edit the OBJ and MTL files in Geany, though that was a fix that needed work each time I exported. I’m very grateful to IkariShinji for finding another solution.

Thanks for the tip! I think I heard about that before, but I totally forgot.

Most distracting is that images do not give up their users in Outliner.
According to this video Blender’s materials are not what games mostly want(ed?) - face assigned texture images are, be it BI or Cycles we get them done.
Image and unwrapped faces in UV editor at the same time…here you have the association faces-texture.