RGB values wrong when exporting as OBJ

I wanted to export a model as an OBJ from Blender 2.8 and encountered a weird problem. The model that I’ve created had 2 almost identical materials.
The first material just used a principled BSDF shader with a basecolor of #65BFFF.
The second material was identical with the exception that I connected an image texture node to the basecolor. The Image texture node contained a texture with the same color of #65BFFF

In the Blender viewport the two materials look identical and there doesn’t seem to be a difference.
However, when I try to export the model as an OBJ and import it into any other program ( for example: https://3dviewer.net/ ) there seems to be a difference and the value of the material with just the basecolor seems to have a different value.
I just can’t figure out why there is a difference and it’s driving me mad… I hope someone can explain this weird behaviour to me.65BFFF.zip (95.6 KB)

Is it reading the texture-- will it change if you edit the texture? Does it expect textures in sRGB color space or textures in linear color space? What does the .mtl say if you open it up in a text editor?

But in general, you shouldn’t expect blender materials to export to anything. You need to make your materials for the engine, in the engine on which you intend to render them.

Yes it is reading the texture. Actually the material with the texture is the one half that looks as it should look. It is the “material only” half that looks different.

In the render tab I even switched the Color Management from sRGB to “None” with no effect.
The mtl value for the diffuse color also seems to look good, but as soon as it gets imported somewhere the value seems to get multiplied by something and changes ist value.
I have no clue what’s going wrong.

In the ZIP above you can find the blend, obj and mtl files, along with the texture.

I don’t expect blender materials to export to anything, which is why I’ve kept it that simple. In 2.79 I set up the materials as simple as possible with the Internal engine and that worked well. Now I have to either stick with Eevee or Cycles to export models and I can’t figure out how to do it right…

That has nothing to do with how a different engine renders things, only with how Blender renders things.

It looks to me like 3d viewer isn’t gamma correcting. (Look at what happens to your texture when you load as non-color data in Blender.)

You need to design your texture for whatever engine you plan on rendering in and ignore Blender output.

In Blender 2.79 the “Color Management” menu was located in the scene tab. If the Display Device was set to “sRGB” instead of “None” the exported diffuse values (RGB) in an MTL file were not consistent with the hex-value set up in Blender. As the Color Management menu moved to the render tab in 2.80 I thought it did the same…

In fact I still think that it has something to do with the Color Management. I just can’t figure out how to set it up so that it exports the correct values.
I compared the MTL export of 2.80 to an export of 2.79 and noticed that the RGB values were different. They were correct in 2.79 and wrong in 2.80.
I then noticed that the RGB values were already wrong in Blender 2.80 itself and just didn’t notice it before as it showed the same values as in the MTL export.


2-80RGB_Values

That’s weird, I didn’t realize that. Might be a bug, although personally, I would consider that 2.8 is probably handling it better-- it’s weird to give different exports based on rendering settings. Blender can have no knowledge of the engine you’re going to use the .obj in, how that engine handles gamma, what kind of textures/values it expects, etc.

(I don’t like the way Blender handles gamma in a lot of ways, it tries to hide it away rather than making it part of the process, acts like it’s smart enough that users don’t have to worry about it but that’s never true. Would much rather just see sRGB->RGB and vice versa conversion nodes than all the issues that Blender creates because it thinks its smarter than the user.)

In any case, you know what to do if you want to fix it.

Unfortunately I don’t really know what to do to fix it.
In Blender 2.80 the RGB values stay the way they are (wrong?) no matter what settings I use.
The same RGB values then get exported in the MTL file which leads to different results when I import said OBJ/MTL into any other software.

I ended up creating a material with a texture that has the correct color value instead of using the diffuse color of the material directly to get the “right” exports. So it’s not really a fix but rather a workaround at best… :confounded:

Workarounds are fixes. I was thinking you’d just edit the .mtl to do your own gamma correction.

If it were just one OBJ export I wouldn’t bother and just edit the values in the MTL.

However, Blender is only one step in the process of our pipeline where we clean up models and set up the materials before they get thrown into Simplygon. I have to export a ton of OBJs which is why it’s not really a feasible workaround, as I would have to pull out a calculator and manually convert all the RGB values for every material of every OBJ that I’m exporting. :exploding_head: