Leadwerks Game Engine 4.4 Beta Adds OpenVR Support
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.
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.
- 3
5 Comments
Recommended Comments