is it possible to have different object render sets per render layer?

Hi,

I am trying to set up a shot using different object render sets per render layer using layer overrides but it doesnt seem to be working as expected. It sets up and renders correctly but when you change render layer it loses the connection and it seemingly has to be remade.

Is there a fool proof way of getting this to work?

Thanks in advance

Just to understand it correctly, you’re trying to move objects between different object properties sets when switching render layer?
Normally you’d just override the options inside them, I think that’s what you’d do in 90% of cases. That being said, I think you might be able to switch between sets in a way by nesting your objects inside two groups, one inside the other and creating an object properties set for each of those groups. Then override the General > Disable option to switch between them. Haven’t tested it though, don’t know if it would work.

Edit: oh I completely misunderstood this, don’t know how that happened :smile:

Hi, thanks for the reply.

i am not trying to switch objects memberships between render layers.

what I am trying to achieve is to use different ‘render mask - object sets’ per render layer using something like a render layer override. It doesn’t seem to be possible using a tradional set up so am wondering if there are other solutions to achieve the same result
many Thanks

Are you using the “render mask” + Object sets? This hasnt worked with overrides for a while I think. It looks like its worked in the UI but when you switch layers it doesnt change.

Yeah that’s exactly what I am experiencing. I was just wondering if there was an alternative setup that would allow for the same result.

Thanks in advance

It seems that this doesn’t work for some reason. We’ll see what if there’s something we can do about it. In the meantime, it might work if you have different sets for each layer and use a pre-render-layer script to change which set is connected as a render mask object.

that’s a good idea. do you have an example of what that pre-render-layer script would look like?

many thanks!

Something like that works for me:

string $currentLayer = `editRenderLayerGlobals -q -crl`;
if ($currentLayer == "rs_layer1") {
    setAttr "vraySettings.renderMaskMode" 2;
    connectAttr -f set1.usedBy vraySettings.renderMaskObjectSet;
} else if ($currentLayer == "rs_layer2") {
    setAttr "vraySettings.renderMaskMode" 2;
    connectAttr -f set2.usedBy vraySettings.renderMaskObjectSet;
} else {
    setAttr "vraySettings.renderMaskMode" 0;
}

Basically matching the current layer (as a string), enabling the render mask in object set mode and force-connecting different sets (which I’ve created and added objects to beforehand).
Then the else statement is for all other layers to disable the render mask.
All scene objects are added to all render layers.

Attaching an example scene. It’s for Maya 2018 and V-Ray Next, using the new render setup system. The same script is pasted in the pre render layer MEL field in render settings > common tab > MEL/Python callbacks
renderMask_layerOverride.zip
renderMask_layerOverride.zip (9.68 KB)

this is great, thanks!