Maya 2016 Ext2 SP1 + VRay 3.4 problem rendering with the new layer system

Hey there,

We’re keen on Maya’s new render setup layers, together with VRay v3.4.
I’m running into an issue where Vray render’s black frames when I’m switching the new layers view python commands.

I thought it was a Maya issue (still might be) but doing the same test with other render-engines we have (Redshift and MayaSoftwareRender) worked as expected.

Here’s the steps to reproduce the issue:
- I’ve setup a basic scene, in 2016.5, using the new layers ()
- an ambientLight, camera, Sphere and Cube, each in it’s own layer and collection
- I ran this python code to switch between the renderSetupLayers and render 1 frame


import maya.app.renderSetup.model.renderSetup as renderSetupModel
rendersetup = renderSetupModel.instance()
layers = rendersetup.getRenderLayers()

for layer in layers:
    print ">>> {} <<<".format(layer.name())
    layer.makeVisible()
    cmds.vrend(camera="camera1") # Vray render
    #cmds.render()                # MayaSoftware

Vray will render both layers, but as black frames.

Now, if I’ll just switch the the render engine to be MayaSoftwareRender (or Redshift) and ran the code, it will render correctly.


import maya.app.renderSetup.model.renderSetup as renderSetupModel
rendersetup = renderSetupModel.instance()
layers = rendersetup.getRenderLayers()

for layer in layers:
    print ">>> {} <<<".format(layer.name())
    layer.makeVisible()
    #cmds.vrend(camera="camera1") # Vray render
    cmds.render()               # MayaSoftware

Also, if it help or confuses even more (:face_with_spiral_eyes:)
- doing the same process in mayapy.exe will give the same result (Vray will render black frames, Redshift&MayaSoftware will render correctly)
- calling render.exe to do the render, will render correctly but it won’t render any Render Elements…
“C:\Program Files\Autodesk\Maya2016.5\bin\render.exe” -s “6” -e “9” -b “1” -rl “cube” -threads “8” -rd “c:/temp/” -proj “//eru/DEEPM/images/episodes/light/light_tests/light_tests_110” -renderer “vray” “c:\simple_scene.ma”

I have a feeling it’s related to Maya’s refresh issue in the new layers setup, but since it’s working for the other renders, I thought I’ll start asking here.

any idea would help a lot,
thank you,
Asi
maya2016_5_layers_simple_test.zip (6.02 KB)

Sounds like a bug with the vrend command. We’ll have a look, thanks for the info.

Actually, it seems to be something in Maya.
If you open the scene and first run your script with Maya software, you’ll get empty renders again.
In reality, I think both vray and maya sw render correctly, the problem is somewhere in the render layers, because (if you run the script from a GUI session) once you get the bug, you’ll notice that the viewport is completely empty.

I’m sure you’re right and it’s Maya issue, so I opened a case with them (the issue of switching layers vie python)
I’ll post an update of how it goes.

Found the issue, wasn’t Vray or Autodesk… was me learning the new layers system.

here’s the correct code to switch layers, hope it helps someone else, even if it’s not Vray related after all.


import maya.app.renderSetup.model.renderSetup as renderSetupModel
rendersetup = renderSetupModel.instance()
layers = rendersetup.getRenderLayers()

for layer in layers:
    print ">>> {} <<<".format(layer.name())
    #layer.makeVisible()                   #< NOT TO BE USED
    rendersetup.switchToLayer(layer) #< THE CORRECT WAY
    cmds.vrend(camera="camera1")

thanks,
Asi

Ah, that makes more sense. Thanks for the input.