How to export material from Maya ?


I prefer using the integrated MayaPandaTool interface rather than executing maya2egg command line.

How can I export all materials (even without texture) in the scene by modifying this MayaPandaTool interface ? So that each material’s specular and shininess can be preserved in the EGG file as material block.
This is the reference I get from sourceforge:

name { [scalars] }

This defines a set of material attributes that may later be
referenced with { name }.

The following attributes may appear within the material block:

diffr { number }
diffg { number }
diffb { number }
diffa { number }

ambr { number }
ambg { number }
ambb { number }
amba { number }

emitr { number }
emitg { number }
emitb { number }
emita { number }

specr { number }
specg { number }
specb { number }
speca { number }

shininess { number }
local { flag }

These properties collectively define a “material” that controls the
lighting effects that are applied to a surface; a material is only
in effect in the presence of lighting.

The four color groups, diff*, amb*, emit*, and spec* specify the
diffuse, ambient, emission, and specular components of the lighting
equation, respectively. Any of them may be omitted; the omitted
component(s) take their color from the native color of the
primitive, otherwise the primitive color is replaced with the
material color.

The shininess property controls the size of the specular highlight,
and the value ranges from 0 to 128. A larger value creates a
smaller highlight (creating the appearance of a shinier surface).

I don’t have enough knowledge and experiences in MEL scripts.
Please give me a hand on this.

Thanks a lot.

The MayaPandaTool plug-in is really just a wrapper around maya2egg. And, although maya2egg supports a vast range of conversion features, it does not convert the lighting properties of the Maya shaders, I’m sorry to say.

If you are comfortable working with C++, you may be able to add support for this yourself; otherwise, you will have to add the appropriate material definitions to your egg file by hand.