Alpha mask out put by object or material

I am predominately a Maxwell Render user. I am using Cycles on particular a project though. One thing I like that I can do in Maxwell Render, is that I can easily pump out lots alpha masks for compositing based on an objects material or by object name. It is very straight forward an simple. As an example, I like to adjust my leaf color in post on my trees. So I can have a mask created of the leaf material only, that way I can isolate the leaves only and adjust the color or whatever I want to do with them. Can this be done with Cycles in a similar fashion?

Thanks

For separating objects you can use an override material that gives a random colour to each object. You can then use that texture to isolate an object with a color key node


[QUOTE=Richard Marklew;3096969]For separating objects you can use an override material that gives a random colour to each object. You can then use that texture to isolate an object with a color key node

How does this work with multi material objects and how does this then generate an alpha mask for the material? Maxwell is easy. You add the material to a list then it spits out an alpha for any object using that material.

Thanks

If you want to separate out by material ID you would really need to do this with a script/addon unless you only have a handful of materials

You could try some of the scripts in this thread https://blenderartists.org/forum/showthread.php?246951-Mat-ID-Obj-ID-color-mask-render-(like-in-Maxwell)&p=2059224#post2059224 (note the comment in post #2)

Are you looking for this mask to include transparency information from the material, or simply an aliased mask of the leaves? Are the leaves using this material all single object (or system) or are they themselves part of a larger mesh (like trunk/branches and leaves) whose material is mixed using a mask of some sort.

The simplest answer would be to move the leaves to a separate layer, and then render out a separate render layer of just the leaves, and use then just save the rgba png (and use that), or use the alpha to a color mix node with black and white for a bw mask.

Some materials are mixed materials. If I have a cube object with sides of all different colors I can get an alpha mask for each side by is color. I am familiar with using render layers and honestly for just wanting to generate a straight alphas for compositing it is a bit cumbersome. Maxwell can do either opaque or alphas with transparency like for glass or leaves…Here is a screen shot of a project using Blender with the Maxwell add-on B-Maxwell. The landscape is a mixed material object consisting of like 6 or so materials. My understanding of render layers is that this landscape mesh would have to be split up so each material was its own object. The way Maxwell Render handles this is you create a render channel, much like how you would create a render layer in Cycles. I can assign to this render channel either an object or a material. In this case the object is the landscape made up of many materials. So in this case I would not want to use the object as my channel to get the desired alpha masks. But I link the material to the respective render channel. I do not have to break up my landscape mesh. Then at the end of the rendering I have a bunch of masks to use individually or embedded into an .exr file. It is so easy to use.


This is one method of creating an opaque mask of the pixels containing a material of an object which contains multiple materials. It’s quite ugly, but it will work. The hack flow is this:

  1. Create a duplicate of the object(s) and move it to another layer
  2. For the material you want make it’s material emission, 1, white
  3. All other materials emission pure black
  4. Create a new render layer, and use only that layer the obejct(s) are on. Because the new material emission you use very low samples (1-3)
  5. Use this render layer to alpha over black to create an opaque mask.

4 minute example: