Announcement

Collapse
No announcement yet.

Issues with vrend() command inside mayapy.exe instance

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issues with vrend() command inside mayapy.exe instance

    I have been working on getting maya renders working on our farm nodes, but we need to adjust things per layer and per frame before and after.. so using vrend() in mayapy is really our only way.

    We are using:
    Maya 2016.5(Extension 2) SP2
    Vray 3.40.06

    This is a simplified version of the script we are running in mayapy, same result:
    import os, sys, platform
    import maya.standalone
    maya.standalone.initialize(name='python')
    import pymel.core as pm
    from maya import cmds

    cmds.file('C:/tmp/testFile.mb', o=True)

    pm.currentTime(frame)
    pm.setAttr("vraySettings.width", 2048 )
    pm.setAttr("vraySettings.height", 858 )
    pm.setAttr("vraySettings.fileNamePrefix", "TEST_Shot_L")
    pm.setAttr("vraySettings.fileNamePadding", 4)
    pm.setAttr("vraySettings.defaultDir", "C:/tmp/cam_L/")



    The results im getting is:
    2018-05-08 18:39:01: 0: STDOUT: V-Ray: Starting render
    2018-05-08 18:39:01: 0: STDOUT: [2018/May/8|18:39:01] V-Ray: Exporting scene to V-Ray.
    2018-05-08 18:39:01: 0: STDOUT: [2018/May/8|18:39:01] V-Ray: Parsing light links time 0h 0m 0.0s (0.0 s)
    2018-05-08 18:39:01: 0: STDOUT: [2018/May/8|18:39:01] V-Ray: Total time translating scene for V-Ray 0h 0m 0.0s (0.0 s)
    2018-05-08 18:39:01: 0: STDOUT: [2018/May/8|18:39:01] V-Ray: Render complete
    2018-05-08 18:39:01: 0: STDOUT: [2018/May/8|18:39:01] V-Ray: ========================
    2018-05-08 18:39:01: 0: STDOUT: [2018/May/8|18:39:01] V-Ray: Clearing exporter memory...
    2018-05-08 18:39:01: 0: STDOUT: [2018/May/8|18:39:01] V-Ray: Total time clearing exporter memory 0h 0m 0.0s (0.0 s)


    Its clearly not rendering, and not spitting out a file.. running the same command in the same file in maya.exe works as expected.
    pleeeeease tell me im doing something wrong, I reeeeally need this to work in mayapy.exe not only in gui mode...


  • #2
    I'm almost certain that vrend() always requires a camera, as there is no active camera in mayapy.
    Code:
    pm.vrend(camera='renderCam').
    Although this might work in your case, keep in mind that vrend() is not the most suitable way to start a render, as this will *not* run your pre-render, post-render scripts and so on.

    We use mayapy for our test automation, but instead of vrend() we use the batch render command from the OpenMaya module. We do, however, need this, because for some tests we rely on pre-render scripts to dynamically build parts of the scene, for example.

    Here's an excerpt from our automation with mayapy:

    Code:
    import maya.OpenMaya as OpenMaya
    
    OpenMaya.MGlobal.executeCommand("""
                source supportRenderers;
                mayaBatchRenderProcedure(0, "", "", "vray", "");
            """)
    Alex Yolov
    Product Manager
    V-Ray for Maya, Chaos Player
    www.chaos.com

    Comment


    • #3
      Thanks!
      To confirm, vrend did work once we gave it a camera and the render layer. We have a wrapper that we pass all our kwargs into for the main render process, this wrapper then generates a python script for each job on our farm that sets up the mayapy instance with the correct Environment, then controls the opening of the file, switching of frames before rendering etc, this also allows us to put any python commands anywhere around the renders as needed, It means we can also adjust it per job after its been submitted as well and is straightforward and easy to debug on the farm as its written in a single python file only 70-100 lines long with a clear order to it.

      We had to pass the layer, but vrend does not set the RenderPath properly for the layer change, so we had to switch the current layer first:
      Code:
      pm.setAttr('renderLayerManager.currentRenderLayer', pm.getAttr('{}.identification'.format(layer)))
      pm.vrend(camera=camera, layer=layer)
      I was not aware of the batch render command in OpenMaya, I will definitely take a look at that, if we hit more issues with vrend, then we will use that.

      Thanks again

      Comment


      • #4
        Hmm, there is indeed something wrong with vrend(layer='<layer>'), I'll log a bug with the developers.
        Last edited by yolov; 14-05-2018, 06:19 AM.
        Alex Yolov
        Product Manager
        V-Ray for Maya, Chaos Player
        www.chaos.com

        Comment

        Working...
        X