PDA

View Full Version : Maya shader question...


Galo
05-30-2002, 08:33 PM
Hi,

I was wondering, is it posible to make a shader and store it in the shader library of maya hypergraph ?

and then make that shader your default so whenever you startup a new surface ex. a poly cube it comes with that shader ?

thanks,

-Galo

bigfatMELon
05-30-2002, 09:30 PM
I'm sure it's possible. The safest way I can see would probably be to write it as a scriptJob that looks for the creation of new shapes, loads the material from disk and assigns it to the new shape. Either that or you start altering some of the AW scripts. Either way, it's not going to be a casual affair.

You might also choose to resign to suffering through one click and just write the part of the script that loads the material (if needed) and applies it to your selection.

-jl

Galo
05-30-2002, 10:44 PM
man, i dont know mel.... i just started with maya :D

anyway thanks

bigfatMELon
05-30-2002, 11:43 PM
Ok. If you want my second sugestion, I should be able to knock that out in short order and post it here. Just let me know.

-jl

Galo
05-31-2002, 07:46 AM
whowiee, if you would do that for me please..... i would be verry thankfull

-Galo

-wT-
05-31-2002, 02:05 PM
Oh hey bigfatMELon (btw, you and svenip are just life savers :)), do you know where all the templates for stuff are written into? I don't really need a new shader applied to surfaces as default, like Galo, but rather want to just change the default color of the default lambert shader from grey to almost white.

I've never really understood those template thingys, I once tried to change some of the default values of some Mental Ray rendering global options, but after trying to track down, I never really could find a file where there would directly read "Default option for resolution : xxxxxx" or anything.
If you could explain how the different menus and all get their default values from?

bigfatMELon
05-31-2002, 07:12 PM
I do not believe that Maya uses a template file. I'm pretty sure they just generate the scene from a built in mel description. It's kind of the same thing but there is no file that I've found to manipulate. Althought there may be something in the internal scripts folder that can be munged.

So, you might want to jump on that script when I'm done with it after all. I got most of it done last night but decided to make it smarter and more flexible. You will be able to save any material you like to your prefs folder (named a certain way, of course) and then just hit a key/button on any selected object to apply that default material. If the material isn't in the scene it is loaded for you.

This means that you could swap in new default materials just by saving a new file to the prefs folder. I like it. :cool:

-jl

bigfatMELon
05-31-2002, 11:29 PM
Originally posted by Galo
whowiee, if you would do that for me please..... i would be verry thankfull

-Galo

And the result is... defaultMaterial.mel.

I just uploaded it to www.highend3d.com but it might take a few hours to show up there so I also added it to my own MEL repository: http://homepage.mac.com/julianlove/FileSharing3.html

It works as such:


Create a material you would like to use as your default
Export that material to your /Maya/Prefs/ folder as "default_materialName.ma"
The "materialName" portion of the file name must match the name of the material as it appears in Maya. If not, the script will import a new material everytime you run it.
From then on, select any number of objects and run the script
When run, it imports the material if needed and applies it to the selected objects.
You can change the default material at anytime by replacing the file with a new exported material with the proper name.
en-freakin-joy.


-jl

CGTalk Moderation
01-13-2006, 07:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.