Jump to content

Ultra Software Company Blog

  • entries
    188
  • comments
    1,259
  • views
    685,492

Contributors to this blog

Leadwerks Game Engine 4.4 Beta Adds OpenVR Support


Admin

3,867 views

 Share

Leadwerks Game Engine 4.4 beta is now available on the beta branch on Steam. This adds support for virtual reality with the OpenVR library. OpenVR supports both the HTC Vive and the Oculus Rift headsets.

 

vr_main.jpg

 

To enable VR mode in your Leadwerks game, simply call the command below. If a VR headset is detected and initialized, this function will return true:

VR:Enable()

 

Any cameras not attached to a rendering target will render directly to the headset views. Both eyes will be rendered to automatically. The camera's position and orientation will automatically be tracked, and will override any positioning you give it in your code. You can switch between room-scale and seated VR tracking with the following command:

VR:SetTrackingSpace(mode)

 

Where mode is one of the constants VR.Roomspace or VR.Seated. Use the command VR:CenterTracking() to re-center the camera, in seated VR mode only. The VR system will automatically shut down when your game exits. You also no longer need to call System::ShutDown in your C++ code, as this will be done automatically when the main() function returns.

 

Controllers will automatically be detected and render in your view. You can use the VR::GetControllerButtonDown(devicenum, button) and GetControllerAxis(devicenum, button) commands to get button presses and movements. The devicenum parameter will typically be zero or one, and the button argument can be one of the following constants:

  • VR.TouchpadButton
  • VR.GripButton
  • VR.MenuButton
  • VR.TouchpadAxis
  • VR.TriggerAxis
  • VR.TriggerButton

 

At this time, you cannot hide the default controllers. Button motion will not be rendered in the virtual world. Camera culling does not exactly match the VR render frustum, and some objects will pop out of view at the periphery of your vision. Post-processing effects should not be used in VR, as they don't always look right, and the VR renderer uses a half-float RGB buffer to store screen positions, since depth reconstruction cannot be used with sheared projection matrices. The current build is a beta and may change before the final release.

 

You can read more about Leadwerks VR here.

  • Upvote 3
 Share

5 Comments


Recommended Comments

For Linux users, I also added a yourgame.sh file in the project template that you can use to launch your games, and make sure all .so files are loaded from the same directory (they aren't by default!)

Link to comment

I might change it so if seated VR mode is in use, your motion becomes an offset the camera uses when rendering. This would make all the game launcher games playable in VR, (although it might be kind of sickening!)

  • Upvote 1
Link to comment

I think having it as offset to the camera is a requirement even for room-scale vr.

 

You can always end up having a too small room for the game / application and you might want to include some teleporting mechanism.

Link to comment

I think having it as offset to the camera is a requirement even for room-scale vr.

 

You can always end up having a too small room for the game / application and you might want to include some teleporting mechanism.

Yes, we need to be able to move around, but that will typically be done by the programmer adding input. Not sure if these two concepts are the same or different. Will require experimentation to see what works best.

Link to comment

so how would i set the vr view from my player camera insted of it creating its own camera in the center of the world.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...