Announcement

Collapse
No announcement yet.

V-Ray for Rhino 1.5 -- is command line/automated rendering still possible?

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

  • V-Ray for Rhino 1.5 -- is command line/automated rendering still possible?

    A Rhino command line sequence using V-Ray for Rhino prior to 1.5, such as:

    “c:\program files\Rhinoceros 4.0\system\Rhino4.exe” /runscript=“_SetCurrentRenderPlugIn V-Ray for Rhino render -saverenderwindowas test.jpg closerenderwindow -exit” hdri_test.3dm
    (e.g. http://wiki.mcneel.com/developer/commandline)

    would launch a render and save the result, the success a result of the render window being modal (correct term?) so that the -saverenderwindowas command could not execute until the rendering was finished. With V-Ray for Rhino 1.5, the render window is no longer modal, the "-saverenderwindowas" command executes as soon as there is a render window to find, and the result is an incomplete 1K file.

    This command line approach is one that renderfarm applications use to submit jobs but it's not clear now how a scripted approach would be able to determine when a rendering had finished and so execute a save sequence at the appropriate point. This is probably not the only multithreaded version of V-Ray (it's the only one we use) and V-Ray seems to be a commonly supported renderfarm application (e.g. for 3DS Max); is there an approach to this?
    Last edited by dkendig; 12-07-2012, 11:54 AM. Reason: made this thread sticky - it has some useful scripting information that others may find useful

  • #2
    I believe you should just make sure that scene file has the "Global switches" option "Batch render" checked. "Batch render" means it will block until the render is done.

    Here is the script I used to do it, notice I use our Plugin's GUID instead of name, because our name "V-Ray for Rhino" has spaces and that throws off the command line parser. I also made sure the model in question had "Batch render" enabled. I am not sure if we have a way to force batch render on all from command line, but I'll look into it for you.

    Code:
    "C:\Program Files\Rhinoceros 5.0 Beta (64-bit)\System\Rhino.exe" /runscript="_SetCurrentRenderPlugIn E8CFE179-B60C-411A-8416-62A893334519 render -saverenderwindowas test.jpg closerenderwindow -exit" "c:\Users\jbacigalupa\Downloads\problem.3dm"
    I hope this helps
    Best regards,
    Joe Bacigalupa
    Developer

    Chaos Group

    Comment


    • #3
      Here is how I programmatically made sure batch render was turned on. I put this stuff in a rhinoscript file and just directed Rhino to run the rhinoscript file. So here is the modified version

      Code:
      "C:\Program Files\Rhinoceros 5.0 Beta (64-bit)\System\Rhino.exe" /runscript="_SetCurrentRenderPlugIn E8CFE179-B60C-411A-8416-62A893334519 -_LoadScript c:\Users\jbacigalupa\Desktop\batch_render.rvb _render -saverenderwindowas test.jpg closerenderwindow -exit" "c:\Users\jbacigalupa\Downloads\problem.3dm"
      Then the rvb file is...
      Code:
      Option Explicit
      
      Dim vfr_object
      Set vfr_object = Rhino.GetPluginObject("V-Ray for Rhino")
      vfr_object.SetBatchRenderOn True
      You will need to make sure the paths matchup on your machine, the batch file I've posted has absolute paths for my own machine, but otherwise it should work fine.
      Best regards,
      Joe Bacigalupa
      Developer

      Chaos Group

      Comment


      • #4
        Thanks for this. From what I can see in the file I'm testing we do have "Batch Render" checked and we have been able to run the McNeel script from the Windows command line (by double-quoting ""V-Ray for Rhino""). As we keep testing this we've found that a simple file (a few boxes) created in Rhino 5 does render as expected; it's a much more complex file, that started as a Rhino 4 file, that doesn't. Possibly there's some complication in the V-Ray settings that get stored in the Rhino file as files get saved between Rhino 4/V-Ray 1.05.29 and Rhino 5/V-Ray 1.5; there seems to be an issue with textures, for example, which don't appear in the Material Editor in 1.05.29 when a file is saved down from Rhino 5/V-Ray 1.5. I'll strip this back down, starting with a newly loaded machine, and then build back up through the combinations to see where we run into problems.

        Comment


        • #5
          1.5 scenes will not work in 1.05.29 at all, you are correct. 1.05.29 scenes should render with 1.5 though.
          Best regards,
          Devin Kendig
          Developer

          Chaos Group

          Comment


          • #6
            Thanks. That's the authoritative answer we were looking for. In retrospect it seems pretty logical that would be the case although there were so many things that "almost" worked when going from 1.5 to 1.05 -- nothing crashed, the Options selections looked right, the file rendered with materials (although the 1.05 Material Editor couldn't see them) -- that it didn't stand out that it wasn't going to work. On the up side, the ability to use rvb files to control V-Ray settings hadn't occurred to us and that could be very useful, by automatically correcting or confirming some settings students make when they submit their files; thanks, Joe, for that.

            Comment


            • #7
              joe_b's suggestion turned out to be the rest of the answer we needed. Even limiting our testing to 1.05 files rendering under 1.5 we still ran into the same problems using the McNeel script until we implemented his .rvb addition (above) to the command sequence, forcing "Batch Render" to "on". Before that we found that even though a file created using 1.05 with "Batch Render" checked would still show that setting when opened in 1.5, and the file would render normally when done interactively in Rhino, it would fail when the rendering was set to run via the McNeel render script. By including joe_b's addition to the command line we can now get 1.05 files rendered by script under 1.5 in either Rhino 4 or Rhino 5. This is really good, because otherwise there was no way to renderfarm a file created in 1.05 unless you were running 1.05 -- we had found no way to "upgrade" a 1.05 Rhino file (e.g. by saving it under 1.5 first, etc.) so that it would work with a render script under 1.5. Now it works; many thanks.

              Comment


              • #8
                As as follow-up to joe_b's example, how do we get a list of the named objects (e.g. "SetBatchRenderOn") and their parameters (e.g. "SetRenderOutputSize (imgw, imgH)) that are used in the V-Ray for Rhino settings? There are several others whose values we'd consider setting -- Distributed Render "On" is one -- if we knew how to identify them. The basic Rhino Script methods are listed (http://www.rhino3d.com/5/rhinoscript/index.html); is there a corresponding list for the V-Ray objects?

                Comment


                • #9
                  Going a little further on this, there is a listing of what appears to be available methods when you open the plug-in in a general text editor (below). Two of the previously mentioned methods (SetBatchRenderOn and SetRenderOutputSize) are listed but there is nothing specific about setting distributed rendering. There is, however, a small group of more general methods in the list, like "SetOptionParameterValueBool", that look like they take additional variables (at least, the error message asks for variable values when you drop the method in the .rvb file given above). Is this heading in the right direction? Does this method allow you to set the value of one of the checkbox variables like distributed rendering? Is this another version of the "what are they called" question, where now the question is how to identify the variable you want to change (along with the method parameters)? Again, this may all be very basic for programmers (no pun intended) -- I'm not one so my descriptions and expectations may be incorrect. The fundamental assumption I'm making is that something that you can change by hand can be automated and this is an attempt to see how this might be done.

                  AddResourceSearchPath AddVFBChannelByName ApplyVRayMaterialToObjects ApplyWrapperMaterialToObjects ApplyWrapperMaterialToSelection ChangeMaterialSourceForObjects DeleteMaterial DllCanUnloadNow DllGetClassObject DllRegisterServer DllUnregisterServer DoneWithString DoneWithStringArray DrawTextureToContext GetAlphaContributionForMaterial GetDependentMapsForVismat GetDependentMapsForVisopt GetDepthOfFieldAperture GetDepthOfFieldFocalDist GetDepthOfFieldFocalDistOn GetDepthOfFieldSides GetDepthOfFieldSidesOn GetDepthOfFieldSubdivisions GetMaterialNameFromVismat GetObjectExclusionForMaterial GetObjectExclusionShortCircuitForMaterial GetOptionParameterValueBool GetOptionParameterValueDouble GetOptionParameterValueFloat GetOptionParameterValueInteger GetOptionParameterValueString GetSceneMaterialNames GetWrapperMaterialFromObject HasRenderFinished LoadDirectoryOfVismats LoadVismat LoadVisopt PurgeUnusedMaterials RemoveVFBChannelByName Render3dmPathToContext Render3dmToContext Render3dmWidePathToContext RenderActiveDocToContext RenderBinary3dmToContext RhinoPlugInDeveloperAddress RhinoPlugInDeveloperCountry RhinoPlugInDeveloperEmail RhinoPlugInDeveloperFax RhinoPlugInDeveloperOrganization RhinoPlugInDeveloperPhone RhinoPlugInDeveloperWebsite RhinoPlugInSdkServiceRelease RhinoPlugInSdkVersion RhinoPlugInUpdateURL SaveMaterial SaveMaterialToFile SaveOffscreenRenderToPath SaveOffscreenRenderToWidePath SaveVFBRenderToPath SaveVFBRenderToWidePath SaveVisopt SetAlphaContributionForMaterial SetAnimationOn SetAnimationType SetBatchRenderOn SetDepthOfFieldAperture SetDepthOfFieldFocalDistOn SetDepthOfFieldOn SetDepthOfFieldSidesOn SetDepthOfFieldSubdivision SetFrameStamp SetObjectExclusionForMaterial SetObjectExclusionShortCircuitForMaterial SetOffscreenRenderModality SetOptionParameterValueBool SetOptionParameterValueDouble SetOptionParameterValueFloat SetOptionParameterValueInteger SetOptionParameterValueString SetProgressWindowOn SetRenderOutputEnable SetRenderOutputSaveFile SetRenderOutputSize SetThreadPriorityOn

                  Comment


                  • #10
                    There used to be a way to get this information to load up in the MonkeyScriptEditor plugin, but since that has been added to the core of Rhino, it seems that it's not really possible anymore. So the best way to view this information, would be to open our tlb file (C:\ProgramData\ASGVIS\VfR(insert rhino version info here)\VRayForRhino.tlb) with Microsoft Visual Studio, or some other 3rd party tool (be careful!).

                    Click image for larger version

Name:	tlbView.png
Views:	1
Size:	174.2 KB
ID:	845793

                    We have had this question come up in the past, and our usual response was just a dump of the current state of our rhinoscript stuff, but the problem with that solution, is that we update this from time to time, which means the dumps we have provided in the past are no longer accurate. Opening the tlb file with Visual Studio (or there may be 3rd party programs out there that also allow you to view these types of files). You should see all of the commands and parameters needed for scripting. I hope this helps.
                    Best regards,
                    Devin Kendig
                    Developer

                    Chaos Group

                    Comment


                    • #11
                      Yes, this is very helpful. The .rvb script below does what we were looking for -- it sets both distributed rendering and asset collection on. Not setting distributed rendering on was one of the more common mistakes our students made in using our renderfarm. We'll look through the rest to see what other commands we can use.

                      Option Explicit

                      Dim vfr_object
                      Set vfr_object = Rhino.GetPluginObject("V-Ray for Rhino")
                      vfr_object.SetDistributedRenderingOn True
                      vfr_object.SetDistributedRenderingAssetCollectionO n True

                      Comment


                      • #12
                        I'm glad to hear it was helpful. If you figure out any neat tricks or tips, please share them with the community. Knowledge is power, and the more people we have bouncing ideas off one another, the more we will be able to expand our product's functionality, and the more powerful the product will become!
                        Last edited by dkendig; 12-07-2012, 11:59 AM. Reason: I've made this thread a sticky thread until we can rewrite the useful information here as a reference resource for our users
                        Best regards,
                        Devin Kendig
                        Developer

                        Chaos Group

                        Comment


                        • #13
                          iTripoli offers a freeware type library viewer (http://www.itripoli.com/itlv.asp) that lists the methods and their parameters in the .tbl file.

                          Comment


                          • #14
                            I came across that application as well, but I chose Visual Studio, because we use it to make our products. That app is made by a 3rd party vendor I do not know at all. I tried it, and it did the same exact thing that visual studio was able to do, so I saw no added benefit, other than install size, that would justify suggesting an untrusted vendor to our users. If you trust it, then yes, it should do the same job as Visual Studio in theory.
                            Best regards,
                            Devin Kendig
                            Developer

                            Chaos Group

                            Comment


                            • #15
                              It seems that many of the objects found in the .tbl file seem to be nonfunctioning when I call them with Rhinoscript or Python. I'm particularly interested in those related to the physical camera, but all the "GetPhysicalCameraXXX" or "SetPhysicalCameraXXX" objects don't change anything (or report the correct status). No error messages. Are these not implemented, or am i missing something? I have the latest release.

                              Thanks!
                              emil mertzel
                              vray4rhinoWiki

                              Lookinglass Architecture and Design

                              Comment

                              Working...
                              X