In V-Ray it is now possible to access the underlying scene plugins via the Rhino script tools.
A script access manual is provided with the installation of V-Ray. It can be found at the V-Ray for Rhino root folder C:\Program Files\Chaos Group\V-Ray\V-Ray for Rhinoceros\VRayForRhinoObjectModel.html
To use the V-Ray for Rhino wrapper module, add a new Python Module Search path pointing to C:\Program Files\Chaos Group\V-Ray\V-Ray for Rhinoceros.
Alternatively, copy the rhVRay.py file from C:\Program Files\Chaos Group\V-Ray\V-Ray for Rhinoceros to %APPDATA%\McNeel\Rhinoceros\6.0\scripts and %APPDATA%\McNeel\Rhinoceros\6.0\scripts.
Due to the way V-Ray for Rhino communicates with its UI, certain "user data" parameters are employed while the actual scene parameters are set accordingly only at render time.
The precise names of such "user data" parameters can be found listed in exported V-Ray files:
- for Settings - export a .vropt file
- for Assets - export an asset of the required type as a .vrmat file
Their parameter handlers contain isUserData="1"
.
To set a parameter value in the V-Ray UI via a script, the "user data" counterpart must be used. Otherwise, the change will only affect the V-Ray scene.
ParamTypes
Enumeration
Name | Value | Description |
---|---|---|
T_UNKNOWN | 0 | Undefined type. Generally an error |
T_INTEGER | 1 | Standard long integer number |
T_FLOAT | 2 | Single precision floating-point number |
T_STRING | 4 | Character string value |
T_BOOL | 8 | Boolean value |
T_TRANSFORM | 16 | Transformation value, consisting of a matrix and a vector. Equivalent to 12-element single-precision floating-point array |
T_MATRIX | 32 | Matrix value. Equivalent to 9-element single-precision floating-point array |
T_VECTOR | 64 | Vector value. Equivalent to 3-element single-precision floating-point array |
T_COLOR | 128 | RGB float color value. Equivalent to 3-element single-precision floating-point array |
T_ACOLOR | 256 | RGBA float color value. Equivalent to 4-element single-precision floating-point array |
T_LIST | 32768 | Binary OR-ed with the other type indicates that the value is a list of values of that type |
RenderModes
Enumeration
Property Name | Value | Description |
---|---|---|
RM_PRODUCTION | 0 | Renders in production mode |
RM_INTERACTIVE | 1 | Renders in interactive mode |
RM_CLOUD | 2 | Starts the current render job on the Cloud |
RM_LAST | 3 | Repeats the last render |
RenderEngines
Enumeration
Property Name | Value | Description |
---|---|---|
RE_CPU | 0 | Renders on the CPU |
RE_CUDA | 1 | Renders on the GPU and/or CPU using CUDA |
RE_RTX | 2 | Renders on the GPU using RTX Optix |
RhinoScriptComputeDeviceInfo
A structure packing all details for a GPU compute device into a single block
Property Name | Description |
Name | The name of the device |
UseForRendering | Specifies whether the device is to be used for rendering or not |
Name
Name of the device
Syntax:
BSTR
Name
Examples:
import rhVRay as vray
cudaDevices = vray.GetDeviceList(vray.RenderEngines.RE_CUDA)
name = cudaDevices[0].Name
import rh8VRay as vray
cudaDevices = vray.GetDeviceList(vray.RenderEngines.RE_CUDA)
name = cudaDevices[0].Name
using VRayForRhino;
ComputeDeviceInfo[] cudaDevices = VRay.GetDeviceList(RenderEngines.CUDA).ToArray();
string name = cudaDevices[0].Name;
Specifies whether the device is to be used for rendering or not
Syntax:
VARIANT_BOOL
UseForRendering
Examples:
import rhVRay as vray
cudaDevices = vray.GetDeviceList(vray.RenderEngines.RE_CUDA)
use = cudaDevices[0].UseForRendering
import rh8VRay as vray
cudaDevices = vray.GetDeviceList(vray.RenderEngines.RE_CUDA)
use = cudaDevices[0].UseForRendering
using VRayForRhino;
ComputeDeviceInfo[] cudaDevices = VRay.GetDeviceList(RenderEngines.CUDA).ToArray();
bool use = cudaDevices[0].UseForRendering;
RhinoScriptSceneParam
Represents a reference to a NeUI plugin parameter
Property Name | Description |
---|---|
Value | Gets or sets the value of the parameter. Must conform with the value type |
Type | Returns the data type of the parameter. Can be OR-ed with ParamTypes::T_LIST |
TypeAsString | Returns the data type of the parameter as a string |
Value
Gets or sets the value of the parameter. Must conform with the value type
Syntax:
VARIANT Value
Examples:
import rhVRay as vray
with vray.Scene.Transaction() as t:
vray.Scene.SettingsOutput.img_width *= 2
import rh8VRay as vray
with vray.Scene.Transaction() as t:
vray.Scene.SettingsOutput.img_width *= 2
using VRayForRhino;
using(Transaction t = VRay.Scene.Transaction())
{
Param img_width = VRay.Scene["SettingsOutput"].Param("img_width");
img_width.Value = (int)img_width.Value * 2;
}
Type
Returns the data type of the parameter. Can be OR-ed with ParamTypes::T_LIST
Syntax:
ParamTypes Type
Examples: