PDA

View Full Version : Assigning Shaders to render layers...


SlayTheBeast
08-21-2006, 03:26 PM
Hello!! I have a question...im trying to figure out how I can assign shaders to my objects in different render layers through mel. It doesnt seem to be easy. Can I just make a render layer active somehow and use sets -e -forceElement shadingEngine?? Ive tried this and it doesnt seem to work....Im not trying to do a material override, I want to be able to assign different shaders to my different objects on a per layer basis. Thanks guys!

faultymoose
01-11-2007, 08:29 AM
Sorry to resurrect an old thread, but I'm interested in finding this out too...

hibigibees
01-19-2007, 01:49 PM
hi, can someone help with slaythebeast's issue, I have a same issue ...
I dont want to select the render layer thro that "layerbutton....selet cmd" and then associate the sets, as the process is in the middle of a automation...
Is maya firing a script job whenever the render layers are switched... if u open the hypergraph of the respective shape node which is associated to 2 renderlayers and when the layer selection changes, the connection disappears and appears when i select back the render layer...

I understand whats happening, but how to setup the same through "mel" scripting...

jadamburke
01-21-2007, 05:34 AM
layerEditorLayerButtonSelect 0 layer3;
sets -e -forceElement lambert3SG;

seems to work for me. It works on selected objects only so make sure you select objects, then change renderLayer, then set the shadingGroup. Maybe I'm missing something?

hibigibees
01-26-2007, 03:02 PM
Hi jadamburke,
Thanks for that tip...
Soory for my late reply, I already know that and I had even mentioned that I dont want use that layerEditor....button cmd and select a particular renderlayer and associate shading Engines to a given face as it takes alot of time during automation !!! Moreover, the same process does not work sometimes when attempted by me through mel script...

Anyway i tried saving a simple maya scene in ascii format where there are 2 render layers. I associated a pSphere to both of it and assigned a green lambert for the sphere by selecting the first rlayer while a yellow lambert for the same sphere on 2nd layer by selecting it... When I examined the maya ascii file there is a compound attribute under which a couple of attr's called "outValue" and "outAdjustment" of the render layer which gets connected to the rest of the network. But if we try to the same network through mel script the color change does not happen when i switch between renderlayers... renderLayer Node documentation or the shadingEngine Node documentation does not provide enough idea to complete what I want... I am also trying to find out what happens between the shadingEngine, renderLayer & the mesh Nodes when a switch of renderLayer is proceeded thro the GUI... More ideas regarding this will be really helpful for me to complete my tool ...

To finish this, I am unable to setup the whole process through a mel script, maybe I do not understand how to proceed properly...
sriram.

rhythmone
03-28-2007, 05:06 AM
I have the same issue with this... there's gotta be a mel command to set all this up.

schantin
03-28-2007, 10:04 AM
Hello,

first of all thanks for the tip on how to select the render layers. I was searching for this one and you helped me out. A short remark maybe on how to set presets on the render layers. I needed to set the depth pass and

renderLayerBuiltinPreset linearDepth layer1;

worked just fine for me.

Have a look into renderLayerBuiltinPreset.mel in your C:\Program Files\Autodesk\Maya8.5\scripts\others directory. There are other presets too.

logrithmicDepth, occlusion, normal, matte, diffuse, specular and shadow.
Maybe this is useful for some of you.


Greetings

rhythmone
03-28-2007, 03:32 PM
My issue is that I want to assign object overrides on a layer... I am creating a matte pass... and the layer is a mix of objects... so some of the objects I am assigning a white surface shader and others get a black surface.

I can do this in the UI... and the echo commands are as above.
layerEditorLayerButtonSelect 0 $layer;
assignSG; // to object
etc....

But this doesn't appear to work through mel. Assigning layer overrides is easy, its the objects that I can't seem to figure out.

CGTalk Moderation
03-28-2007, 03:32 PM
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.