Hi,
I’m trying to learn how to use VRayForGrasshopper library in ghpythonlib.components. I created a simple example geometry and tried to render that using a python script. As I understand my script should trigger Vray to render an image and save it in the defined location. I’m not getting any errors when running the script, but the render process is not triggered.
The script I’m running inside a python script component is:
import ghpythonlib.components as ghcomp
import Rhino as r
#create a box
box1 = ghcomp.Box2Pt(‘0,0,0’, ‘5,5,5’, ghcomp.XYPlane(‘0,0,0’))
#create a mesh
box_m = r.Geometry.Mesh.CreateFromBox(box1,1,1,1)
#camera setup
camera_pos = ghcomp.ConstructPoint(-20,-20,10)
camera_target = ghcomp.ConstructPoint(-10,-10,7)
camera1 = ghcomp.VRayForGrasshopper.V_RayCamera(camera_pos,camera_target,fov=50,physical_exposure_on=False)[0]
#save location
imagePath = r"C:\vray_test\paa.png"
#image size
imageSize = [800,600]
#vray render geometry
render_geo = ghcomp.VRayForGrasshopper.V_RayGeometry(box_m)
#vray light rig
lightrig1 = ghcomp.VRayForGrasshopper.V_RayLightRigSimple()
#render
ghcomp.VRayForGrasshopper.V_RayRender(0,1,0,2,imagePath,imageSize,camera1,lightrig1,render_geo )
If get the imagePath, imageSize,camera, lightrig and reneder geometry variables as outputs from my python script component and plug the into a VRay Render component in Grasshopper, then right click on that component, it will render and and save the image in the specified location.
Does anyone know what I’m doing wrong? Should the ghcomp.VRayForGrasshopper.V_RayRender function trigger the render process or do I need to still trigger the render process somehow?