VRED Presenter has no GUI, such as menus, so how do you activate your HMD (head mounted display) and display your scene in virtual reality? To do this requires some scripting.
For further information on other ways to use the VRED Presenter, click here.
You will need to activate an HMD, such as an HTC Vive or Oculus Rift. There are two ways to do this:
Use a special command line parameter:
For HTC Vive:
-postpython "setDisplayMode(VR\_DISPLAY\_OPEN_VR)"
This does the same as selecting View > Display > OpenVR HMD in VRED Professional or VRED Design (since 2019).
For Oculus Rift:
-postpython "setDisplayMode(VR\_DISPLAY\_OCULUS_RIFT)"
This does the same as selecting View > Display > Oculus Rift in VRED Professional or VRED Design (since 2019).
Use an embedded script. The person who created the scene would save the scene with a special Python function in the vpb file. See the following section for more information.
Use a special command line parameter to prepare a scene to open in VRED Presenter and activate an HMD to view the scene in VR. The advantage of the -postpython
command line option is you don't need to modify the existing .vpb file. You can use it with any existing .vpb file.
Enter the following in the command line:
VREDPresenter.exe c:/vred/scene.vpb -postpython "setDisplayMode(VR_DISPLAY_OPEN_VR)"
This does the same as selecting View > Display > OpenVR HMD in VRED Professional or VRED Design (since 2019).
VREDPresenter.exe c:/vred/scene.vpb -postpython "setDisplayMode(VR_DISPLAY_OCULUS_RIFT)"
This does the same as selecting View > Display > Oculus Rift in VRED Professional or VRED Design (since 2019).
The embedded script makes doing complex things much easier than script coding via the command line. Often for VR presentations, there is already a script in the file for the controllers, since that is the only way to connect custom functionality to the controller buttons.
Use the Script Editor (Edit > Script Editor) for entering the embedded script. By default, the editor is empty. When you enter a Python function in it, it is saved within the .vpb file. When the .vpb file is loaded, the script is executed. See To Create, Edit, and Use Scripts for more information on using scripts.
The automatic execution of the script can be disabled in the Preferences (Edit > Preferences > FileIO > OSB/VPB > Execute Embedded Script).
This section is for someone using VRED Professional. They will embed a script into their scene.
The automatic execution of the script can be disabled in the Preferences (Edit > Preferences > FileIO > OSB/VPB > Execute Embedded Script).
With the scene open, select Edit > Script Editor to open the Script Editor.
Enter the following script to create shortcuts for turning VR on and off.
def enableVR():
setDisplayMode(VR_DISPLAY_OPEN_VR)
def disableVR():
setDisplayMode(VR_DISPLAY_STANDARD)
keyV = vrKey(Key_V)
keyV.connect(enableVR)
keyS = vrKey(Key_S)
keyS.connect(disableVR)
Save the .vpb file. Now, when anyone opens this file, they can press the V key to enable VR and the S key to return to standard desktop mode.
Anyone opening a .vpb file containing an embedded script can press the key defined in the script to enable and disable things.
In VRED Presenter, there is no Script Editor or way to see if there is an embedded script within the file. This means that the creator of the file will need to inform you of any shortcuts they've added.