sekme-64
whitesmoke
600
#dd3333
# 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();
});
});
});