I am new to this forum.
I wrote a script which exports all objects from all scenes of a .blend file into a collection of .obj and .mtl files.
The idea is to later read the .obj files and render them with DirectX
The script uses the
API. The exact code been:
bpy.ops.export_scene.obj(filepath=output_filename, use_triangles=True, use_materials=True )
The .obj files work perfect- I can reconstruct the exported meshes.
The problem is that it seems the API always exports a “default” .mtl file of a gray mesh, which looks like
.... Ka 1.000000 1.000000 1.000000 Kd 0.640000 0.640000 0.640000 Ks 0.500000 0.500000 0.500000 ...
I tried changing the default material of the object to a “Diffuse BSDF” and setting the color to Red
hoping to see changes into the “Kd” coefficients, but the exported file is exactly the same.
I understand that the materials are encoded both by shaders and material properties, but I was hoping
that I can extract at least the Ka, Ks, Kd coefficients.
Any idea what am I doing wrong?