0. Who this is for These guidelines are for users of the App SDK who want to use it render a scene with Chaos Vantage. We will not discuss details on how to write code with the App SDK here - there are separate docs and examples for this included in the SDK package. Rather we will cover how you can add a few lines into existing code to be able to renderer the scene using Chaos Vantage.
Note: This document will be updated and extended over time.
1. How to set up a Live link 1.1. The steps Here are the few simple steps how to set up a Live link between App SDK and Vantage:
Make sure you meet the system requirements for Vantage . Make sure you use the latest version of App SDK . Start Vantage and leave it in idle. Set up the code for Distributed Rendering . In short the steps are:Disable the VFB globally because Vantage doesn't send back images to VFB and its window would remain black. Create an instance of VRayRenderer. Set the inProcess flag (variations in naming in the different language bindings) to exclude the local machine from rendering. This prevents V-Ray from rendering and thus allowing Vantage to use all resources. Explicitly enable DR. Load the scene. Add the remote host for distributed rendering (localhost or the IP of the computer where Vantage is running) with port 20701. If the port number is omitted it defaults to 20207. Start rendering in interactive mode. Make changes and Vantage will update accordingly. To see if Vantage has established a successful live link, check if the label in the lower right corner of the viewport displays [LIVE LINK]:
1.2. Code examples Here is some sample code with our basic interactive example included in the SDK package rewritten using the steps described above. You can also view our new example added in the interactive examples included in the SDK package:
Python <code data-v-c2b1f83f=""><span data-v-c2b1f83f="" class="line"># Import vray module and set the SCENE_PATH environment variable.</span><span data-v-c2b1f83f="" class="line"># ...</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line"># Disable the VFB globally because Vantage doesn't send back images to VFB and its window would remain black.</span><span data-v-c2b1f83f="" class="line"># If we only set the RenderOptions flag enableFrameBuffer to be False it will hide the VFB</span><span data-v-c2b1f83f="" class="line"># but the libs associated with it will be loaded anyway.</span><span data-v-c2b1f83f="" class="line">vray.enableFrameBuffer(False)</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line"># Create an instance of VRayRenderer with default options.</span><span data-v-c2b1f83f="" class="line"># The renderer is automatically closed after the `with` block.</span><span data-v-c2b1f83f="" class="line">with vray.VRayRenderer() as renderer:</span><span data-v-c2b1f83f="" class="line"> # Set the inProcess flag to exclude the local machine from rendering.</span><span data-v-c2b1f83f="" class="line"> # This prevents V-Ray from rendering and thus allowing Vantage to use all resources.</span><span data-v-c2b1f83f="" class="line"> renderer.inProcess = False</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line"> # Register a simple log callback. Always useful for debugging.</span><span data-v-c2b1f83f="" class="line"> # ...</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> # We have to explicitly enable DR first.</span><span data-v-c2b1f83f="" class="line"> renderer.setDREnabled(True)</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> # Load scene from a file.</span><span data-v-c2b1f83f="" class="line"> renderer.load(os.path.join(SCENE_PATH, 'intro.vrscene'))</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> # Add remote host for distributed rendering.</span><span data-v-c2b1f83f="" class="line"> # If port is omitted it defaults to 20207.</span><span data-v-c2b1f83f="" class="line"> # NOTE: Replace this address with the address of a host running</span><span data-v-c2b1f83f="" class="line"> # Vantage.</span><span data-v-c2b1f83f="" class="line"> renderer.addHosts('127.0.0.1:20701')</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> # Start rendering.</span><span data-v-c2b1f83f="" class="line"> renderer.startSync()</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> # Wait for rendering to end.</span><span data-v-c2b1f83f="" class="line"> renderer.waitForRenderEnd()</span></code>
C++ <code data-v-c2b1f83f=""><span data-v-c2b1f83f="" class="line">// Include VRay headers and set the SCENE_PATH environment variable.</span><span data-v-c2b1f83f="" class="line">// ...</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line">// Load V-Ray SDK library.</span><span data-v-c2b1f83f="" class="line">// The directory containing the vray shared object should be present in</span><span data-v-c2b1f83f="" class="line">// the PATH environment variable.</span><span data-v-c2b1f83f="" class="line">// Disable the VFB globally because Vantage doesn't send back images to VFB and its window would remain black.</span><span data-v-c2b1f83f="" class="line">// If we only set the RendererOptions flag enableFrameBuffer to be false it will hide the VFB</span><span data-v-c2b1f83f="" class="line">// but the libs associated with it will be loaded anyway.</span><span data-v-c2b1f83f="" class="line">VRayInit init(NULL, false);</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line">// Create an instance of VRayRenderer with default options.</span><span data-v-c2b1f83f="" class="line">// The renderer is automatically closed at the end of the current scope.</span><span data-v-c2b1f83f="" class="line">VRayRenderer renderer;</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line">// Set the inProcess flag to exclude the local machine from rendering.</span><span data-v-c2b1f83f="" class="line">// This prevents V-Ray from rendering and thus allowing Vantage to use all resources.</span><span data-v-c2b1f83f="" class="line">renderer.inProcess = false;</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line">// It's recommended to always have a console log</span><span data-v-c2b1f83f="" class="line">renderer.setOnLogMessage(logMessage);</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line">// We have to explicitly enable DR first.</span><span data-v-c2b1f83f="" class="line">renderer.setDREnabled(true);</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line">// Load scene from a file.</span><span data-v-c2b1f83f="" class="line">renderer.load("intro.vrscene");</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line">// Add remote host for distributed rendering.</span><span data-v-c2b1f83f="" class="line">// If port is omitted it defaults to 20207.</span><span data-v-c2b1f83f="" class="line">// NOTE: Replace this address with the address of a host running</span><span data-v-c2b1f83f="" class="line">// Vantage.</span><span data-v-c2b1f83f="" class="line">renderer.addHosts("127.0.0.1:20701");</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line">// Start rendering.</span><span data-v-c2b1f83f="" class="line">renderer.startSync();</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line">// Wait for rendering to end.</span><span data-v-c2b1f83f="" class="line">renderer.waitForRenderEnd();</span></code>
C#.Net <code data-v-c2b1f83f=""><span data-v-c2b1f83f="" class="line">// Use VRay related namespaces and set the SCENE_PATH environment variable.</span><span data-v-c2b1f83f="" class="line">// ...</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line">// Disable the VFB globally because Vantage doesn't send back images to VFB and its window would remain black.</span><span data-v-c2b1f83f="" class="line">// If we only set the RendererOptions flag IsFrameBufferEnabled to be false it will hide the VFB</span><span data-v-c2b1f83f="" class="line">// but the libs associated with it will be loaded anyway.</span><span data-v-c2b1f83f="" class="line">VFB.Enable(false);</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line">// Create an instance of VRayRenderer with default options.</span><span data-v-c2b1f83f="" class="line">// The renderer is automatically closed after the `using` block.</span><span data-v-c2b1f83f="" class="line">using (VRayRenderer renderer = new VRayRenderer())</span><span data-v-c2b1f83f="" class="line">{</span><span data-v-c2b1f83f="" class="line"> // Set the InProcess flag to exclude the local machine from rendering.</span><span data-v-c2b1f83f="" class="line"> // This prevents V-Ray from rendering and thus allowing Vantage to use all resources.</span><span data-v-c2b1f83f="" class="line"> renderer.InProcess = false;</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> // Add a listener for any type of log message.</span><span data-v-c2b1f83f="" class="line"> // ...</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> // We have to explicitly enable DR first.</span><span data-v-c2b1f83f="" class="line"> renderer.SetDREnabled(true);</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> // Load scene from a file.</span><span data-v-c2b1f83f="" class="line"> renderer.Load("intro.vrscene");</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> // Add remote host for distributed rendering.</span><span data-v-c2b1f83f="" class="line"> // If port is omitted it defaults to 20207.</span><span data-v-c2b1f83f="" class="line"> // NOTE: Replace this address with the address of a host running</span><span data-v-c2b1f83f="" class="line"> // Vantage.</span><span data-v-c2b1f83f="" class="line"> renderer.AddHosts("127.0.0.1:20701");</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> // Start rendering.</span><span data-v-c2b1f83f="" class="line"> renderer.StartSync();</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> // Wait for rendering to end.</span><span data-v-c2b1f83f="" class="line"> renderer.WaitForRenderEnd();</span><span data-v-c2b1f83f="" class="line">}</span></code>
Node.js <code data-v-c2b1f83f=""><span data-v-c2b1f83f="" class="line">// Import vray module and set the SCENE_PATH environment variable.</span><span data-v-c2b1f83f="" class="line">// ...</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line">// Disable the VFB globally because Vantage doesn't send back images to VFB and its window would remain black.</span><span data-v-c2b1f83f="" class="line">// If we only set the RendererOptions flag enableFrameBuffer to be false it will hide the VFB</span><span data-v-c2b1f83f="" class="line">// but the libs associated with it will be loaded anyway.</span><span data-v-c2b1f83f="" class="line">vray.enableFrameBuffer(false);</span><span data-v-c2b1f83f="" class="line"> </span><span data-v-c2b1f83f="" class="line">// Create an instance of VRayRenderer with default options.</span><span data-v-c2b1f83f="" class="line">var renderer = vray.VRayRenderer();</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line">// Set the inProcess flag to exclude the local machine from rendering.</span><span data-v-c2b1f83f="" class="line">// This prevents V-Ray from rendering and thus allowing Vantage to use all resources.</span><span data-v-c2b1f83f="" class="line">renderer.inProcess = false;</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line">// It's recommended to always have a console log callback.</span><span data-v-c2b1f83f="" class="line">// ...</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line">// We have to explicitly enable DR first.</span><span data-v-c2b1f83f="" class="line">renderer.setDREnabled(true);</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line">// Load scene from a file asynchronously.</span><span data-v-c2b1f83f="" class="line">renderer.load('intro.vrscene', function(err) {</span><span data-v-c2b1f83f="" class="line"> if (err) {</span><span data-v-c2b1f83f="" class="line"> // Scene was not loaded.</span><span data-v-c2b1f83f="" class="line"> throw err;</span><span data-v-c2b1f83f="" class="line"> }</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> // Add remote host for distributed rendering.</span><span data-v-c2b1f83f="" class="line"> // If port is omitted it defaults to 20207.</span><span data-v-c2b1f83f="" class="line"> // NOTE: Replace this address with the address of a host running</span><span data-v-c2b1f83f="" class="line"> // Vantage.</span><span data-v-c2b1f83f="" class="line"> renderer.addHosts('127.0.0.1:20701');</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> // Start rendering.</span><span data-v-c2b1f83f="" class="line"> renderer.start(function(err) {</span><span data-v-c2b1f83f="" class="line"> if (err) {</span><span data-v-c2b1f83f="" class="line"> // Couldn't start rendering.</span><span data-v-c2b1f83f="" class="line"> throw err;</span><span data-v-c2b1f83f="" class="line"> }</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> // Wait for rendering to end.</span><span data-v-c2b1f83f="" class="line"> renderer.waitForRenderEnd(function() {</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> // Closes the renderer.</span><span data-v-c2b1f83f="" class="line"> // The renderer object is unusable after closing since its resources</span><span data-v-c2b1f83f="" class="line"> // are freed. It should be released for garbage collection.</span><span data-v-c2b1f83f="" class="line"> renderer.close();</span><span data-v-c2b1f83f="" class="line"> });</span><span data-v-c2b1f83f="" class="line"> });</span><span data-v-c2b1f83f="" class="line">});</span><span data-v-c2b1f83f="" class="line"></span></code>