Export/Import Maya -materials to external file

One annoying thing about our pipeline is that our materials are internal to Maya.
This is ofc quite bad if you are working on a game that has a lot of levels and so on: Anytime a change needs to be done to a material (say, u wanna switch one of em from lambert to phong) you have to go into every single scene/level, do the change and then export that level again.

So I was wondering if there’s someone here who work, or has worked with, a solution of storing Maya materials externally.
It would require a custom exporter ofc, that extracts the shader information from the Maya scene and stores the necessary data in something like an XML or similiar external file. That part doesn’t seem too complicated, but in the other direction there’s a bunch of problems I can think of.

And yea: I know the best thing would be to have our own LEVEL EDITOR - but that’s not something they are interested in around here I’m afraid :frowning:

I’ve never worked with maya materials from that perspective, so I’m shooting from the hip here.

Everything in a maya scene is created by mel commands, so I assume the same goes for materials. So I assume that you can generate your game material from parsing and .ma file.
Maybe you can reference all material in a level, so that every material has its own .ma file (this get messy quickly).
This way you could easily fire up the .ma for one material, adjust it, generate your game-data from it and it would automatically propagate to your level .ma files and game levels.

[QUOTE=saschaherfort;19248]I’ve never worked with maya materials from that perspective, so I’m shooting from the hip here.

Everything in a maya scene is created by mel commands, so I assume the same goes for materials. So I assume that you can generate your game material from parsing and .ma file.
Maybe you can reference all material in a level, so that every material has its own .ma file (this get messy quickly).
This way you could easily fire up the .ma for one material, adjust it, generate your game-data from it and it would automatically propagate to your level .ma files and game levels.[/QUOTE]

Yea that’s an idea.
Another way to do it would be to implement some kind of syncronization script.
The export is the easy part: material info can be extracted from parsing the maya scene.
Import… well… is that even needed? After you’ve opened a scene, you just run a script or whatever that looks at the info in this external material file, and then does the necessary changes to existing materials. It could be added as a scriptJob that triggers on event=openScene or whatever (that’s pseudocode btw).

But then that still means you will have to open every scene and save it again… It does bypass all the manual crap of tweaking the material but you would still have to re-export the whole thing :confused:

I haven’t experimented with this workflow much personally, but the Visor is intended to be a browser of sorts for stuff that in saved piece-meal into separate maya files.

You could try creating a maya file that contains nothing but materials. Lets say it has 5 materials in it - Wood, Metal, Plastic, Cloth, Stone.

You could reference this file into all your levels and apply the materials to the geometry. The level file doesn’t contain any materials at all - just the geometry. Then if you ever need to update the Wood material, say adjust it’s specular properties, you only need to do it once.

Have you tried exporting shader networks from hypershade and referencing them in with the ‘shader networks’ option turned on in the refeemce editor?

Never thought of using references for shaders/materials - It sounds very clever so I’ll look into that.
Thanks!