Grasshopper

algorithmic modeling for Rhino

Hello,

I am writing a batch Render command for rendering in vray... for now I am accessing the Rhino command through rs script. The following works with the default Rhino render but it does not work with vray because it closes the window before the Render is done (thus saves the rhino window after about .1 second of rendering time). Using a delay (via the time module) delays the render as well. Anyone have any idea how to proceed or is this a problem with the python implementation in grasshopper... Is there a way to access the Vray utility module for example? Thanks for your help!

rs.CurrentView(viewname)
rs.Command ("!_-Render")

saveRenderview(renderfilepath)

rs.Command ("_-SaveRenderWindowAs " + renderfilepath)

#' Close the render window
rs.Command ("_-CloseRenderWindow")

Lauren 

Views: 5578

Replies to This Discussion

Hi Lauren

a long time ago, there used to be a switch in the VRay interface that was exactly to allow -_CloseRenderWindow to wait till the end of rendering. I think it was called 'batch mode' or something similar.

EDIT: it seems it's still therre. See: Global Switches -> Misc -> Batch render:

http://help.chaosgroup.com/vray/help/rhino/150R1/render_params_swit...

I hope this helps,

Giulio

--

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Thank you I was looking for that! If only I had asked earlier!

Lauren 

Hi Lauren!

did you have any luck with this? My scene is rendering fully, but it won't save to the designated file. Any help would be much appreciated

thanks!

Dear Lauren,

I use the Python script below to Batch render in Vray. Just add the view names to the RViews list and run the script. I hope that this helps.

The VRay Batch Render option must be turned on for this to work. I also found that this does not work unless the views are included in the ViewPort Tab at the bottom of the Rhino workspace.

#Turn on Batch render in vray options before this is run

import rhinoscriptsyntax as rs

RViews = ["View1" , "View2"]

count1 = 0
for i in range(len(RViews)):
    rs.CurrentView(RViews[count1])
    rs.Command ("!_-Render")
    rs.Command ("_-SaveRenderWindowAs " + RViews[count1])
    rs.Command ("_-CloseRenderWindow")
    count1 += 1

Hi Nicolo!

thanks for the script. How do I implement it? in the C# grasshopper definition from above or in python editor? my scene is rendering fully, but not saving. does this provide a solution?

Thanks!

Hi Oliver,

You should use it in the python editor. In order to use it it is important that you turn 'batch rendering' on in Vray and also that you add all the views that you would like to render to the viewport bar at the bottom of the rhino screen:

You can modify where to save the file by modifying the line:

 rs.Command ("_-SaveRenderWindowAs " + RViews[count1])

Hello Nicolo,  

I was hoping you could furtherdescribe how to edit the line properly as I am not familiar with rhinoscript.  I have tried adding a file path and outpath but I seem to be missing the proper syntax.

import rhinoscriptsyntax as rs
RViews = ["SectionTrans002" , "View2"]
count1 = 0
Outpath = "D:\My\File\path\goes\here\"

for i in range(len(RViews)):
rs.CurrentView(RViews[count1])
rs.Command ("!_-Render")
rs.Command ("_-SaveRenderWindowAs" + Outpath + RViews[count1])a
rs.Command ("_-CloseRenderWindow")
count1 += 1

Hi Joe

this should do what you are expecting. Please make sure that indentation is the same as in this text.

import rhinoscriptsyntax as rs
RViews = ["Top" , "Perspective"]
Outpath = r"C:\my\path\here" #do NOT add trailing backslash
for i in range(len(RViews)):
    rs.CurrentView(RViews[i])
    rs.Command("!_-Render")
    command = "_-SaveRenderWindowAs \"" + Outpath + "\\" + RViews[i] + ".png\""
    rs.Command(command)
    #print command
    rs.Command("_-CloseRenderWindow")


I hope this helps,
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Thank you so much Giulio, worked like a charm.

Regards

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service