I'm writing an importer for a format with standard DirectX materials. The material values are:
diffuse - r,g,b,a (floats)
ambient - r,g,b,a (floats)
specular - r,g,b,a (floats)
emissive - r,g,b,a (floats)
shininess - value (integer)
I think its the same for OpenGL.
I understand that Blender is not a realtime 3d engine, so the material values aren't limited to these and might not be named the same way. But what is the “correct” mapping? What I have currently is just an educated guess:
diffuse:
material.diffuse_color = [diffuse[0], diffuse[1], diffuse[2]]
material.alpha = diffuse[3]
ambient:
material.mirror_color = [ambient[0], ambient[1],ambient[2]]
material.ambient = ambient[3]
specular:
material.specular_color = [specular[0], specular[1], specular[2]]
# 4th value (alpha) not used in Blender?
emissive:
material.emit = emissive[3]
# only one value?
shininess:
material.specular_hardness = (int(shininess)) # in Blender a float is expected, is this enough?