1
$\begingroup$

How can a single .exr containing all passes from a scene be created if certain passes have different shaders applied. For example the matte pass might have different color surface shaders while you need something like a lambert for the diffuse pass.

Is it possible to get all of the layers rendered even if they have different shaders into the same .exr file. If so how would it be set up?

I researched this as a Maya user looking for an alternative, only the most current version of Maya 2016 has this option or some of their more expensive renderer options like vray. (Maya 2016 .exr multi-pass option)

There is a tutorial here showing how matte passes would be handled in an older version of Maya with mental ray: Tutorial on multi-shader passes & .exr. It renders out two .exr files, one for all of the main passes and one for a matte rgb pass. With this method you would have to create a seperate .exr for every pass that uses a different shader on a seperate render layer.

$\endgroup$

2 Answers 2

3
$\begingroup$

The first tutorial lists a number of different shaders that may have their own render pass. Cycles doesn't separate the render result based on the shader used, cycles uses node based materials that can combine many different shader types to get the final result.

In cycles the passes that are available will each contain a portion of the scene that when combined makes the final image (or render layer). The way that the passes are combined is shown in the manual and has been explained in a few video tutorials. If an object's material has only a diffuse node then all the information for the object will be in the diffuse pass. If it has a mix of diffuse and glossy then it will have information on both the diffuse pass and the glossy pass that when combined give the final appearance of the object. When saving a render to an OpenEXR Multilayer file, each render layer and it's passes will each be saved as a layer in the one file.

The second tutorial you linked to talks about creating object masks and combining them into one OpenEXR file. We have a few options to perform a similar task. Every object can have an ObjectID and every material can have a MaterialID. These ID's can be used by an IDMask node to get a mask matching the object/s or material/s with the same ID. We can also assign a single material to a render layer that makes every object visible on the layer render using the same material.

When using the compositor we have the option of adding a File Output node. If an OpenEXR Multilayer format is used for the file output then we can add as many layers as we want and choose what goes into each layer, that may be a direct render pass result, an edited and combined result or even object masks. When other file formats are chosen each input will be saved to a separate image file.

file output node example

$\endgroup$
1
$\begingroup$

I think there's basically two ways to do this. You either render the scene twice (changing the shaders in between), or else you duplicate the objects on separate layers and apply different shaders to them. Then you can handle everything in one render.

If you choose the second option, you might want to try object link the objects that are changing shaders. You can link object data between objects but choose different materials for each one, this might make it easiest to maintain mesh consistency between the objects while keeping separate shaders.

If your pipeline needs either of these options to be more automated, you could write a python script to execute prior to rendering that duplicates the specific objects and modifies their shader in the duplicate.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .