This page provides information for how best to render using V-Ray GPU for use with VR headsets like the Oculus Rift or HTC Vive.
|
1. Confirm headset display is installed properly.
If using Oculus Rift then install Oculus Rift PC runtime:
https://www3.oculus.com/en-us/setup/
Direct internet connection is needed to login to Oculus Account. It seems that it does not work through a proxy. You need at least 5 GB disk space on your C: drive.
This step is not needed if using HTC Vive.
Oculus Rift only: connect headset to the default graphics adapter (it will not work if connected to other graphic adapters).
In the Oculus app, enable apps from unknown sources: turn on Oculus Settings > General > Unknown Sources
For HTC Vive support, install Steam and Steam VR:
https://support.steampowered.com/kb_article.php?ref=2001-UXCM-4439#install-steam
This is needed in order to use the OpenVR interface for HTC Vive, Oculus Rift and other VR devices. This step is optional for Oculus Rift.
2. Check that the headset is working and displays its home scene correctly.
|
|
3. Start V-Ray GPU IPR render. The first render will start slowly since it takes some time to load the Oculus VR library.
The information in this section will help explain how to use MAXScript to navigate around the VR environment with a game controller. Below is a download link to a sample MAXScript that sets the buttons and analog sticks in a general configuration to get you up and running. For more details,please see comments in the top section of the script file.
Access to VR controllers state is available in ActiveShade mode. Currently, the controller state is only accessible during Oculus Rift preview sessions (Stereo mode = Oculus rift).
You can refer to the current renderer and check to see if it supports VR controller interfaces from MAXScript:
renderers.current V_Ray_GPU_Next:V_Ray_GPU_Next ivraygpu=getinterface renderers.current "vrayrtmax_interface" <MixinInterface:vrayrtmax_interface> |
Assuming that variables ivrayrt and rt are initialized as stated above, you can list the VR controllers related interface properties:
showinterface ivraygpu <MixinInterface:vrayrtmax_interface> Interface: vrayrtmax_interface Properties: .vrControllerLTouch : Interface : Read .vrControllerRTouch : Interface : Read .vrControllerRemote : Interface : Read .vrControllerXBox : Interface : Read Methods: Actions: OK |
The interfaces are also available as renderer properties:
showproperties renderers.current ... .vrControllerLTouch : Interface .vrControllerRTouch : Interface .vrControllerRemote : Interface .vrControllerXBox : Interface ... false |
All VR controller interfaces are uniform – they contain the same methods and properties regardless of controller type. Interface information can be displayed as follows:
showinterface renderers.current.vrControllerLTouch Interface: VRController_LTouch Properties: .connected : boolean : Read .timeInSeconds : double : Read .indexTriggers : float by value array : Read .gripButtons : float by value array : Read .thumbSticks : point2 by value array : Read .buttonA : boolean : Read .buttonB : boolean : Read .buttonRThumb : boolean : Read .buttonRShoulder : boolean : Read .buttonX : boolean : Read .buttonY : boolean : Read .buttonLThumb : boolean : Read .buttonLShoulder : boolean : Read .buttonUp : boolean : Read .buttonDown : boolean : Read .buttonLeft : boolean : Read .buttonRight : boolean : Read .buttonEnter : boolean : Read .buttonBack : boolean : Read .buttonVolUp : boolean : Read .buttonVolDown : boolean : Read .buttonHome : boolean : Read .touchA : boolean : Read .touchB : boolean : Read .touchRThumb : boolean : Read .touchRThumbRest : boolean : Read .touchRIndexTrigger : boolean : Read .touchX : boolean : Read .touchY : boolean : Read .touchLThumb : boolean : Read .touchLThumbRest : boolean : Read .touchLIndexTrigger : boolean : Read .touchRIndexPointing : boolean : Read .touchRThumbUp : boolean : Read .touchLIndexPointing : boolean : Read .touchLThumbUp : boolean : Read Methods: <void>setNotifyCallback <string>callback <float>threshold Actions: OK |
Property | Description |
---|---|
connected | True if the corresponding controller is connected; otherwise false. |
timeInSeconds | System time of last controller state update. |
indexTriggers[1] indexTriggers[2] | Left and right finger trigger positions, in the range of 0.0 to 1.0. |
gripButtons[1] | Left and right grip button positions, in the range of 0.0 to 1.0. |
thumbSticks[1] | Left and right thumb stick position coordinates in the range of -1.0 to 1.0, as point2 values. |
buttons, touches | Boolean properties that represent the state of various buttons and sensors on the controller. |
setNotifyCallback <callback> <threshold> | Sets notification MAXScript that will be executed whenever controller state changes. |
Sets notification callback which outputs left index trigger position of the XBox controller whenever its state changes:
fn myNotifyCallback = ( format "XBox Left Trigger value: %\n" renderers.current.vrControllerXBox.indexTriggers[1] ) renderers.current.vrControllerXBox.setNotifyCallback "myNotifyCallback()" 0.1 |
Stop receiving notifications from the XBox controller:
renderers.current.vrControllerXBox.setNotifyCallback "" 0.1 |
Process notifications from two different controllers using a common callback:
iXBox= renderers.current.vrControllerXBox iRemote= renderers.current.vrControllerRemote fn myNotifyCallbackWithParam controller_interface = ( format "controller % button UP state %\n" controller_interface controller_interface.buttonUP ) iXBox.setNotifyCallback "myNotifyCallbackWithParam iXBox" 0.1 iRemote.setNotifyCallback "myNotifyCallbackWithParam iRemote" 0.1 |
Focus method in VRay GPU is settable using MAXScript:
renderers.current.stereo_focus=0 |
stereo_focus can take the following values:
0 - parallel
1 - rotation
2 - shear transform
|