vray.VRayRenderer¶
- class vray.VRayRenderer¶
Bases:
object
This is the main object in V-Ray. It contains scene data and provides various methods for rendering control. It is the ‘client’ side in distributed rendering, where multiple servers can be attached (both AppSDK VRayServer objects and V-Ray Standalone processes).
VRayRenderer() optional constructor arguments:
enableFrameBuffer, bool - whether to initialize VFB GUI (default True)
showFrameBuffer, bool - whether to show the VFB when rendering starts (default True)
noRenderLicensePreCheck, bool - skip checking render license at construction time (default False)
previewRenderer, bool - optimize the renderer for small preview purposes (default False)
allowInvalidCharactersInPluginNames, bool - allow invalid characters in plugin names (default False)
hideToSceneButton, bool - hide light mix transfer <To Scene> button in VFB(default False)
useVfbLog, bool - use the built-in VFB log (default True)
pluginLibraryPath, string - additional, non-default plugin library paths to load vray_*.dll (libvray_*.so)
vfbDrawStyle, string - one of ‘auto’, ‘standalone’, ‘3dsMax’, ‘3dsMaxQt’, ‘maya’ (default auto)
vfbLanguage, string - from vray.Language - A language code string for the VFB
Notes on threading:
Rendering is always started in a separate thread. In Interactive mode changes to the scene are disabled for the period between calling start and receiving the ‘started’ event. After that changes can be made in the VRayRenderer thread. They get applied asynchronously to the V-Ray engine in its own threads.
VRayRenderer callbacks are emitted from their own separate dedicated thread where events are queued and dispatched. This means that they may be seen later than the precise time they occurred and in some cases the state of the renderer could have changed meanwhile. The callbacks that you attach should be fast because their execution blocks any other queued event callbacks.
Attributes
Apply changes to renderer immediately if True (default).
If an image passed in the BucketReady event parameters is needed.
Get/set current camera plugin.
Camera name override.
Returns a dictionary of V-Ray class categories.
Returns a dictionary of V-Ray classes (plugin types).
Renderer already closed and unusable if true.
Returns or sets the crop region as a tuple or a dictionary (empty to reset)
Get the current value (in seconds) of the relative time used in event callbacks
Frame number (int) to render when NOT in sequence mode.
Returns whether the last rendered frame was skipped (e.g.
True if V-Ray is rendering internally half resolution (the images/data returned are upsampled to full resolution).
Specify whether the executing process participates in the rendering (when true, default)
When set to True V-Ray won’t quit interactive rendering even if timeout or noise threshold are reached.
Get the last error that occurred when a method was called.
Get/set the number of threads V-Ray will use for rendering.
Gets/sets current renderer options dictionary.
Returns whether Interactive rendering is paused.
Returns a dictionary of V-Ray plugin instances.
Returns a Profiler wrapper object with methods related to the VRay Profiler
If an image passed in the ProgressiveImageUpdated event parameters is needed.
Returns render elements wrapper object.
True if the renderer is idle and the frame has been rendered or failed.
Gets/sets current render mode.
Returns or sets the render region as a tuple or a dictionary (empty to reset):
True if the renderer is idle and the whole sequence has been rendered or failed.
Returns or sets the output image size as a tuple.
Returns the current state of the renderer.
The time (float) for animated properties.
When this is True, setting property values will use the current ‘time’ or ‘frame’ to create keyframes for animation.
Returns a VFB wrapper object with methods related to the VFB.
Enable the Visual Debugger.
Methods
__init__
(*args, **kwargs)Adds V-Ray servers to the current renderer.
Add a key-value pair to VRay Profiler metadata under a specific category (key).
Appends a vrscene file to the current scene.
Appends a vrscene from text string.
Appends a vrscene from a text string using a plugin filtering callback.
Appends a vrscene file using a plugin filtering callback.
Render buckets closer to the specified (x, y) position first.
Removes all values from animated properties with keyframe times less than or equal to the given time.
Clears the last error.
Removes all values from animated properties with keyframe times less than or equal to the given time, but only from plugins of the given categories.
Wipes the scene contents (all plugin instances).
Closes the renderer.
Commits any accumulated scene changes.
Resumes sequence rendering with the next frame.
Deletes multiple plugins at once (faster than deleting plugins one by one).
Run denoiser immediately.
NOTE: Available in DR2 only.
NOTE: Available in DR2 only.
Exports the scene to a .vrscene file.
Returns all active V-Ray servers attached to the current renderer.
Returns all V-Ray servers attached to the current renderer.
Returns the auto-exposure(“autoExposure”) and auto-white balance(“autoWhiteBalance”) values computed during the last light cache calculation.
Returns the whole scene bounding box excluding infinite primitives.
Returns the last change index for interactive changes on the renderer instance.
Returns a list of dicts describing the available devices for CUDA rendering.
Returns a list of dicts describing the available devices for denoising.
Returns a list of dicts describing the available devices for Metal rendering.
Returns a list of dicts describing the available devices for Optix rendering.
NOTE: Available in DR1 only.
Returns a copy the current image as VRayImage.
Returns all inactive V-Ray servers attached to the current renderer.
Returns an native handle (pointer) of this VRayRenderer instance.
Returns RT renderer statistics: ‘paths per second’, ‘elapsed ticks’, ‘sample level’, ‘current nose threshold’, ‘current progress’, information for each compute device and memory usage per memory type category.
Get the value of a VFB context menu checkbox item. Arguments: * commandId, integer - Id of the menu item. .
Convenience function for checking if a state value is in the rendering subset (including preparing).
NOTE: Available in DR2 only.
Convenience function for checking if a state value is in the idle subset (including IDLE_FRAME_DONE awaiting continue command).
Loads a vrscene file.
Loads a vrscene from text string.
Loads a vrscene from a text string using a plugin filtering callback.
Loads a vrscene file using a plugin filtering callback.
Pauses RT rendering.
Return the first scene Node object intersected at the given pixel.
Return the scene Node objects intersected at the given pixel.
Removes V-Ray servers from the current renderer.
Begins rendering an animation sequence in a separate thread.
Resets the hosts list for distributed rendering.
Resumes RT rendering.
Saves the caustics with the specified filename.
Saves the irradiance map with the specified filename.
Saves the light cache with the specified filename.
Saves the photon map with the specified filename.
Serializes the whole scene (plugins with their property values)…
Enable or disable bitmap caching between renders.
Pass a list of devices indices (matching the getComputeDevicesCUDA list) to use for CUDA rendering.
Pass a list of devices indices (matching the getComputeDevicesDenoiser list) to use for denoising when GPU denoiser is selected.
Sets the user environment to the currently selected devices for each engine.
Pass a list of devices indices (matching the getComputeDevicesMetal list) to use for Metal rendering.
Pass a list of devices indices (matching the getComputeDevicesOptix list) to use for Optix rendering.
NOTE: Available in DR1 only.
Selection for Debug Shading Isolate Selected mode.
Initializes some settings plugins to recommended values.
Set search paths for scene include files.
Set noise threshold for a frame when using interactive mode.
Sets maximum paths per pixel when using the interactive engine.Value 0 means unlimited.
Set a timeout value (in milliseconds) for a frame when using interactive mode.
Sets a callback to be executed when rendering of a bucket has failed.
Sets a callback to be executed when a new bucket has started rendering.
Sets a callback to receive completed buckets from production rendering.
Sets a callback to be executed when a DR host is connected.
Sets a callback to be executed when a DR host is disconnected.
Sets a callback to receive when V-Ray encounters a licensing error (in its rendering thread). Arguments: * callback - see below.
Sets a callback to be executed for the light mix transfer to scene callback
Sets a callback to receive text messages from V-Ray.
Sets a callback to be executed when a post-processed image is available.
Sets a callback to receive progress increments for the current V-Ray task.
Sets a callback to receive a new image from progressive rendering when available.
Sets a callback to be executed when the ‘transform’ or ‘fov’ property of RenderView has been changed.
Sets a callback to be executed when the renderer state changes.
Sets a callback to be executed when the user initiates Upload to Collaboration
Sets a callback to be executed when the VFB Add ‘Render Element’ to scene button is pressed.
Sets a callback to be executed when the close button in VFB is pressed.
Sets a callback to be executed when a custom context menu item is selected
Sets a callback to be when the ‘Duplicate to host frame buffer’ button in VFB is pressed.
Sets a callback to be executed when the VFB Pause IPR button is pressed.
Sets a callback to be executed when the RenderInteractive button in VFB has been pressed.
Sets a callback to be executed when the RenderLast button in VFB has been pressed.
Sets a callback to be executed when the message window button in the VFB is clicked.
Sets a callback to be executed when the VFB Update IPR button is pressed.
Sets the maximum difference threshold between two progressively sampled images returned by V-Ray
Sets the maximum interval in milliseconds between image events in V-Ray progressive rendering
Enable or disable resumable production rendering
Set the value of a VFB context menu checkbox item. Arguments: * commandId, integer - Id of the menu item. * value, integer - Value to set. 0 means cleared and 1 means ticked. .
Set menu items for the VFB’s context menu. Arguments: * MenuItem dictionary:.
Sets up the VRay Profiler.
Begins rendering in a separate thread.
Begins rendering in a separate thread.
Stops the rendering.
Update the lighting analysis render element.
Waits for the rendering to finish.
Waits for the rendering of an animation sequence to finish.
Waits for the VFB window to be closed or hidden.
- addHosts()¶
Adds V-Ray servers to the current renderer.
- Arguments:
hostlist, list/tuple of host names or ip:port strings
Return values:
-2 - Failed to resolve hostname
-1 - Renderer is invalid or in the PREPARING state
0 - Hosts were added to the list, but failed to connect
1 - Hosts were successfully added and connected if rendering was in progress
2 - Hosts were successfully added to the list, but weren’t connected due to lack of work
Note: Connection is not established until rendering starts
- addVRayProfilerMetadata()¶
Add a key-value pair to VRay Profiler metadata under a specific category (key). Should be called as early as possible before setVRayProfiler, otherwise it will have no effect.
- Arguments:
category - string a key to which the key-value pair will be added
key - string a preferably unique identifier. If duplicated the last value entry will be set to correspond to this key
value - string the value to the corresponding key.
Returns true if the key-value pair has been successfully added and false if there was a problem
- append()¶
Appends a vrscene file to the current scene. Blocking call.
filenames, string or list of strings. One or more files are accepted. They are interpreted as one. If one fails, they all fail.
drSendNameOnly, optional bool Indicates whether the whole file should be sent to the DR hosts or the name only. This is not taken into account if there are multiple scenes to append.
The file is loaded without wiping the current scene. This is similar to the #include directive in vrscene files. The appendFiltered() method is even more useful as it can discard unwanted parts of the scene being appended.
- appendAsText()¶
Appends a vrscene from text string. Blocking call.
sceneContent, string or list of strings - texts that are in valid vrscene syntax. One or more texts are accepted. They are interpreted as one. If one fails, they all fail.
Same as append() but reads directly from memory.
- appendAsTextFiltered()¶
Appends a vrscene from a text string using a plugin filtering callback. Blocking call.
sceneContent, string or list of strings - text that is in valid vrscene syntax One or more texts are accepted. They are interpreted as one. If one fails, they all fail.
filter, function(string, string)->string
Filter callback:
pluginType - the plugin class type
instanceName - the original instance name
The callback should return the name of the instance if it is to be kept or None if it should be discarded. The returned name can be modified.
- appendFiltered()¶
Appends a vrscene file using a plugin filtering callback. Blocking call.
filenames, string or list of strings One or more files are accepted. They are interpreted as one. If one fails, they all fail.
filter, function(string, string)->string
Filter callback:
pluginType - the plugin class type
instanceName - the original instance name
The callback should return the name of the instance if it is to be kept or None if it should be discarded. The returned name can be modified.
- bucketRenderNearest()¶
Render buckets closer to the specified (x, y) position first.
This is the same as enabling VFB ‘follow mouse cursor’ and pointing at this point.
- clearAllPropertyValuesUpToTime()¶
Removes all values from animated properties with keyframe times less than or equal to the given time.
- clearLastError()¶
Clears the last error.
- clearPropertyValuesUpToTime()¶
Removes all values from animated properties with keyframe times less than or equal to the given time, but only from plugins of the given categories.
- clearScene()¶
Wipes the scene contents (all plugin instances). This implicitly calls stop() if necessary.
- close()¶
Closes the renderer. Releases licenses. The object is unusable after this call.
- commit()¶
Commits any accumulated scene changes. This is necessary if the autoCommit flag is set to false.
If autoCommit was False, any plugin and property changes are queued up and this call flushes them, changing the rendered image.
Returns the new change index if the changes were successfully committed, 0 otherwise. See the progressiveImageUpdated event.
- continueSequence()¶
Resumes sequence rendering with the next frame.
- deletePlugins()¶
Deletes multiple plugins at once (faster than deleting plugins one by one).
- plugins, list of plugins - plugin instances and/or plugin names,
or a PluginList or a sequence or set of plugin instances or names.
Return True if all plugins are removed successfully, False if at least one removal failed. If one plugin removal fails, it will continue with the rest. Currently this is faster only when renderer is idle, when it’s rendering it falls back to removing plugins one by one.
- denoiseNow()¶
Run denoiser immediately.
The scene must contain a RenderChannelDenoiser instance that supplies the parameters.
Returns True if denoising was successfully started asynchronously and False if the renderer state or denoising parameters are inappropriate.
Keyword (and positional in this order) arguments:
callback, optional callable - A callback function to be called when denoising is finished. If it takes exactly one argument, the denoised image can be passed.
shouldPassImage, optional boolean - Whether to pass the denoised image to the callback function. Default is True.
When denoising is done the postEffectsUpdated and user callbacks (if user callback is set) will be called.
- disableDRClient()¶
NOTE: Available in DR2 only. Toggles off the current VRayRenderer to act as a DR2 client. Returns False if this failed, e.g. when a render is already running.
- enableDRClient()¶
NOTE: Available in DR2 only. Toggles on the current VRayRenderer to act as a DR2 client.
- Optional arguments:
dispatcher, string - either containing the address and port to the dispatcher (‘hostname:port’) or None for local dispatcher
httpProxy, string - a server:port connection parameter for http connections via proxy
localRendering, boolean - True if the local dispatcher should also start a local render server
withBroadcastListener, boolean - True if the local dispatcher should listen
pipelinedUpstream, boolean - Whether to use pipelining. Note pipelining will be disabled internally (even if requested), if a proxy is configured or is discovered between the client and a remote server.
enableAssigningWUsAsBackups, boolean - TransferrableDrOptions
immediatelyForwardReadySplitBucketSubunits, boolean - TransferrableDrOptions
connectTimeout, integer - Initial connection timeout in seconds
upstreamChannels, integer - Number of upstream connections, which the client side will use, when pipelining is not enabled
verboseLevel, integer - Numeric progress verbosity level from 0 (none) to 4 (all, incl. debug)
Returns False if this failed, e.g. when a render is already running or V-Ray failed to initialize its DR subsystem.
- export()¶
Exports the scene to a .vrscene file. Blocking call.
filename, string - the target output file name
options, dict - export options, see below. Can be omitted entirely or partially
Options dict:
currentFrameOnly, bool - if True only the current keyframe is exported, otherwise the whole timeline (default False)
appendFrameSuffix, bool - valid only when currentFrameOnly=true - whether to save separate frame files (default False)
incremental, bool - valid only when currentFrameOnly=True and appendFrameSuffix=False - set to True to incrementally append keyframe data after initial export with False (default False)
leftInterval, float - Valid only when currentFrameOnly=true. The (closed) time interval left of the current time in which to include keyframes, i.e. [left, right). Value 0.0 means automatic 1 frame based on FPS. (default 0.0)
rightInterval, float - Valid only when currentFrameOnly=true. The (open) time interval right of the current time in which to include keyframes, i.e. [left, right). Value 0.0 means automatic 1 frame based on FPS. (default 0.0)
compressed, bool - whether to compress lists of numbers when hexArrays==True (default True)
hexArrays, bool - whether to use hex format for lists of numbers (default True)
hexTransforms, bool - whether to use hex format for Transform (default False)
renderElementsSeparateFolders, bool - whether to save render elements to separate folders (default False)
subFileInfos, list/tuple of dicts (see below) - used to split the scene into separate files based on plugin categories
hostAppString, string - a string identifying the host application, version, etc.
printHeader, bool - whether to write the comment section with version and time info (default True)
pluginExportList, list of Plugin - if passed, only these will be exported, otherwise all plugins are exported
additionalIncludeFiles, list of strings - paths to write in #include directives at the end of the main vrscene
stripPaths, bool - if enabled, the paths for bitmap textures and other external files are stripped from the file so that only the filenames remain
SubFileInfo dict:
type, string - one of ‘view’, ‘lights’, ‘geometry’, ‘nodes’, ‘materials’, ‘textures’, ‘bitmaps’, ‘render_elements’
suffix, string - a suffix for the file name (before extension) of this part of the scene
Returns True on success.
- getActiveHosts()¶
Returns all active V-Ray servers attached to the current renderer.
- getAllHosts()¶
Returns all V-Ray servers attached to the current renderer.
- getAutoExposureResult()¶
Returns the auto-exposure(“autoExposure”) and auto-white balance(“autoWhiteBalance”) values computed during the last light cache calculation. When a value is 0, this means that the calculation is not enabled.
- getBoundingBox()¶
Returns the whole scene bounding box excluding infinite primitives.
- getChangeIndex()¶
Returns the last change index for interactive changes on the renderer instance.
Returns the last applied change index. Should be equal to result from the last commit() call, if there are no pending changes.
- getComputeDevicesCUDA()¶
Returns a list of dicts describing the available devices for CUDA rendering.
Dict items: ‘name’, ‘useForRendering’, ‘useForDenoising’, ‘isSupported’, ‘type’, ‘totalMemoryMB’, ‘numConnectedDisplays’, ‘frequencyMHz’, ‘gigaFlops’, ‘ccMajor’, ‘ccMinor’, ‘rtCoreVersion’
The “C++/CPU” device uses the CUDA engine code compiled for the x86-64 architecture. It is not the CPU V-Ray engine. It is disabled by default but you can enable it for faster “hybrid” rendering.
- getComputeDevicesDenoiser()¶
Returns a list of dicts describing the available devices for denoising.
Dict items: ‘name’, ‘useForRendering’, ‘useForDenoising’, ‘isSupported’, ‘type’, ‘totalMemoryMB’, ‘numConnectedDisplays’, ‘frequencyMHz’, ‘gigaFlops’, ‘ccMajor’, ‘ccMinor’, ‘rtCoreVersion’
- getComputeDevicesMetal()¶
Returns a list of dicts describing the available devices for Metal rendering. macOS only.
Dict items: ‘name’, ‘useForRendering’, ‘useForDenoising’, ‘isSupported’, ‘type’, ‘totalMemoryMB’, ‘numConnectedDisplays’, ‘frequencyMHz’, ‘gigaFlops’, ‘ccMajor’, ‘ccMinor’, ‘rtCoreVersion’
- getComputeDevicesOptix()¶
Returns a list of dicts describing the available devices for Optix rendering.
Dict items: ‘name’, ‘useForRendering’, ‘useForDenoising’, ‘isSupported’, ‘type’, ‘totalMemoryMB’, ‘numConnectedDisplays’, ‘frequencyMHz’, ‘gigaFlops’, ‘ccMajor’, ‘ccMinor’, ‘rtCoreVersion’
Compute capability >= 5.2 is required to use Optix. All unsupported devices will be ignored.
- getDREnabled()¶
NOTE: Available in DR1 only. Return whether distributed rendering is currently enabled or not.
- getImage()¶
Returns a copy the current image as VRayImage. WARNING: If Nvidia AI upscaling is enabled, then the returned image/data will have even dimentions.
Keyword (or positional in this order) arguments, all optional:
left, int - left pixel border of the region to get (default 0)
top, int - top pixel border of the region to get (default 0)
width, int - width of the region to get (default full width)
height, int - height of the region to get (default full width)
doColorCorrect, bool - if True, VFB color corrections will be applied (default False)
stripAlpha, bool - if True, the alpha channel will be set to 1.0 (default False)
flipImage, bool - if True, the image will be flipped upside down (default False)
- getInactiveHosts()¶
Returns all inactive V-Ray servers attached to the current renderer.
- getInstanceHandle()¶
Returns an native handle (pointer) of this VRayRenderer instance. The returned handle allows sharing the VRayRenderer instance among different programming languages and/or shared libraries in the same process.
- getInteractiveStatistics()¶
Returns RT renderer statistics: ‘paths per second’, ‘elapsed ticks’, ‘sample level’, ‘current nose threshold’, ‘current progress’, information for each compute device and memory usage per memory type category.
- getVFBContextMenuItemValue()¶
Get the value of a VFB context menu checkbox item. Arguments:
commandId, integer - Id of the menu item.
Returns the value of the menu item. If the menu item is of type “normal” or does not exist, None is returned.
- static isActiveState()¶
Convenience function for checking if a state value is in the rendering subset (including preparing).
- isDRClientEnabled()¶
NOTE: Available in DR2 only. Returns whether the current VRayRenderer acts as a DR2 client or not.
- static isInactiveState()¶
Convenience function for checking if a state value is in the idle subset (including IDLE_FRAME_DONE awaiting continue command).
- load()¶
Loads a vrscene file. Blocking call.
filename, string
Any previous scene contents are wiped.
An exception is thrown if loading fails.
- loadAsText()¶
Loads a vrscene from text string. Blocking call.
sceneContent, string - text that is in valid vrscene syntax
Same as load() but reads directly from memory.
- loadAsTextFiltered()¶
Loads a vrscene from a text string using a plugin filtering callback. Blocking call.
sceneContent, string - text that is in valid vrscene syntax
filter, function(string, string)->string
Filter callback:
pluginType - the plugin class type
instanceName - the original instance name
The callback should return the name of the instance if it is to be kept or None if it should be discarded. The returned name can be modified.
- loadFiltered()¶
Loads a vrscene file using a plugin filtering callback. Blocking call.
filename, string
filter, function(string, string)->string
Filter callback:
pluginType - the plugin class type
instanceName - the original instance name
The callback should return the name of the instance if it is to be kept or None if it should be discarded. The returned name can be modified.
- pause()¶
Pauses RT rendering.
- pickPlugin()¶
Return the first scene Node object intersected at the given pixel.
x, int - coordinate
y, int - coordinate
timeout, optional int - maximum time to perform the intersection
The return value is a vray.Plugin (of type Node) or None.
- pickPlugins()¶
Return the scene Node objects intersected at the given pixel.
x, number - coordinate
y, number - coordinate
maxcount, optional int - max number of plugins to obtain (0 - no limitation)
timeout, optional int - maximum time to perform the intersection
The return value is a list of tuples (infos) of a vray.Plugin instance (of type Node), a distance from the camera and a mtlID (if MtlMulti is applied to the plugin).
- removeHosts()¶
Removes V-Ray servers from the current renderer.
- Arguments:
hostlist, list/tuple of host names or ip:port strings
- renderSequence()¶
Begins rendering an animation sequence in a separate thread. A non-blocking call.
frames, complex list/tuple - elements are either simple frame numbers or dicts described below or a mix
Frame range dict:
start, int - first frame of the sub-sequence
end, int - last frame of the sub-sequence
step, int - frame index incrementation step
- resetHosts()¶
Resets the hosts list for distributed rendering.
If rendering is in process, hosts that are not on the new list are disconnected. The new list can be empty.
- Arguments:
hostlist, list/tuple of host names or ip:port strings
Return values:
-2 - Failed to resolve hostname
-1 - Renderer is invalid or in the PREPARING state
0 - Hosts were added to the list, but failed to connect
1 - Hosts were successfully added and connected if rendering was in progress
2 - Hosts were successfully added to the list, but weren’t connected due to lack of work
Note: Connection is not established until rendering starts
- resume()¶
Resumes RT rendering.
- saveCausticsFile()¶
Saves the caustics with the specified filename. Returns false if an error ocurred or there is no data to save
- saveIrradianceMapFile()¶
Saves the irradiance map with the specified filename. Returns false if an error ocurred or there is no data to save
- saveLightCacheFile()¶
Saves the light cache with the specified filename. Returns false if an error ocurred or there is no data to save
- savePhotonMapFile()¶
Saves the photon map with the specified filename. Returns false if an error ocurred or there is no data to save
- serializeScene()¶
Serializes the whole scene (plugins with their property values)…
… contained in the renderer into a single memory stream no matter if they originate from a loaded or appended vrscene file or are created by code. The whole stream will be always transferred when DR hosts are connected. No DR hosts should have been connected before serialization. (Currently only one type of serialization is supported but other types may be added in the future.) This method is here mainly for debug purposes but it can be helpful in some other cases as well.
Do not use it unless you know exactly what you’re doing.
- setBitmapCache()¶
Enable or disable bitmap caching between renders. If enabled, bitmap textures will be stored in memory and won’t be unloaded / loaded again on the next render. This may save a lot of time loading heavy textures before every render.
Keyword (and positional in this order) arguments:
enable, obligatory boolean - Enable or disable bitmap caching. Disabling cache will clear cached data.
- setComputeDevicesCUDA()¶
Pass a list of devices indices (matching the getComputeDevicesCUDA list) to use for CUDA rendering.
- setComputeDevicesDenoiser()¶
Pass a list of devices indices (matching the getComputeDevicesDenoiser list) to use for denoising when GPU denoiser is selected.
- setComputeDevicesEnvironmentVariable()¶
Sets the user environment to the currently selected devices for each engine.
Note that this will affect other V-Ray products as well.
- setComputeDevicesMetal()¶
Pass a list of devices indices (matching the getComputeDevicesMetal list) to use for Metal rendering. macOS only.
- setComputeDevicesOptix()¶
Pass a list of devices indices (matching the getComputeDevicesOptix list) to use for Optix rendering.
- setDREnabled()¶
NOTE: Available in DR1 only. Toggles distributed rendering on or off. This can only be done when the renderer is idle.
When this is disabled (default) it saves some memory. When it is enabled remote render machines added with addHosts() will be connected and contribute to the render.
- Arguments:
drEnabled True to enable the DR subsystem.
[enableBroadcastListener] Only when drEnabled=true: Whether a socket will be created to listen for remote machine broadcast messages over LAN.
Returns False if this failed, e.g. when a render is already running or V-Ray failed to initialize its DR subsystem.
- setDebugShadingSelection()¶
Selection for Debug Shading Isolate Selected mode.
plugins, list of plugins - a list of plugin names and/or plugin instances to be selected.
- setImprovedDefaultSettings()¶
Initializes some settings plugins to recommended values. Call on an empty scene before your own changes.
- Arguments:
preset, optional string - Amount of sampling to perform - tradeoff between render time and noise. One of ‘draft’, ‘low’, ‘medium’, ‘high’, ‘veryHigh’
- setIncludePaths()¶
Set search paths for scene include files.
This has to be called before loading a scene.
Keyword (and positional in this order) arguments:
includePaths, obligatory string - string that looks like “assets;assets/meshes;assets/textures”. These are relative paths where the parser looks in when including files.
overwrite, optional bool - indicates whether to overwrite the existing search paths with the given string or to add it to them. Default is True
- setInteractiveNoiseThreshold()¶
Set noise threshold for a frame when using interactive mode. Value 0 means unlimited.
- Arguments:
threshold, float - End sampling when the noise is at or below this level for all pixels (value 0.001 or higher)
This(creates if necessary and) changes SettingsRTEngine in the scene. The setting is reset after clearing the scene or loading another scene file.
- setInteractiveSampleLevel()¶
Sets maximum paths per pixel when using the interactive engine.Value 0 means unlimited.
- Arguments:
sampleLevel, int - Maximum samples to take per pixel before render ends
This(creates if necessary and) changes SettingsRTEngine in the scene. The setting is reset after clearing the scene or loading another scene file.
- setInteractiveTimeout()¶
Set a timeout value (in milliseconds) for a frame when using interactive mode. Value 0 means unlimited.
- Arguments:
timeout, int - Rendering will end after this time elapses
This(creates if necessary and) changes SettingsRTEngine in the scene. The setting is reset after clearing the scene or loading another scene file.
- setOnBucketFailed()¶
Sets a callback to be executed when rendering of a bucket has failed.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
image, VRayImage - an empty image that contains the x,y,width,height and hostname of the bucket
renderPass, int - which render pass generated the bucket. See vray.RENDER_PASS_* constants.
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnBucketInit()¶
Sets a callback to be executed when a new bucket has started rendering.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
image, VRayImage - an empty image that contains the x,y,width,height and hostname of the bucket
renderPass, int - which render pass generated the bucket. See vray.RENDER_PASS_* constants.
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnBucketReady()¶
Sets a callback to receive completed buckets from production rendering.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
image, VRayImage - a small image with only this rendered bucket or an empty image that contains the x,y,width,height and hostname of the bucket
renderPass, int - which render pass generated the bucket. See vray.RENDER_PASS_* constants.
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnHostConnected()¶
Sets a callback to be executed when a DR host is connected.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event.
hostname, string - the hostname/ip address and port of the connected DR host
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnHostDisconnected()¶
Sets a callback to be executed when a DR host is disconnected.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event.
hostname, string - the hostname/ip address and port of the disconnected DR host
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnLicenseError()¶
Sets a callback to receive when V-Ray encounters a licensing error (in its rendering thread). Arguments:
callback - see below
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
message, string - the error message for the callback
errorCode, number - the exact error code reported from the license query.
userStatus, string - the current user log-in status. The possible values are:
** ‘disabled’ - The named licensing is not enabled or is using explicit user-id. Automatic user detection is disabled. ** ‘queryFailure’ - The query for active user failed - the ULA service could not be contacted or other error. ** ‘noActiveUser’ - There is no active user at the time of the license error or query. ** ‘activeUserPresent’ - There is an active user at the time of the license error or query. * instant, float - Relative time of the event in seconds since V-Ray initialization.
- setOnLightMixTransferToScene()¶
Sets a callback to be executed for the light mix transfer to scene callback
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event.
changes, tuple - an array of dictionary objects holding the light mix changes.
instant, float - Relative time of the event in seconds since V-Ray initialization.
Callback return value:
Return False to cancel the operation, everything else including nothing or None will reset the changes marked as already applied.
- setOnLogMessage()¶
Sets a callback to receive text messages from V-Ray.
V-Ray produces many messages of different types during rendering. It is very useful to display them or at least save them to a log file for detecting and diagnosing issues etc.
- Arguments:
callback - see below
minLogLevel, int - [optional] one of the vray.LOGLEVEL_* constants for the minimum level that will emit a callback.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
message, string - the message text, no newline included
level, int - defines the type of the message - see below
instant, float - Relative time of the event in seconds since V-Ray initialization
Level values (see also vray.LOGLEVEL_* constants):
0=errors
1=warnings
2=normal info
3=debug
- setOnPostEffectsUpdated()¶
Sets a callback to be executed when a post-processed image is available.
Lens effects and Denoising can be performed periodically during rendering and this callback allows you to get the images from the prespective channel when they are ready.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnProgress()¶
Sets a callback to receive progress increments for the current V-Ray task.
This is usually used to implement a progress bar.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
title, string - title of the ongoing task
workDone, int - number of work items done
workTotal, int - total number of work items in the current task
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnProgressiveImageUpdated()¶
Sets a callback to receive a new image from progressive rendering when available.
This applies to both Interactive rendering and Production rendering with the progressive image sampler. You should be careful with processing the image within the callback because this would block the event queue if the calculations are heavy. See also setProgressiveImageUpdateDifference() and setProgressiveImageUpdateTimeout().
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
image, VRayImage - a copy of the image as rendered at the time of the event
changeIndex, long - A linearly growing index reflecting the number of changes applied to the scene in interactive mode. Corresponds to value returned by commit().
renderPass, int - which render pass generated the image. See vray.RENDER_PASS_* constants.
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnRenderViewChanged()¶
Sets a callback to be executed when the ‘transform’ or ‘fov’ property of RenderView has been changed.
This can be used to intercept user camera control through the VFB.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
propName, string - name of the RenderView property that has been changed
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnStateChanged()¶
Sets a callback to be executed when the renderer state changes. This is used to detect image completion/failure etc.
See the ‘state’ property help for possible values.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
oldState, int - The state before the event. Compare against vray.RENDERER_STATE_* constants.
newState, int - New state as of the time of the event ocurrence. Compare against vray.RENDERER_STATE_* constants
instant, float - Relative time of the event in seconds since V-Ray initialization
You could use VRayRenderer.isInactiveState(value) and VRayRenderer.isActiveState(value) to check wheter the state value is within the IDLE subset or not.
- setOnUploadToCollaboration()¶
Sets a callback to be executed when the user initiates Upload to Collaboration
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event.
fileList, list - a list of file paths to the images that should be uploaded.
instant, float - relative time of the event in seconds since V-Ray initialization.
Callback return value:
Return True if you want the files to be deleted or False, if you want to keep them.
- setOnVFBAddRenderElementToScene()¶
Sets a callback to be executed when the VFB Add ‘Render Element’ to scene button is pressed.
The button doesn’t do anything by default.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event.
type, string - type of the render element. Can be:
'lightmix'
'denoiser'
instant, float - relative time of the event in seconds since V-Ray initialization.
Callback return value:
Return True on success and False on an error.
- setOnVFBClosed()¶
Sets a callback to be executed when the close button in VFB is pressed.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnVFBContextMenuSelected()¶
Sets a callback to be executed when a custom context menu item is selected
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event.
commandId, int - Id of the menu item
x, int - the X component of the position of the cursor, where the menu is called.
y, int - the Y component of the position of the cursor, where the menu is called.
- setOnVFBCopyToHostFrameBuffer()¶
Sets a callback to be when the ‘Duplicate to host frame buffer’ button in VFB is pressed.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnVFBPauseIPR()¶
Sets a callback to be executed when the VFB Pause IPR button is pressed.
The button pauses the rendering by default.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
isRendering, bool - whether there was a rendering in progress when the button was pressed
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnVFBRenderInteractive()¶
Sets a callback to be executed when the RenderInteractive button in VFB has been pressed.
The button does nothing by default. You can call start here.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
isRendering, bool - whether there was a rendering in progress when the button was pressed
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnVFBRenderLast()¶
Sets a callback to be executed when the RenderLast button in VFB has been pressed.
The button does nothing by default. You can call start here.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
isRendering, bool - whether there was a rendering in progress when the button was pressed
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnVFBShowMessagesWindow()¶
Sets a callback to be executed when the message window button in the VFB is clicked.
- Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
instant, float - Relative time of the event in seconds since V-Ray initialization
- setOnVFBUpdateIPR()¶
Sets a callback to be executed when the VFB Update IPR button is pressed.
The button restarts the rendering by default.
Callback arguments:
renderer, VRayRenderer - the renderer object that produced the event
isRendering, bool - whether there was a rendering in progress when the button was pressed
instant, float - Relative time of the event in seconds since V-Ray initialization
- setProgressiveImageUpdateDifference()¶
Sets the maximum difference threshold between two progressively sampled images returned by V-Ray
This criterion determines when to send the current image in the callback event. This helps prevent too many callback events for very small image changes.
Default value: 2.0
- setProgressiveImageUpdateTimeout()¶
Sets the maximum interval in milliseconds between image events in V-Ray progressive rendering
When the timeout elapses the current image is sent to the callback even if the difference criteria is not met.
Default value: 0 (disabled)
- setResumableRendering()¶
Enable or disable resumable production rendering
This has to be called before starting a render
Keyword (and positional in this order) arguments:
enable, obligatory boolean
outputFile, optional string - resumable file name. Obligatory if SettingsOutput.img_file is not set
compressProgressiveFiles, optional bool - whether to compress .vrprog file when rendering with progressive sampling, default True
deleteResumableFileOnSuccess, optional bool - whether to delete the resumable file automatically if the frame is completed successfully (applies to sidecar .vrimg or .vrprog files, doesn’t apply when a .vrimg file is set as the main output)
progressiveAutoSaveSeconds, optional int - how often to save a checkpoint when rendering with progressive sampling
- setVFBContextMenuItemValue()¶
Set the value of a VFB context menu checkbox item. Arguments:
commandId, integer - Id of the menu item.
value, integer - Value to set. 0 means cleared and 1 means ticked.
Returns False if the menu item does not exist or is not a checkbox.
- setVFBContextMenuItems()¶
Set menu items for the VFB’s context menu. Arguments:
MenuItem dictionary:
id, integer - id of the menu item. Should be greater than or equal to 0
type, string - type of the menu item. Possible values are “normal” and “checkbox”.
text, string - Display text of the menu item.
enabled, optional boolean - False if the menu should be disabled.
defaultValue, optional integer - Initial value of the item. Used only when the type is “checkbox”. 0 means cleared and 1 means checked.
- setVRayProfiler()¶
Sets up the VRay Profiler. Should be called as early as possible(e.g.before rendering start), otherwise it will have no effect.
- Arguments:
- mode - VRayProfiler operational mode - 0 (‘off’), 1 (‘simple’), 2 (‘full’), 3 (‘process’) - or one of the vray.PROFILER_MODE_* constants
The meaning of the values are: - ‘off’ - No profiling. - ‘simple’ - Do not use, this mode will be mapped to Full mode. - ‘full’ - Profile the whole rendering process. - ‘process’ - Only profile the PREPARING state (e.g. plugin initialization, geometry compilation, etc.).
- Optional arguments:
maxDepth - The maximum ray bounces that will be profiled. Range [1, 8].
outputDirectory - The directory where the profiler reports will be created. If nullptr is passed, temp directory is used.
htmlTemplatePath - The full path to the profiler html template. If this is left empty, the default location will be searched.
productName - Name of the host product.
productVersion - Version of the host product.
sceneName - Name of the scene that will be profiled. Used as a suffix to the generated filename.
- start()¶
Begins rendering in a separate thread. A non-blocking call.
This first performs VRayRenderer.stop() internally. You have to wait for the onRenderStart event before being able to modify the renderer.
- startSync()¶
Begins rendering in a separate thread. Blocks until the onRenderStart event.
This might take significant time for complex scenes.
- stop()¶
Stops the rendering. This might block for some time.
- updateLightingAnalysis()¶
Update the lighting analysis render element.
The scene must contain a RenderChannelLightingAnalysis instance that supplies the parameters.
Returns True if updating was successfully started asynchronously and False if the renderer state is inappropriate or thread failed to start.
When update is done the postEffectsUpdated callback will be called.
- waitForRenderEnd()¶
Waits for the rendering to finish.
If a non-zero timeout value (in milliseconds) is passed, the wait is limited. No value or -1 will wait to the end of rendering (idle state) or to awaiting changes state if keepInteractiveRunning has been set. A value of -2 will wait to the end of rendering (idle state). Returns False in case of timeout or error.
- waitForSequenceEnd()¶
Waits for the rendering of an animation sequence to finish.
If a non-zero timeout value (in milliseconds) is passed, the wait is limited. Returns False in case of timeout or error.
- waitForVFBClosed()¶
Waits for the VFB window to be closed or hidden.
If a non-zero timeout value (in milliseconds) is passed, the wait is limited. Returns False in case of timeout or error.
- autoCommit¶
Apply changes to renderer immediately if True (default).
Otherwise changes are applied only when commit() is called. ‘False’ is useful for large batches of changes because it is more efficient to apply them all at once.
- bucketReadyHasBuffer¶
If an image passed in the BucketReady event parameters is needed. If not, no unnecessary copies would be made.
- camera¶
Get/set current camera plugin. This only matters in DR.
- cameraName¶
Camera name override. Current camera is selected internally using the scene_name property of the camera plugins.
- categories¶
Returns a dictionary of V-Ray class categories.
- classes¶
Returns a dictionary of V-Ray classes (plugin types).
- closed¶
Renderer already closed and unusable if true.
- cropRegion¶
Returns or sets the crop region as a tuple or a dictionary (empty to reset)
Tuple/keywords: (srcWidth, srcHeight, rgnLeft, rgnTop, rgnWidth, rgnHeight)
The tuple defines a virtual crop region (rgnLeft, rgnTop, rgnWidth, rgnHeight) within a virtual source image space with size srcWidth, srcHeight. Image output size is unchanged (VRayRenderer.size)
Setting this (creates if necessary and) changes SettingsOutput in the scene. The size is reset after clearing the scene or loading another scene file.
- currentEventTime¶
Get the current value (in seconds) of the relative time used in event callbacks
- frame¶
Frame number (int) to render when NOT in sequence mode.
Also affects keyframes when setting animated property values. See useAnimatedValues. Current frame and current time are related through the ‘fps’ property of SettingsOutput. Could not be set during renderSequence. If read during renderSequence the value will be the next frame to be rendered after the call to continueSequence
- frameSkipped¶
Returns whether the last rendered frame was skipped (e.g. resuming and already complete frame).
- halfResolutionMode¶
True if V-Ray is rendering internally half resolution (the images/data returned are upsampled to full resolution). False if V - Ray is rendering in full resolution.
- inProcess¶
Specify whether the executing process participates in the rendering (when true, default)
… or whether the rendering is executed entirely by V-Ray DR render slaves (when false)
This will throw an exception if set during rendering.
- keepInteractiveRunning¶
When set to True V-Ray won’t quit interactive rendering even if timeout or noise threshold are reached. Defaults to False.
If a noise/time limit is reached, the render engine will become idle, but it will not unload and it will restart sampling when a scene change is applied. The only way to end the render is to explicitly stop() it.
- lastError¶
Get the last error that occurred when a method was called.
- numThreads¶
Get/set the number of threads V-Ray will use for rendering. 0 (the default) uses all CPU logical threads.
This will throw an exception if set during rendering.
- options¶
Gets/sets current renderer options dictionary.
- paused¶
Returns whether Interactive rendering is paused. See VRayRenderer.pause and VRayRenderer.resume.
- plugins¶
Returns a dictionary of V-Ray plugin instances.
- profiler¶
Returns a Profiler wrapper object with methods related to the VRay Profiler
- progressiveImageUpdatedHasBuffer¶
If an image passed in the ProgressiveImageUpdated event parameters is needed. If not, no unnecessary copies would be made.
- renderElements¶
Returns render elements wrapper object.
- renderEnded¶
True if the renderer is idle and the frame has been rendered or failed.
Check the ‘state’ property to see if it ended successfully (IDLE_DONE or IDLE_FRAME_DONE). This is true between sequence frames before calling continueSequence.
- renderMode¶
Gets/sets current render mode. Defaults to Interactive.
One of these strings, case insensitive:
‘production’ - CPU rendering optimized for final image results
‘productionCuda’ - GPU rendering optimized for final image results using CUDA
‘productionOptix’ - VRayRenderer uses GPU for production rendering with Optix
‘productionMetal’ - VRayRenderer uses GPU for production rendering with Metal. macOS only.
‘interactive’ - interactive CPU rendering allowing fast feedback after scene changes
‘interactiveCuda’ - interactive GPU CUDA rendering allowing fast feedback after scene changes
‘interactiveOptix’ - VRayRenderer uses GPU for interactive rendering with Optix
‘interactiveMetal’ - VRayRenderer uses GPU for interactive rendering with Metal. macOS only.
CUDA and Optix modes require an nVidia GPU and recent drivers. Optix requires Compute capability >= 5.2. Mode can’t be changed while rendering, but it can be changed without wiping the scene.
- renderRegion¶
Returns or sets the render region as a tuple or a dictionary (empty to reset):
(left, top, width, height)
Setting this (creates if necessary and) changes SettingsOutput in the scene. The size is reset after clearing the scene or loading another scene file.
- sequenceEnded¶
True if the renderer is idle and the whole sequence has been rendered or failed.
Check the ‘state’ property to see if it ended successfully. This is false between sequence frames.
- size¶
Returns or sets the output image size as a tuple.
Setting this (creates if necessary and) changes SettingsOutput in the scene. The size is reset after clearing the scene or loading another scene file.
- state¶
Returns the current state of the renderer. It is best to subscribe to the ‘stateChanged’ event.
- Compare against vray.RENDERER_STATE_* constants:
RENDERER_STATE_IDLE_INITIALIZED
- Initial state after construction or clearing.RENDERER_STATE_IDLE_STOPPED
- Rendering was interrupted by stop() or from the UI.RENDERER_STATE_IDLE_ERROR
- Rendering was aborted due to an error.RENDERER_STATE_IDLE_FRAME_DONE
- Waiting for continueSequence between the frames of an animation sequence.RENDERER_STATE_IDLE_DONE
- Last rendering was completed successfully.RENDERER_STATE_PREPARING
- Preparing to start rendering the scene.RENDERER_STATE_RENDERING
- Rendering is ongoing.This may be any mode of rendering and any stage such as a prepass.RENDERER_STATE_RENDERING_PAUSED
- Interactive rendering has been paused.RENDERER_STATE_RENDERING_AWAITING_CHANGES
- Interactive rendering reached target quality or time limit, but keepInteractiveRunning is true.
You could use VRayRenderer.IsInactiveState(value) and VRayRenderer.IsActiveState(value) to check wheter the value is within the IDLE subset or not.
- time¶
The time (float) for animated properties.
Current frame and current time are related through the ‘fps’ property of SettingsOutput. Could not be set during renderSequence. If read during renderSequence the value will be the time of the next frame to be rendered after the call to continueSequence
- useAnimatedValues¶
When this is True, setting property values will use the current ‘time’ or ‘frame’ to create keyframes for animation.
Defaults to False.
- vfb¶
Returns a VFB wrapper object with methods related to the VFB.
- visualDebuggerEnabled¶
Enable the Visual Debugger.