Announcement

Collapse
No announcement yet.

Vray Stand alone launch from Python tutorial?

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

  • Vray Stand alone launch from Python tutorial?

    I want to setup Vray stand alone to run from a launcher in Maya with one off settings so I can basically create a few quick render buttons that don't use the render settings in the render settings UI. I just want to do this so that even if I have settings I like I can just fire a one off without changing them.

    Is there a basic run down of the commands I would use to get this started?

    Probably python based command.

    Any documentation on it somewhere?

    Thanks
    ------
    KC

  • #2
    frames = 100
    split = 1
    location = "/Users/yourname/Desktop/testing/testScene"

    # Create a list of render frames evenly split

    framesToRender = frames/split
    listToRender = []
    start = 1
    end = framesToRender

    for i in range(0, split):
    listToRender.append([start, end])
    start += framesToRender
    end += framesToRender

    # Make sure final element == to frames

    listToRender[-1] =[listToRender[-1][0], frames]


    # init vrscene mode

    vray = pm.ls('vraySettings')[0]
    DRG = pm.ls('defaultRenderGlobals')[0]

    vray.vrscene_render_on.set(0)
    vray.vrscene_on.set(1)
    DRG.animation.set(1)
    vray.animBatchOnly.set(0)

    # Set and Render

    for i in range(0, len(listToRender)):
    DRG.startFrame.set(listToRender[i][0])
    DRG.endFrame.set(listToRender[i][1])
    vray.vrscene_filename.set(location+"_s"+str(listTo Render[i][0])+"_e"+str(listToRender[i][1])+".vrscene")
    frames = 100
    split = 1
    location = "/Users/yourname/Desktop/testing/testScene"

    # Create a list of render frames evenly split

    framesToRender = frames/split
    listToRender = []
    start = 1
    end = framesToRender

    for i in range(0, split):
    listToRender.append([start, end])
    start += framesToRender
    end += framesToRender

    # Make sure final element == to frames

    listToRender[-1] =[listToRender[-1][0], frames]


    # init vrscene mode

    vray = pm.ls('vraySettings')[0]
    DRG = pm.ls('defaultRenderGlobals')[0]

    vray.vrscene_render_on.set(0)
    vray.vrscene_on.set(1)
    DRG.animation.set(1)
    vray.animBatchOnly.set(0)

    # Set and Render

    for i in range(0, len(listToRender)):
    DRG.startFrame.set(listToRender[i][0])
    DRG.endFrame.set(listToRender[i][1])
    vray.vrscene_filename.set(location+"_s"+str(listTo Render[i][0])+"_e"+str(listToRender[i][1])+".vrscene")
    #pm.render()
    #pm.batchRender()

    pm.vrend()
    ------
    KC

    Comment


    • #3
      That doesn't run V-Ray Standalone as such though, does it? Or you didn't mean the standalone as a separate process?

      Best regrads,
      Vlado
      I only act like I know everything, Rogers.

      Comment


      • #4
        No it doesn't I just found that online as a way to launch on off renders with settings etc....but, I was thinking it would be along these lines. Is there any doc for creating the python/mel for launching vray standalone? I will be tasked with creating very specific folders where all the EXRs will land and want to create a framework where new artists coming in will already have everything set up for them so that they can render and see it update in Nuke immediately for tests.

        I saw this page... but I am looking for a tutorial breakdown so I understand the methodology.

        http://docs.chaosgroup.com/display/V...e+Command+Mode

        Also, I think they have one 2.4 license at this new place and so we are upgrading to 3.1 through Motion media in Santa Monica. Does the standard license come with the ability to launch stand alone or do we have to buy separate standalone licenses?

        I mean we are getting 10 render nodes licenses for the farm but I wasn't sure even if that is a "standalone" license.

        Thanks
        Last edited by Intuition; 11-12-2015, 10:21 AM.
        ------
        KC

        Comment


        • #5
          I think you will need Appsdk for such purposes, but in order to be sure about that I have to discuss it with our developers first. Would it be possible to create a ticket about this request ? Just send us an email to support@chaosgroup.com


          Also, I think they have one 2.4 license at this new place and so we are upgrading to 3.1 through Motion media in Santa Monica. Does the standard license come with the ability to launch stand alone or do we have to buy separate standalone licenses?
          No separate license is needed in this case.
          In V-Ray version 3 we have introduced universal Render node license which allows the user to render with V-Ray plugin integrated in different 3d packages. So if there is free Render node licenses a user will be able to render with V-Ray for Maya or Standalone for an example.
          Tashko Zashev | chaos.com
          Chaos Support Representative | contact us

          Comment


          • #6
            I mean, we created this at Digital Domain already. We launched Vray standalone from Maya using our own internal Render Layer management UI.

            It would run Standalone from command line in Linux after being launched from within Maya. It had the renderlayer settings/membership/overrides etc all intact and would render to standalone. This would then be written to a file location set in the UI and was also corresponding to a location where a nuke read node would pick up the renders sequentally so render tests would go from 0-100 (or how ever many render test images you needed for lookdev/lighting/etc).

            What I was hoping to get is a tutorial or guidelines from launching standalone from within Maya using Python or mel or both using commands that would talk to linux or whatever OS so I could quickly set this up vs having to piece it all together from info available but not directed towards this end.

            There were a few people involved in the process at DD so I didn't get to learn the entire process but am attempting to set it up now.

            Basically this --

            1 - I create a UI that can take settings that may or may not be the same settings in the render settings UI in maya. This way I can launch temporary test render settings OR use the render settings.
            2 - Once chosen and the render button is pressed the UI launcher then sends for Standalone to launch (using either "one off test render" settings/presets or "render settings")
            3 - Standalone window VFB shows up and renders as usual and writes to a file somewhere as the buckets complete. Since it is stand alone it doesn't lock up maya and I can tweak in Maya in the bg while a render works it self out, especially if I save a processor core or two for maya's processes.
            4 - This file being written can be accessed by Nuke as it is being completed bucket by bucket.

            We had this at DD and I am attempting to replicate it again and can do all of it except the Vray Standalone Launch because I need more info on Standalone commands.

            I didn't think this is an Appsdk level item but rather something that could be scripted and command lined.
            Last edited by Intuition; 15-12-2015, 11:12 AM.
            ------
            KC

            Comment


            • #7
              I started here

              https://knowledge.autodesk.com/suppo...-line-htm.html

              Then I of course am looking at this.

              http://docs.chaosgroup.com/display/V...e+Command+Mode

              I am piecing it together but was hoping there was a resource for it.

              I will eventually figure it out. I ordered new dongles to be setup for the new 3.1 licences here so we can run 2 workstation licenses with 10 render nodes to start and expand as we need later.

              This is a place where they usually render Houdini, C4D, or Modo. I am bringing in the Maya Vray workflow. So far they like what they see. But, if I am going to be here a bit I want to get automation back to nominal.
              Last edited by Intuition; 15-12-2015, 12:00 PM.
              ------
              KC

              Comment


              • #8
                Hi,

                I don't think this is a "VRay question", but more about Python, true ?
                Just use subprocess and other python things. PySide for your UI, blabla...

                Btw, i try to understand what do you want to do but...i don't ahah.
                www.deex.info

                Comment


                • #9
                  Yes, it is basically using Python, or MEL, to launch Vray standalone from inside Maya with specific settings.

                  Write out a VRSCENE file somewhere with all the render settings I determine in the script.

                  Just wanted to see if there was a general direction to start in or do I just start using commands until I get what I need?

                  I figured there would be usage examples somewhere already is all.

                  The UI stuff and everything else I can do already. Sorry about the lengthy description.
                  ------
                  KC

                  Comment


                  • #10
                    What you want to do is comprised of two parts:
                    1. You have to export a vrscene files. To do so you need to use the vrend command in Maya. Search the forum for examples. There should be plenty.
                    2. You need to launch the vray standalone using the subprocess module in python. For launching the executable search the internet for tutorials about python's subprocess module or read the docs. The only unknown left is the command line - the arguments you need to pass to V-Ray Standalone. To learn more about them just start V-Ray Standalone in terminal and it will print its options. If it doesn't use the -help switch.

                    If you implement these two steps, then you'll have the basic system working, after that you can expand it if you need certain features.
                    V-Ray developer

                    Comment


                    • #11
                      Ok thank you. I got the standalone docs this morning.

                      This is basically the breakdown I wanted. The general gist of it.

                      Much appreciated.
                      ------
                      KC

                      Comment


                      • #12
                        Is there a place where I can find the vrend command flags and options?

                        Today I simply just want to export the .vrscene file with MEL or Python.

                        I did a forum search but much of the text is based in 2011 which is pre-vray 3.1 and and doesn't cover the vrend command usage.

                        Quite simply along the lines of

                        vrend -export "/Share/linuxpath/vraytest_01.vrscene";

                        I've seen these entries in the script editor clicking the check boxes in the translator

                        setAttr "vraySettings.vrscene_render_on" 0;
                        setAttr "vraySettings.vrscene_on" 1

                        I am able to launch standalone from the linux terminal from inside maya and render the vrscene file. Just need an elegant way of getting the vrscene file out of maya without pressing the render button.
                        I mean I could just create scripted lines that set the attrs above and then launch the render and then reset the buttons back. Yet, I am looking for a more direct way of making the file and modifying the file from inside maya.

                        Thanks for any help
                        Last edited by Intuition; 14-02-2016, 11:48 AM.
                        ------
                        KC

                        Comment


                        • #13
                          Originally posted by Intuition View Post
                          I mean I could just create scripted lines that set the attrs above and then launch the render and then reset the buttons back. Yet, I am looking for a more direct way of making the file and modifying the file from inside maya.
                          There's not a more direct way for the moment I'm afraid. The other option is to use the -exportFileName and -noRender options of the Maya batch renderer, but obviously that would require launching a batch render.

                          Best regards,
                          Vlado
                          I only act like I know everything, Rogers.

                          Comment


                          • #14
                            Thanks for the response Vlado. I will make due with what is available. It isn't a problem. Just wanted to make sure I wasn't overlooking an available option if one already existed.
                            ------
                            KC

                            Comment


                            • #15
                              So I did create this launcher way back. The only gotcha was that I had to ... by hand... click the render into window button to write out the vrscene file. Then it would properly launch. It works in centOS sending the system command to a gnome terminal.

                              Code:
                              // VRAY STANDALONE to NUKE for TIMBER 2016 by Casey C Benn
                              
                              //Export Scene to vrscene file format here   --- 
                              
                              //setAttr "vraySettings.vrscene_on" 1
                              
                              //set VRSCENE file name AND directory location based on MAYA scene file name
                              
                              //Store Maya scene file name and path in string variable first
                              
                              string $mySceneFile= `file -q -sn`;
                              print $mySceneFile;
                              
                              // Take last three characters off of the end of the scene file name to capture file name for VrayScene file.
                              
                              string $endStr = endString($mySceneFile, 3);
                              print $endStr;
                              string $myVrsName = basename($mySceneFile, $endStr);
                              print $myVrsName;
                              
                              
                              // Store Directory to Scene file in string variable based on Maya Scene File name variable.
                              
                              string $myMayaPath = dirname ($mySceneFile);
                              print $myMayaPath; 
                              
                              // Use string variable scene file name to name and place equivelant vrascene file correctly in UI and update. 
                              
                              setAttr -type "string" vraySettings.vrscene_filename (($myMayaPath+"/")+($myVrsName+".vrscene"));
                              
                              setAttr "vraySettings.vrscene_render_on" 0;
                              setAttr "vraySettings.vrscene_on" 1
                              
                              // Using renderIntoNewWindow to write out vrscene file.
                              //RenderIntoNewWindow; This is the part I have to manuall do by pressing the render button in Maya. This will write the Vray Scene file to disk. 
                              
                              renderIntoNewWindow render;
                              
                              //Send command to terminal to start Vray Standalone
                              
                              system (("gnome-terminal -x bash -c `/usr/autodesk/maya2015-x64/vray/bin/vray -scenefile= ")+($myMayaPath+"/")+($myVrsName+".vrscene && exit`"));
                              Sorry, bunch of crappy comments in there to keep my iterations of code clear.

                              Anyways.. I can launch from Maya with this save for the writing the VrScene file... so it never fully launches unless I've manually pressed the render button in maya once to update the write to Vrscene file.

                              Is there a new command in vray 3.4.x to write out the VrScene file without having to press the render button in maya?

                              Thanks.

                              CB
                              Last edited by Intuition; 01-08-2016, 11:04 AM.
                              ------
                              KC

                              Comment

                              Working...
                              X