OSVR / OSVR-Unity

Package for authoring OSVR experiences with Unity.
Apache License 2.0
98 stars 38 forks source link

Adds OsvrMirrorDisplay component, removes Direct Mode Preview #219

Closed nanospork closed 7 years ago

nanospork commented 7 years ago

Adds a new component, OsvrMirrorDisplay, that is much more performant than the Direct Mode Preview. Works by drawing the render target of a specified camera to the screen. Similar to #193, but higher level. In complex scenes, the profiler shows significant savings in frame times. In my own tests, a scene that stutters to as low as 50FPS with Direct Mode Preview remains at 90 FPS with this mirror [~9 ms!]

By default, the mirror locks the aspect ratio to that of the camera it duplicates and scales to fit the active display. It also, by default, fills in the "empty" space with a plain black texture. Users can specify an alternative "fill texture" to be rendered behind the mirror if they so choose, either in the Inspector or by setting the FillTexture property on the component. Or, they can disable this functionality altogether by unchecking FixAspectRatio in the Inspector.

By default, the camera to be mirrored is the first VREye found in the scene. However, users can specify an alternate camera either in the Inspector or by setting the MirrorCamera property on the component.

I've tested on both an HDK 1.4 and HDK 2.0 with good results, and in both Extended and Direct mode with the "mirror window" in both fullscreen and windowed mode

I have not tested on older versions of Unity, but I do not believe the functionality in any of the methods used has changed in a very long time.

DuFF14 commented 7 years ago

Looks good to me, thanks!