Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
drash's avatar
drash
Heroic Explorer
11 years ago

Implementing support for Direct HMD Access mode

I've been receiving a few requests for what I did to get Titans of Space working in Direct mode (for most people), using the 0.4.1 SDK.

I'm not sure that I'm doing anything all that different than the default settings, but basically the important ones as far as I can tell:

Unity version 4.5.3f3.

PlayerSettings -> "Default is Full Screen" = unchecked
PlayerSettings -> "Use Direct3D 11" = checked
QualitySettings -> "Vsync Count" = "every vblank" (note that I delete all but one of the quality settings so that there's no end-user confusion over which quality level does what, and no chance of mistakenly leaving the wrong one as the default quality setting, etc)

Not really related to direct mode, but something else I needed to do to support a Vsync toggle for as many people as possible is to have a script that checks the command-line arguments to determine whether -force-d3d9 was used. This way I can determine whether the program is running with DX11 or DX9. The reason I need to know this is because Direct mode + DX11 requires Unity Vsync to be on, or else it will crash at startup, but in DX9 mode, vsync can be freely toggled on and off via QualitySettings.vsyncCount. For DX11, instead of toggling QualitySettings.vsyncCount, I instead use OVRDevice.HMD.SetEnabledCaps() to turn vsync on and off in the lower level plumbing of the SDK itself. In addition, in DX11 mode, I will also have the program toggle vsync off and then back on near the beginning to get rid of any vertical tearing that may have snuck in -- works 90% of the time. (Huge thanks to ccs for his post on that.)

Might not be necessary, but just in case it helps:
Tiny startup scene to say loading please wait, while it calls LoadLevelAsync on the main scene.

That's about it!

4 Replies

Replies have been turned off for this discussion
  • Thanks for this, it's been an absolute sod getting Direct To Rift to work reliably. Very much appreciated.
  • Thank you Drash! :D

    One side question, which you may have aptly addressed elsewhere: how did you tackle chromatic aberration? I've used your amazing smear correction, but the only chroma solution I know is editing a dll, which doesn't seem all too useful or safe.
  • drash's avatar
    drash
    Heroic Explorer
    "CubicleNinjas" wrote:
    One side question, which you may have aptly addressed elsewhere: how did you tackle chromatic aberration? I've used your amazing smear correction, but the only chroma solution I know is editing a dll, which doesn't seem all too useful or safe.

    I didn't tackle chromatic aberration. There are those pre-built DLL replacements that work well for demos built with 0.4.1 SDK, but are one-size-fits-all so mileage may vary from person to person. I am hearing that the 0.4.2 SDK improves chromatic aberration correction, but haven't had a chance to check firsthand.
  • Wow, I'm amazed. Titans of Space seems to have very little to none. Appreciate the info!

    0.4.2 SDK may improve CA for some, but I'm starting to think it all depends on the colors being displayed. I have a scene that is nearly monochromatic purple and it is a psychedelic wonderland.

    Thanks again for the handy setting info! :)