Using wavefront mtl file to define vertex color

I am developing a MacOS program using MetalKit and ModelIO. The ultimate goal is to use the model

to analyze the acoustic properties of a performance space. Initially I'm just creating a visual

image of the space (stage, walls, seating, etc). I create a wavefront file (.obj and accompanying .mtl file).

I can define the vertex color for every vertex in the .obj file. But I would like to use the Kd properties

of the mtl file to set the color so that specific colors are associated with specific named materials

in the mtl file.


I use ModelIO to create an asset and then extract both the model mesh and metal mesh:


// Extract both the MetalKit meshes and the original ModelIO meshes

var meshes: (modelIOMeshes: [MDLMesh], metalKitMeshes: [MTKMesh])

meshes = try MTKMesh.newMeshes(asset: asset, device: device)


I see all of the mtl properties for all of the 147 submeshes in the imported model.


If I specify the vertex colors in obj file then I see all of those colors in the 147 metalKitMesh submeshes.


But if I do not specify all of the vertex colors in the obj file then all colors in the metalKitMesh submeshes

are Black (0,0,0). The colors specified in the mtl file are ignored.


The primary question: Is there a way to use the mtl colors to automatically set the metal submesh colors?


Secondary question: In the more general case, what is the best way to convey all of the metal parameters to

the shader?


Thanks