©Anton Podvalny

Table of Contents

In this chapter we'll cover stereoscopic rendering in V-Ray. We'll cover plugins, which can be used to achieve this effect - VRayStereoscopicSettings.

VrayStereoscopicSettings


It is a helper plugin for stereoscopic (side by side) rendering. It turns the camera into 2 virtual cameras placed on some distance. It also implements Shademap mode: used to accelerate the stereoscopic rendering. It's also usable for accelerating DOF & motion blur.

Parameters


The following parameters are located in the VRayStereoscopicSettings plugin:

  • eye_distance – Specifies the eye distance for which the stereoscopic image will be rendered.
  • specify_focus – When enabled, defines the point of focus with the focus distance parameter.
  • focus_method – Specifies one of the three following focus methods for the two views.

    • None (0) – Both cameras have their focus points directly in front of them.
    • Rotation (1) – The stereoscopic effect is achieved by rotating the left and right views so that their focus points coincide at the distance from the eyes where the lines of sight for each eye converge called fusion distance.
    • Shear (2) – The orientation of both views remain the same but each eye's view is sheared along z so that the two frustums converge at the fusion distance.
  • interocular_method – Specifies how the two virtual cameras will be placed in relation to the real camera in the scene.

    • Shift both (0) – Both virtual cameras will be shifted in opposite directions at a distance equal to half of the eye distance.
    • Shift left (1) – The virtual cameras are shifted to the left so that the right camera takes the position of the original camera. The left camera is shifted to the left at a distance equal to the eye distance.
    • Shift right (2) – The virtual cameras are shifted to the right so that the left camera takes the position of the original camera. The right camera is shifted to the right at a distance equal to the eye distance.
  • view – Specifies which of the stereoscopic views will be rendered.

    • Both (0) – Both views will be rendered side by side.
    • Left (1) – Only the left view will be rendered.
    • Right (2) – Only the right view will be rendered.
  • adjust_resolution – When enabled, this option will automatically adjust the resolution for the final image rendered. For example, if Both is selected for view and the specified image resolution for the render is 640x480, the resulting render will be a single image with a resolution of 1280x480 with both views side by side.

  • output_layout – Specifies the format in which the Stereoscopic renders are output to the V-Ray frame buffer.

    • Side-by-Side (0) – Arranges the cameras side by side.
    • Top-Bottom (1) – Arranges the cameras one on top of another.
  • left_camera - A camera plugin for the left eye; if not specified, the left camera is computed based on the scene camera.

  • right_camera - A camera plugin for the right eye; if not specified, the right camera is computed based on the scene camera.
  • film_offset_x_left - Horizontal film offset for the left camera
  • film_offset_x_right - Horizontal film offset for the right camera
  • film_offset_y_left - Vertical film offset for the left camera
  • film_offset_y_right - Vertical film offset for the right camera


Panoramic pole merging

The options in this section are used when rendering a panoramic view with stereoscopy (for example a Spherical camera with FOV=360 degrees). These options allow us to avoid artifacts when looking upward and downward. This is achieved by gradually decreasing the eye distance and thus the stereoscopic effect. The eye distance value is kept the same until the viewing angle reaches the angles specified in the properties below after which the eye distance is gradually decreased until it reaches a value of 0 when looking directly downwards or upwards.

  • top_merge_angle - Panoramic pole merging: from what angle near the top does the stereo effect start to fade when rendering with a spherical panorama camera
  • bottom_merge_angle - Panoramic pole merging: from what angle near the bottom does the stereo effect start to fade when rendering with a spherical panorama camera


ShadeMap Parameters

The shade map parameters can speed up the rendering of stereoscopic images as well as images with depth of field. The workflow with shade maps involves two stages. At the first stage a shade map is generated by setting the Shademap mode to Render shade map and rendering. The file in which the shademap will be saved needs to be specified by clicking on the Browse button before the actual rendering. This will save a file that contains important information about the visible shaded points. This information can be used later in Use shade map mode to render stereoscopic images or images with DoF much faster.

  • sm_mode - Allows us to specify the mode of operation for the shade map (0 - disabled; 1 - render shade map; 2 - use shade map).
  • reuse_threshold - Lower values will make V-Ray use less of the shade map and more real shading.
  • shademap_file - The name of the file in which the shade map information is stored.
  • float_colors_mode - Store 32 bit (single precision) color channels in the shade map. When off 16 bit (half precision) values are stored.
  • vrst_compression - Compression type for the .vrst files (0 - no compression, 1 - ZLIB compression)
  • exr_compression - Compression type for the .exr files (0 - no compression, 1 - RLE compression, 2 - ZIPS compression)
  • exclude_list - A list of plugins for which the shade map won't be used.
  • exclude_list_inclusive - When on the exclude_list is considered as an "Include list" and when off the the Result Affect is considered as "Exclude list"


General guidelines

For spherical panorama rendering you need to:

  • Change the type parameter of SettingsCamera to 9. (Note that type=1 is spherical, but not for panoramas.)
  • Set the field of view to 360 degrees or rather 2*pi, because the fov parameter is in radians. You need to do this with the RenderView plugin and with SettingsCamera - both have an fov parameter. Also if you're using CameraPhysical with specify_fov=1, set fov there too.
  • Set the vertical field of view to 180 degrees. This may be a bit confusing: it is set through the height parameter of SettingsCamera. Also the value is not in radians, but in degrees.

For cubic (6x1) panorama rendering you need to:

  • Change the type parameter of SettingsCamera to 10.
  • Set a resolution with aspect ratio 6:1 (or 12:1 if you are doing stereo). So for a stereo cubic panorama with 1000x1000 pixel cube sides you will render at 12000x1000.

For stereo rendering:

  • For CPU (Production or Interactive) rendering you need to create a VRayStereoscopicSettings plugin. It has to be created after SettingsCamera and SettingsOutput or it won't work! It's recommended to change the VRayStereoscopicSettings::focus_method parameter to 1 for panorama or 2 for normal camera.
  • For GPU rendering you need to set RenderView::stereo_on to 1. You might also want to set RenderView::stereo_eye_distance to something like 6.5 (average human), instead of the default 1.0. It's recommended to change the RenderView::stereo_focus_method parameter to 1 for panorama or 2 for normal camera.

Also remember to set a double horizontal resolution for stereo. So if your normal render resolution is 640x480, make that 1280x480. The left half of the image will be the left eye view and the right half is the right eye.

Examples


Cube 6x1



Check comments in the scene file vrscenes/vr_cube6x1_camera.vrscene.

Stereo Cube 6x1



Check comments in the scene file vrscenes/vr_cube6x1_stereo.vrscene.

Spherical



Check comments in the scene file vrscenes/vr_sphericalPanorama_camera.vrscene.

Stereo Spherical



Check comments in the scene file vrscenes/vr_sphericalPanorama_stereo.vrscene.

Code example


Here's an example code for Cube6x1 rendering:


# Compatibility with Python 2.7.
from __future__ import print_function

# The directory containing the vray shared object should be present in the PYTHONPATH environment variable.
# Try to import the vray module from VRAY_SDK/python, if it is not in PYTHONPATH
import sys, os
VRAY_SDK = os.environ.get('VRAY_SDK')
if VRAY_SDK:
    sys.path.append(os.path.join(VRAY_SDK, 'python'))
import vray

SCENE_PATH = os.path.join(os.environ.get('VRAY_SDK'), 'scenes')
# Change process working directory to SCENE_PATH in order to be able to load relative scene resources.
os.chdir(SCENE_PATH)

# Create an instance of VRayRenderer with default options.
# The renderer is automatically closed after the `with` block.
with vray.VRayRenderer() as renderer:
    # Register a simple log callback. Always useful for debugging.
    def dumpMsg(renderer, message, level, instant):
        if level == vray.LOGLEVEL_ERROR:
            print("[ERROR]", message)
        elif level == vray.LOGLEVEL_WARNING:
            print("[Warning]", message)
        elif level == vray.LOGLEVEL_INFO:
            print("[info]", message)
        # Uncomment for testing, but you might want to ignore these in real code
        #else: print("[debug]", message)
    renderer.setOnLogMessage(dumpMsg)
    # Load scene from a file.
    renderer.load(os.path.join(SCENE_PATH, 'stereo.vrscene'))
    # The original image size is 3000x500px.
    # In this example 2 images are rendered side-by-side for the stereo effect
    # and the image width had to be doubled (6000px).
    renderer.size = (6000, 500)
    # The SettingsCamera plugin controls the way the scene geometry is
    # projected onto the image (camera type, motion blur and depth of field).
    settingsCamera = renderer.classes.SettingsCamera.getInstanceOrCreate()
    # Specifies the type of the camera
    # Possible values are:
    #   0 - default - Allows for the current scene camera to be used (usually a
    #       pinhole camera).
    #   1 (Spherical) - A camera with a spherical lens.
    #   2 (Cylindrical (point)) - This camera casts all rays from the center of
    #      a cylinder. In the vertical direction the camera acts as a pinhole
    #      camera, and in the horizontal direction the camera acts as a
    #      spherical camera.
    #   3 (Cylindrical (ortho)) - This camera casts all rays from the center of
    #      a cylinder. In the vertical direction the camera acts as an
    #      orthographic view, and in the horizontal direction the camera acts
    #      as a spherical camera.
    #   4 (Box) - Six standard cameras placed on the sides of a box, generating
    #      a vertical cross format image. This type of camera is excellent for
    #      generation of environment maps for cube mapping. The Box camera can
    #      also be used for generating irradiance maps for GI: First you would
    #      calculate the irradiance map with a Box camera, then save it to a
    #      file and finally reuse it with a Default camera that can be pointed
    #      in any direction.
    #   5 (Fish eye) - This special type of camera captures the scene as if it
    #      is a pinhole camera pointed at a 100% reflective sphere that
    #      reflects the scene back into the camera's shutter, as with using a
    #      light probe in HDRI photography. You can use the Dist and FOV
    #      settings to control which part of the sphere is captured by the
    #      camera. Note that the virtual reflective sphere has always a radius
    #      of 1.0.
    #   6 (Warped spherical (old-style)) - A spherical camera with slightly
    #      different mapping formula than the Spherical camera.
    #   7 (Orthographic) - A camera enabling a non-perspective view.
    #   8 (Perspective) - Overrides the scene camera to force it to be a
    #      pinhole camera.
    #   9 (Spherical panorama) - A spherical camera with independent horizontal
    #      and vertical FOV selection that is useful for generating latlong
    #      images for spherical VR use.
    #  10 (Cube6x1) - A variant of the Box camera with the cube sides arranged
    #      in a single row. Unlike the Box camera's output, Cube6x1 does not
    #      produce an empty space in the output image and is quite useful in
    #      generating cubic VR output.
    settingsCamera.type = 10
    renderView = renderer.classes.RenderView.getInstanceOrCreate()
    # Specify active camera (render camera) position and orientation.
    renderView.transform = vray.Transform(
        vray.Matrix(
            vray.Vector(0.9999999, 0, 0),
            vray.Vector(0, 0.9999999, 0),
            vray.Vector(0, 0, 0.9999999)),
        vray.Vector(0, 160, -144.4429302328891))
    # Update field of view value.
    renderView.fov = 6.283185
    # Specify near clipping plane.
    renderView.clipping_near = 0.1
    # Specify far clipping plane.
    renderView.clipping_far = 10000
    # The "VRayStereoscopicSettings" enables the stereoscopic rendering.
    stereo = renderer.classes.VRayStereoscopicSettings.getInstanceOrCreate()
    # Specify the focus method for the two views.
    # Possible values are:
    #   0 (None/Parallel) - default
    #   1 (Rotation)
    #   2 (Shear)
    stereo.focus_method = 2
    # Automatically adjust the resolution for the final image rendererd.
    stereo.adjust_resolution = True
    # Start rendering.
    renderer.startSync()
    # Wait for rendering to end.
    renderer.waitForRenderEnd()

#define VRAY_RUNTIME_LOAD_PRIMARY

#include "vraysdk.hpp"
#include "vrayplugins.hpp"
#include "utils.h"

using namespace VRay;
using namespace VRay::Plugins;
using namespace std;

const char *BASE_PATH = getenv("VRAY_SDK");
string SCENE_PATH = (BASE_PATH ? string(BASE_PATH) : string(".")) + PATH_DELIMITER + "scenes";

int main() {
	// Change process working directory to SCENE_PATH in order to be able to load relative scene resources.
	changeCurrentDir(SCENE_PATH.c_str());
	// Load V-Ray SDK library.
	VRayInit init(NULL, true);
	// Create an instance of VRayRenderer with default options.
	// The renderer is automatically closed at the end of the current scope.
	VRayRenderer renderer;
	// It's recommended to always have a console log
	renderer.setOnLogMessage(logMessage);
	// Load scene from a file.
	renderer.load("stereo.vrscene");
	// The original image size is 3000x500px.
	// In this example 2 images are rendered side-by-side for the stereo effect
	// and the image width had to be doubled (6000px).
	renderer.setImageSize(6000, 500);
	// The SettingsCamera plugin controls the way the scene geometry is
	// projected onto the image(camera type, motion blur and depth of field).
	SettingsCamera settingsCamera = renderer.getInstanceOrCreate<SettingsCamera>();
	// Specifies the type of the camera
	// Possible values are:
	//   0 - default - Allows for the current scene camera to be used (usually a pinhole camera).
	//   1 (Spherical) - A camera with a spherical lens.
	//   2 (Cylindrical(point)) - This camera casts all rays from the center of a cylinder. 
	//      In the vertical direction the camera acts as a pinhole camera, and in the horizontal direction the camera acts as a spherical camera.
	//   3 (Cylindrical(ortho)) - This camera casts all rays from the center of a cylinder. 
	//      In the vertical direction the camera acts as an orthographic view, and in the horizontal direction the camera acts as a spherical camera.
	//   4 (Box) - Six standard cameras placed on the sides of a box, generating a vertical cross format image. 
	//      This type of camera is excellent for generation of environment maps for cube mapping. 
	//      The Box camera can also be used for generating irradiance maps for GI: 
	//      First you would calculate the irradiance map with a Box camera, then save it to a
	//      file and finally reuse it with a Default camera that can be pointed in any direction.
	//   5 (Fish eye) - This special type of camera captures the scene as if it is a pinhole camera pointed at a 100% reflective sphere that
	//      reflects the scene back into the camera's shutter, as with using a light probe in HDRI photography. You can use the Dist and FOV
	//      settings to control which part of the sphere is captured by the camera. Note that the virtual reflective sphere has always a radius of 1.0.
	//   6 (Warped spherical (old-style)) - A spherical camera with slightly different mapping formula than the Spherical camera.
	//   7 (Orthographic) - A camera enabling a non-perspective view.
	//   8 (Perspective) - Overrides the scene camera to force it to be a pinhole camera.
	//   9 (Spherical panorama) - A spherical camera with independent horizontal
	//      and vertical FOV selection that is useful for generating latlong images for spherical VR use.
	//  10 (Cube6x1) - A variant of the Box camera with the cube sides arranged in a single row. Unlike the Box camera's output, 
	//      Cube6x1 does not produce an empty space in the output image and is quite useful in generating cubic VR output.
	settingsCamera.set_type(10);
	RenderView renderView = renderer.getInstanceOrCreate<RenderView>();
	// Specify active camera(render camera) position and orientation.
	renderView.set_transform(Transform(
		Matrix(
			Vector(0.9999999, 0.0, 0.0),
			Vector(0.0, 0.9999999, 0.0),
			Vector(0.0, 0.0, 0.9999999)),
		Vector(0.0, 160.0, -144.4429302328891)));
	// Update field of view value.
	renderView.set_fov(6.283185f);
	// Specify near clipping plane.
	renderView.set_clipping_near(0.1f);
	// Specify far clipping plane.
	renderView.set_clipping_far(10000);
	// The "VRayStereoscopicSettings" enables the stereoscopic rendering.
	VRayStereoscopicSettings stereo = renderer.getInstanceOrCreate<VRayStereoscopicSettings>();
	// Specify the focus method for the two views.
	// Possible values are :
	//   0 (None / Parallel) - default
	//   1 (Rotation)
	//   2 (Shear)
	stereo.set_focus_method(2);
	// Automatically adjust the resolution for the final image rendererd.
	stereo.set_adjust_resolution(true);
	// Start rendering.
	renderer.startSync();
	// Wait for rendering to end.
	renderer.waitForRenderEnd();
	return 0;
}
using System;
using System.IO;
using VRay;
using VRay.Plugins;

namespace _08_stereo_panorama
{
	class Program
	{
		static void Main(string[] args)
		{
			string SCENE_PATH = Path.Combine(Environment.GetEnvironmentVariable("VRAY_SDK"), "scenes");
			// Change process working directory to SCENE_PATH in order to be able to load relative scene resources.
			Directory.SetCurrentDirectory(SCENE_PATH);
			// Create an instance of VRayRenderer with default options.
			// The renderer is automatically closed after the `using` block.
			using (VRayRenderer renderer = new VRayRenderer())
			{
				// Add a listener for any type of log message.
				renderer.LogMessage += new EventHandler<MessageEventArgs>((source, e) =>
				{
					// You can remove the if for testing, but you might want to ignore Debug in real code
					if (e.LogLevel != LogLevelType.Debug)
					{
						Console.WriteLine(String.Format("[{0}] {1}", e.LogLevel.ToString(), e.Message));
					}
				});
				// Load scene from a file.
				renderer.Load("stereo.vrscene");
				// The original image size is 3000x500px.
				// In this example 2 images are rendered side-by-side for the stereo effect
				// and the image width had to be doubled (6000px).
				renderer.SetImageSize(6000, 500);
				// The SettingsCamera plugin controls the way the scene geometry is
				// projected onto the image (camera type, motion blur and depth of field).
				SettingsCamera settingsCamera = renderer.GetInstanceOrCreate<SettingsCamera>();
				// Specifies the type of the camera
				// Possible values are:
				//   0 - default - Allows for the current scene camera to be used (usually a pinhole camera).
				//   1 (Spherical) - A camera with a spherical lens.
				//   2 (Cylindrical(point)) - This camera casts all rays from the center of a cylinder. 
				//      In the vertical direction the camera acts as a pinhole camera, and in the horizontal direction the camera acts as a spherical camera.
				//   3 (Cylindrical(ortho)) - This camera casts all rays from the center of a cylinder. 
				//      In the vertical direction the camera acts as an orthographic view, and in the horizontal direction the camera acts as a spherical camera.
				//   4 (Box) - Six standard cameras placed on the sides of a box, generating a vertical cross format image. 
				//      This type of camera is excellent for generation of environment maps for cube mapping. 
				//      The Box camera can also be used for generating irradiance maps for GI: 
				//      First you would calculate the irradiance map with a Box camera, then save it to a
				//      file and finally reuse it with a Default camera that can be pointed in any direction.
				//   5 (Fish eye) - This special type of camera captures the scene as if it is a pinhole camera pointed at a 100% reflective sphere that
				//      reflects the scene back into the camera's shutter, as with using a light probe in HDRI photography. You can use the Dist and FOV
				//      settings to control which part of the sphere is captured by the camera. Note that the virtual reflective sphere has always a radius of 1.0.
				//   6 (Warped spherical (old-style)) - A spherical camera with slightly different mapping formula than the Spherical camera.
				//   7 (Orthographic) - A camera enabling a non-perspective view.
				//   8 (Perspective) - Overrides the scene camera to force it to be a pinhole camera.
				//   9 (Spherical panorama) - A spherical camera with independent horizontal
				//      and vertical FOV selection that is useful for generating latlong images for spherical VR use.
				//  10 (Cube6x1) - A variant of the Box camera with the cube sides arranged in a single row. Unlike the Box camera's output, 
				//      Cube6x1 does not produce an empty space in the output image and is quite useful in generating cubic VR output.
				settingsCamera.SettingsCameraType = 10;
				RenderView renderView = renderer.GetInstanceOrCreate<RenderView>();
				// Specify active camera (render camera) position and orientation.
				renderView.Transform = new Transform(
					new Matrix(
						new Vector(0.9999999, 0, 0),
						new Vector(0, 0.9999999, 0),
						new Vector(0, 0, 0.9999999)),
					new Vector(0, 160, -144.4429302328891));
				// Update field of view value.
				renderView.Fov = 6.283185F;
				// Specify near clipping plane.
				renderView.ClippingNear = 0.1F;
				// Specify far clipping plane.
				renderView.ClippingFar = 10000;
				// The "VRayStereoscopicSettings" enables the stereoscopic rendering.
				VRayStereoscopicSettings stereo = renderer.GetInstanceOrCreate<VRayStereoscopicSettings>();
				// Specify the focus method for the two views.
				// Possible values are:
				//   0 (None/Parallel) - default
				//   1 (Rotation)
				//   2 (Shear)
				stereo.FocusMethod = 2;
				// Automatically adjust the resolution for the final image rendererd.
				stereo.AdjustResolution = true;
				// Start rendering.
				renderer.StartSync();
				// Wait for rendering to end.
				renderer.WaitForRenderEnd();
			}
		}
	}
}
var path = require('path');
var vray = require(path.join(process.env.VRAY_SDK, 'node', 'vray'));

var SCENE_PATH = path.join(process.env.VRAY_SDK, 'scenes');
// Change process working directory to SCENE_PATH in order to be able to load relative scene resources.
process.chdir(SCENE_PATH);

// Create an instance of VRayRenderer with default options.
var renderer = vray.VRayRenderer();
// It's recommended to always have a console log callback
renderer.on("logMessage", function(message, level, instant) {
	if (level == vray.LOGLEVEL_ERROR)
		console.log("[ERROR] ", message);
	else if (level == vray.LOGLEVEL_WARNING)
		console.log("[Warning] ", message);
	else if (level == vray.LOGLEVEL_INFO)
		console.log("[info] ", message);
	// Uncomment for testing, but you might want to ignore these in real code
	//else console.log("[debug] ", message);
});

// Load scene from a file asynchronously.
renderer.load("stereo.vrscene", function(err) {
    if (err) throw err;
    // The original image size is 3000x500px.
    // In this example 2 images are rendered side-by-side for the stereo effect
    // and the image width had to be doubled (6000px).
    renderer.size = {"width": 6000, "height": 500};
    // The SettingsCamera plugin controls the way the scene geometry is
    // projected onto the image (camera type, motion blur and depth of field).
    var settingsCamera = renderer.classes.SettingsCamera.getInstanceOrCreate();
	// Specifies the type of the camera
	// Possible values are:
	//   0 - default - Allows for the current scene camera to be used (usually a
	//       pinhole camera).
	//   1 (Spherical) - A camera with a spherical lens.
	//   2 (Cylindrical(point)) - This camera casts all rays from the center of
	//      a cylinder. In the vertical direction the camera acts as a pinhole
	//      camera, and in the horizontal direction the camera acts as a
	//      spherical camera.
	//   3 (Cylindrical(ortho)) - This camera casts all rays from the center of
	//      a cylinder. In the vertical direction the camera acts as an
	//      orthographic view, and in the horizontal direction the camera acts
	//      as a spherical camera.
	//   4 (Box) - Six standard cameras placed on the sides of a box, generating
	//      a vertical cross format image. This type of camera is excellent for
	//      generation of environment maps for cube mapping. The Box camera can
	//      also be used for generating irradiance maps for GI: First you would
	//      calculate the irradiance map with a Box camera, then save it to a
	//      file and finally reuse it with a Default camera that can be pointed
	//      in any direction.
	//   5 (Fish eye) - This special type of camera captures the scene as if it
	//      is a pinhole camera pointed at a 100% reflective sphere that
	//      reflects the scene back into the camera's shutter, as with using a
	//      light probe in HDRI photography. You can use the Dist and FOV
	//      settings to control which part of the sphere is captured by the
	//      camera. Note that the virtual reflective sphere has always a radius
	//      of 1.0.
	//   6 (Warped spherical (old-style)) - A spherical camera with slightly
	//      different mapping formula than the Spherical camera.
	//   7 (Orthographic) - A camera enabling a non-perspective view.
	//   8 (Perspective) - Overrides the scene camera to force it to be a
	//      pinhole camera.
	//   9 (Spherical panorama) - A spherical camera with independent horizontal
	//      and vertical FOV selection that is useful for generating latlong
	//      images for spherical VR use.
	//  10 (Cube6x1) - A variant of the Box camera with the cube sides arranged
	//      in a single row. Unlike the Box camera's output, Cube6x1 does not
	//      produce an empty space in the output image and is quite useful in
	//      generating cubic VR output.
    settingsCamera.type = 10;

    var renderView = renderer.classes.RenderView.getInstanceOrCreate();
    // Specify active camera (render camera) position and orientation.
    renderView.transform = vray.Transform(
        vray.Matrix(
            vray.Vector(0.9999999, 0, 0),
            vray.Vector(0, 0.9999999, 0),
            vray.Vector(0, 0, 0.9999999)),
        vray.Vector(0, 160, -144.4429302328891));
    // Update field of view value.
    renderView.fov = 6.283185;
    // Specify near clipping plane.
    renderView.clipping_near = 0.1;
    // Specify far clipping plane.
    renderView.clipping_far = 10000;
    // The "VRayStereoscopicSettings" enables the stereoscopic rendering.
    var stereo = renderer.classes.VRayStereoscopicSettings.getInstanceOrCreate();
    // Specify the focus method for the two views.
    // Possible values are:
    //   0 (None/Parallel) - default
    //   1 (Rotation)
    //   2 (Shear)
    stereo.focus_method = 2;
    // Automatically adjust the resolution for the final image rendererd.
    stereo.adjust_resolution = true;
    // Start rendering.
    renderer.start(function(err) {
        if (err) throw err;
        // Wait for rendering to end.
        renderer.waitForRenderEnd(function() {
            renderer.close();
        });
    });
});
  • No labels