# How to get blender to write the correct diffuse color (Kd) in exported .mtl files?

I'm using the default Diffuse BSDF for every material with custom color, but none of those colors are exported to the .mtl file (they all appear to be the default color rgb(0.8, 0.8, 0.8)).

However with the Principled BSDF shader I can export color values to the .mtl file but everything is darker (like rgb(0.9, 0.7, 0.5) becomes rgb(0.7, 0.5, 0.3)).

(related question, but not solved: https://blenderartists.org/t/rgb-values-wrong-when-exporting-as-obj/1179228/6)

Since 3D file formats such as .obj/.mtl cannot represent complex node graphs, the .obj exporter add-on only considers the Principled BSDF when creating the file. All other shader nodes are ignored. This is documented in Blender's manual.

I can't reproduce the problem with Kd having different colors in 2.81a. In case previous Blender versions applied the view transform on the scene linear RGB value from the color picker before writing the .mtl, try to temporarily set the View Transform to Raw in the Color Management panel.

• Thanks for the reply! I just found the darker color problem is not only .mtl, it's every format that contains any color inputted into blender, like vertex color in gltf/glb, and the darker the color is the more it's affected, like rgb(1) stays the same, rgb(0.95) becomes rgb(0.8), rgb(0.3) becomes rgb(0.1). Steps to reproduce on my end: 1. fresh project with a cube 2. apply vertex color rgb(0.5, 0.5, 0.5) to the cube 3. export to gltf/glb 4. the result color becomes rgb(0.21, 0.21, 0.21)
– tga
Jan 7 '20 at 6:46
• and yes the exported color looks similar to if I set the View Transform to Raw
– tga
Jan 7 '20 at 7:04
• I managed to get the correct color by converting linear color to sRGB on the rendering client side
– tga
Jan 8 '20 at 3:01
• Yes, vertex colors are currently treated as sRGB. Jan 8 '20 at 7:38