Using the VRED Presenter for VR

How to Set Up Your HMD in VRED Presenter

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.

Note:

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:

Using a Special Command Line Parameter

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)"
Note:

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)"
Note:

This does the same as selecting View > Display > Oculus Rift in VRED Professional or VRED Design (since 2019).

Using an Embedded Script

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.

Note:

The automatic execution of the script can be disabled in the Preferences (Edit > Preferences > FileIO > OSB/VPB > Execute Embedded Script).

How to Embed a Script

This section is for someone using VRED Professional. They will embed a script into their scene.

Note:

The automatic execution of the script can be disabled in the Preferences (Edit > Preferences > FileIO > OSB/VPB > Execute Embedded Script).

  1. With the scene open, select Edit > Script Editor to open the Script Editor.

  2. 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)

    Embedded Script

  3. 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.

How to Use an Embedded Script

Anyone opening a .vpb file containing an embedded script can press the key defined in the script to enable and disable things.

Note:

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.

  1. Drag the .vpb file into VRED Presenter.
  2. Use the shortcuts. As stated in the example code, press the V key to enable VR and the S key to return to standard desktop mode.