MD5Importer + material support?

I was wondering if there is any way to export blender materials for md5 files so that ambient,diffuse, and specular colors can be applied to the loaded mesh.  For object files, a .mtl file is generated and read in by ObjToJme.  I looked at the md5 file format spec and it calls this a "shader" but it looks like only texture files are supported, and this is confirmed by Neakor's MD5Importer code as mesh parsing only assigns a texture file name for the shader token.  The "marine.md5mesh" file in the MD5Importer project test code has the line


shader "models/characters/male_npc/marine/marine"


What is the "marine" resource, the path is not part of the project. 

If materials are indeed not support and only textures, then I was thinking I could also export an object file which would produce a .mtl file with my materials and then add bogus textures like MTLTOKEN_[materialName] that are applied to the same mesh subsets as each material, so that I can then associate a material with each loaded MD5 mesh (since MD5 meshes don't have names) and then discard those textures that are invalid.  If I need to apply a material and a valid texture to a mesh, then instead of using a bogus flag name like MTLTOKEN_xxx, I would give the material the same name as the texture.

Can anyone think of a better way?

Thanks!

md5 material support is sort of "separate" thing, they are written to .mtr text files but still reference textures for the diferent properties i.e diffuse, specular, normalmaps. and are done "by hand" there are no tools for writing them AFAIK and can be tyresome to write multitextured models. if u google around u can find samples, but u'll still need to write support code for them

Momoko_Fan said:

I am pretty sure the MD5 format does have material support, just that the Blender3D exporter does not use them. There's a Maya MD5 exporter that makes "mat" files which are apparently compatible with Doom 3 (?).


oh i think ive heard that before, but we r using max for characters and the exporter doesnt export material info.

the string inside the mesh file is intended as a texture if i understand it correctly. so i dont think md5 has a field for materials.

I am pretty sure the MD5 format does have material support, just that the Blender3D exporter does not use them. There's a Maya MD5 exporter that makes "mat" files which are apparently compatible with Doom 3 (?).