I’m really happy to hear this is working out well. I haven’t even been able to put it into practice on anything serious yet. Soon…
Anounce : Material Matte Pass Creator
Finally got some time to test this great script. Thanks a lot Chris and David.
The script is pretty robust and, even better, working with deex shader. ![]()
-Jason H.
I’m going to try this in a project but I wanted to ask you something…
Does this work with mental ray’s mix colors node as material?. My setup for trees for example (although I use that setup in many materials) is to mix the trunk and leaves materials in a mix node (separate with different UV sections) and even MAYA doesn’t recognize it as a material when asigning to objects, that’s why I’m asking.
Will your script take those shaders into account?.
Thank’s in advance.
No. It will not work as you want with multiple materials that are mixed like that, because it actually uses the SG to choose the objects, not the materials themselves.
If your leaves and trunks are seperate meshes, then you could get matte passes by using object selection instead of material selection.
David
They cannot be selected because they are mental ray proxies, so they are just a cube.
Is that hard to implement this thing?.
Thank’s in advance.
Is it hard to implement? Maybe. I’m not sure. Mentalray pass contribution maps are lists of shapeNodes. These are how the matte passes are being created by the script. I cannot think of a way to extract the information required from the proxy.
David
I’ve tried this script and found that I don’t understand it if I’m doing everything right…
In my scene, when script is applied, it creates a render layer called matte, but when I go to it and make it active, all my objects appears as wireframe in the viewport and grey in the final render…, the script doesn’t give any errors BTW…
Is this normal?.
// Error: file: C:\Documents and Settings\bastian.traunfellner\My Documents\maya\2011-x64\scripts\MaterialMatte.mel line 35: Can’t rename a read only node. //
that’s what I get!
kinda strange.
joie: yes that is normal. The Matte layer has a material override and usually all the objects will display with just wireframe (although sometimes you will see some are flat shaded).
When you render a beauty pass is created for that layer and everything will be black, unless you have default lights enabled in your render settings, in which case everything will look like a grey lambert. You can delete the masterBeauty images, but you should also find folders with your matte passes. These are created at the same time as the beauty render and cannot be created without it.
Sorath: I have no idea what the error is. Do you know what version of the script you are using? Can you open it in a text editor and tell me what is on line 35?
David
Thank’s for the info, I thought I was doing something wrong 
If this script could handle mixed mr materials would be awesome…, now I need to select the shader that is conected to the shading group as shadow material (the shader connected to the material slot is the mix_color node and the script doesn’t recognize it as a shader) and then the script is able to find the attached SG, no other way works.
I may be able to fix that. I’ll let you know if I do.
I cant do much about mixed materials into separate passes though.
David
Thanks, it will be a great adition since I use them now a lot, specialy when dealing with trees and such. I guess the mixed materials on passes is kinda impossible to do, but I think I can manage myself with an alpha of the entire tree if I must to.
Hello,
Very interested in your script, and trying it out tonight. Everything seemed fine, and it even rendered blazing fast as predicted, but I have no luck working with the .exr file itself. I am very new to .exr files so if my question is outside the scope of this thread, feel free to say so, and I’ll render it out using another file type or continue searching for info on .exr usage or perhaps make peace with CGB and ask for his help or something…
Here’s my raw render:

And here’s my Material Matte render:

Now I wasn’t expecting them to look the same, but merely expecting an .exr file with tons of layers which I would use as selection tools for my main scene, thereby isolating the shapes based on their materials for further refining in Photoshop. The technique I’m familiar with and can handle, but your script is truly a far, far, vastly quicker way of rendering alphas out for compositing instead of one by one or making separate scenes for each or all the ways I’ve been doing it before.
But in Photoshop my .exr file has only two material-objects out of all those in the scene, an “alpha” layer which correlates with the second image I posted, and then all the expected layers corresponding to all the proper materials, named properly, from my Maya scene. But all these other layers were blank, and that’s where I’m having an issue.
Any ideas what I’ve done wrong?
Meanwhile, gonna render out a .bmp pass or something and see how that goes, in comparison… And try to get a handle on how to use .exr files, hopefully! The .exr documentation is rather straightforward and kinda assumes you know what the hell you’re doing, which I do not… (grins)
Update:
Just rendered out to .bmp and had the same issue. Folder structure was beautiful! But, all my images were flat black. I don’t know what I’ve done wrong here.
Am I not able to just select all my mia_material_x shaders in Hyper, run the script, then render it out? Should I be selecting their Maya base shader instead, such the placerholder lamber/phong/blinns I have connected for Maya software rendering?
At first glance I though that raw render was a photo. Really nice render!
The materialMatte script works pretty well and is a much more convenient way to set up matte passes and contribution-maps than trying to do it by hand. But there are some things the script does not do for you.
Are you using physical sky? or some other kind of environment setup? If so, you should disable these for the Matte renderLayer. You should also make sure FG and GI are disabled (I think the script does this as a layer-override, but wouldn’t hurt to check).
I’ve found problems using multi-layered exr’s, due to the way different applications interpret them. I remember having problems in photoshop until I installed the proEXR plugin, but even now I have not used materialMatte multi layered exrs in photoshop. Similarly if you choose single channel bit depth. I had problems getting Fusion to read a 1 color channel exr, but no problems with a 3 color channels. In fact I have been using 3 channel PNG files on all of my recent projects.
If you want to send me a stripped down version of your scene, I’d be happy to take a look and see if I can make it work.
David
Thanks DJX, but it’s still not realistic enough, thus the need for per-material tweaking.
Are you using physical sky? or some other kind of environment setup? If so, you should disable these for the Matte renderLayer. You should also make sure FG and GI are disabled (I think the script does this as a layer-override, but wouldn’t hurt to check).
Yep, Physical Sky, with FG still enabled. I’ve saved off my main scene as a “blabhblahblah_matID.mb”, so I’ll try these changes next and see how it goes. I thought perhaps the .exr file, being all floating-pointy, needed some kind of adjustment/releveling in Photoshop or something, but the .bmp versions were also black, meaning I screwed something up. Hopefully your tips will help!
Even so, why would two different object/materials show up in the .exr file’s only visible layer like that? Still have a lot to learn here…
It might have something to do with the fact that by default it only renders out just an Alpha channel, no RGB. I did it that way in the initial script because it saves tons of space and creates less channels for the compositor to manage. I’ve never used EXRs with Photoshop so that may be another possible issue. Photoshop also may not know how to handle an image with just an alpha.
Anyways, I was talking to my mentor at Zoic studios yesterday, Andy Wilkoff and I mentioned I had wrote this script, but it doesn’t work with displacements. He had the brilliant idea of creating a condition node before the SG that would switch between whatever material is in use and the default Lambert used to get the Matte Pass. Of course it would require some sort of expression that switches depending on the active rendering layer, which may or may not be possible but it’s something worth looking into as a possible solution.
Been a while since I’ve looked at the code, but if I can find the time I’ll look into it. Of course, djx, if you want to give it a shot, by all means go ahead.
I tried it using simple .bmp output, with the sun/sky disabled and FG off. Still just black renders, and now that I have no lights my master is also black of course, which makes sense. I don’t know what I’m doing wrong. Trying to resource my textures and archive it to send to DJX today for some analysis; I’m certain this is user-error and not your script, though!
Interestingly, the .bmp files all have an alpha channel inside Photoshop (not a layer), but this alpha is also empty. So I think the file format is working, just something in my scene is wonky.
Should I just be using After Effects instead for compositing passes?
Wouldn’t hurt trying, but I’ve only test it with Fusion, Nuke, and Toxik. Don’t know how AE would interpret the channels.
It will be awesome if you could embed in the script that includes my2dtoxik motion vectors in too. Mattes do need to have the 2d motion vectors if they are moving. Other than that, amazing script! saves a lot of render time with lots of contribution maps in 1 render layer.
Hi Christopher,
I’d like to try your old version of script, but I guess the link is not working anymore. Can you please check it … ![]()