DEV Community

kurohuku
kurohuku

Posted on • Edited on

SteamVR Overlay with Unity: Appendix

This part contains where to look for more detailed information.

OpenVR repository

OpenVR’s official repository is the most important

https://github.com/ValveSoftware/openvr

I recommend reading the wiki at first.

https://github.com/ValveSoftware/openvr/wiki/API-Documentation

Detailed information that is not on the wiki tends to be written in C++ header file comments. If you are looking for some feature, try to find the header file.

https://github.com/ValveSoftware/openvr/blob/master/headers/openvr.h

Anything else, try to find from the issue.

https://github.com/ValveSoftware/openvr/issues

SteamVR Unity Plugin repository

SteamVR Unity Plugin repository has utilities for Unity.

https://github.com/ValveSoftware/steamvr_unity_plugin

Here is the document.

https://valvesoftware.github.io/steamvr_unity_plugin/api/index.html

Other repositories

Open source projects like OVR Advanced Settings are helpful.

https://github.com/OpenVR-Advanced-Settings/OpenVR-AdvancedSettings

Show 3d objects with overlay

Overlay can show 3d objects with stereo image.
For example, the VR paint app Vermillion has overlay mode that displays 3d objects.

I don’t have enough information but list up methods I know.
(The below information may contain incorrect information.)

Method 1: SideBySide

Pass VROverlayFlags.SideBySide_Parallel to SetOverlayFlags(). This enables stereo images for overlay.
Side by side image is an image that the left half to the left eye and the right half to the right eye then it makes 3d.
Create two cameras for each eye in Unity, and draw the camera output horizontally onto the texture to make side by side texture.

Method 2: Stereo Panorama

Pass VROverlayFlags.StereoPanorama to SetOverlayFlags(). This enables stereo panorama for overlay. Like the side by side, stereo panorama uses two areas of the image for each eye.

Method 3: Overlay projection

SetOverlayTransformProjection() shows overlay for the specific eye only.
You can get the eye position by transforming Origin -> HMD -> Eye with GetEyeToHeadTransform().

Method 4: Combine planes

If the desired 3d object is a simple form like a cube, you can make 3d objects with 2d planes. For example, create a cube with 6 overlays or a cylinder with a curved overlay with SetOverlayCurvature().

I use this method in OVR Locomotion Effect. It makes a large grid cube that encloses the player with 6 overlays. Also, the wind effect is made with a curved overlay as a tube and encloses the player’s HMD to create a sense of depth.

Find with keyword stereo or sidebyside in openvr.h for 3d objects.

Get the HMD output

GetMirrorTextureD3D11() or GetMirrorTextureGL() of OpenVR.Compositor read the HMD output.

Top comments (0)