Spatialized HUD for 3D Stereo & VR
You want to VR-ify a game or add 3D stereo, but the original application integrated complex HUD elements? Some issues may come up with the port. But fear not, for some cases there is a workaround.
Update: Nowadays it's clear, simply porting to VR or 3D stereo is not a good idea without serious optimizations. Using HUDs in any stereoscopic vision should be avoided most of the time or designed with much care. Nevertheless, here is a description for a workaround:
The HUD for LizzE was originally created using the rather outdated third-party plugin NGUI in Unity v4.x. This GUI approach was based on using a separate GUI camera, which rendered 2D images to an overlaying layer on top of the 3D rendered image. During the development of the 3D stereo and VR versions of the game, it became clear, that this behavior was completely incompatible in terms of technique as well as design. In order to overcome this issue, without needing to re-develop everything from scratch, the following trade-off solution was developed: The original GUI camera setup was kept, but the render target was changed from the viewport to a special render texture. This render texture was then placed on a semi-transparent plane, which was parented to the 3D camera rig and placed slightly in front of it, so the 3D camera rig would always “look through” it (see yellow highlighted distorted squares in the image). The downsides of this approach were a mandatory square aspect ratio for the HUD, the enemy health bars needed to be disabled as they would have required a complete re-development, players would need to adjust their focus depth back and forth between the HUD and the 3D scenery and the edges of the GUI plane became visible, i.e. certain GUI effects like the red fade-ins when taking damage started off in mid-air. Nevertheless, this approach was good enough for an experimental prototype.