Forum Discussion

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

How to build for Oculus Rift

Hey dudes,

I apologize if this seems obvious, but I cannot find a clear answer anywhere. How do you build your demo for use with the Oculus in UE4? I've seen the Oculus template, but must you use that? I built my demo in a blank project, and cannot seem to find a straight answer of how to get it working with the Rift besides entering 'stereo on' in the console, which I don't want to have people do to play my demo. Does UE4 just detect the Oculus and automatically run it? Thanks guys.

EDIT: Is there a guide that exists somewhere for setting this up?

7 Replies

Replies have been turned off for this discussion
  • Anyone? This is pretty confusing. If anyone has experience, please, please chime in.

    I keep reading different things, but everything is extremely vague. Is there a step by step guide anywhere to adding VR functionality into your game properly? For example, in Unity you simply drag in the OVRCamera prefab, and voila. I don't understand the equivalent of this in Unreal. I have opened a VR Template made by someone, and I can't tell how it differs from a regular Unreal project. The PlayerStart object seems the exact same. What am I missing? If anyone can help, it would be hugely, hugely appreciated. Thank you.
  • There shouldnt be anything to do as there is no seperate camera rig. And the Oculus plugin is enabled by default.
    As long a the rift is on and you set your app to go fullscreen upon launch it should just work.

    If you dont set your app to go full screen upon lauch or the user does'nt set fullscreen with Alt+Enter you can use the console command 'Stereo on'.

    *Edit
    Heres a list of console commands for the rift,

    UE4 Oculus
    ----------
    Setup windows with extend desktop onto all displays, no mirroring. Single display is also ok.
    When running the game, if it is set for fullscreen (either in config or by pressing F11), and a HMD is detected, it will go into fullscreen on
    the HMD only. If you don't want to use fullscreen, the sensor is still used for positioning and stereo/lens distortion compensation can
    be enabled manually. The headset must be connected before running the game. Only one HMD can be connected at a time.

    Contents:
    Console commands

    ----------------
    Console commands
    ----------------

    Stereo/HMD Configuration
    ------------------------
    stereo on|off|toggle Stereo mode on/off
    stereo hmd Turns stereo on and re-direct rendering to the Rift.
    hmd enable|disable Completely disables or re-enables HMD
    hmd qahead [on|off] enable/disable QueueAhead
    hmd pd 0.8 Sets pixel density in the center (default is 1.0).
    hmd sp 125 Overrides default screenpercentage for stereo mode. Deprecated, use 'hmd pd xxx' instead.
    hmd sp reset Resets to original r.ScreenPercentage value. Deprecated, use 'hmd pd 1' instead.
    hmd mirror [on|off|toggle] Enables/disables/toggles mirroring in a window (for "Application Only" mode only).
    hmd mirror 800x600 Sets mirror window dimension (for Direct mode only).
    hmd mirror mode 0|1|2 Sets mirror window mode: 0 - standard stereo distorted view, 1 - stereo undistorted view, 2 - mono view (a single eye)
    stereo e=0.064 Eye distance (m). Use 'stereo reset' to restore original value.
    stereo w2m=100 Overrides default worldunits-to-meters scale. Use 'stereo reset' to restore original value.
    stereo ncp=10 fcp=10000 Overrides near clipping and/or far clipping planes for stereo rendering (in cm). Use 'stereo reset' to restore original value.
    stereo show Shows current ipd and head model offset
    stereo reset Resets stereo settings

    hmdpos on|off Enables/disables positional tracking.
    hmdpos reset Resets forward direction and 'zero' position
    hmdpos reset -37 Resets forward direction and apply yaw rotation (in degrees) and 'zero' position
    hmdpos show Shows status of positional tracking.
    hmdpos enforce Toggles positional tracking even if not in stereo (for testing purposes).

    Stereo/HMD Internals
    --------------------
    hmdmag on|off Turns magnetometer on/off
    hmdmag show Shows state of magnetometer

    Misc
    ----
    hmd stats Shows HMD-related stats.
    hmd grid Toggles lens-centered grid.
    hmddbg showcamera [off | toggle] Draws a tracking camera frustum in the game's world.
    hmddbg cubes [on | off | toggle] Draws a 'sea of cubes' over the existing scene.

    hmd updateongt on|off Turns on/off update-on-gamethread mode (for debugging). On by default.
    hmd updateonrt on|off Turns on/off update-on-renderthread mode for lower latency. On by default.
    hmdversion Prints Oculus SDK version used and Oculus Plugin info
    uncapfps Uncaps FPS (allows FPS > 62); to restore cap - "set Engine bSmoothFrameRate 1"
  • opamp,

    Thanks for the reply. Do you not have to attach any special blueprints to the Player? In the VR Template it looked like there was some pretty complicated Blueprint stuff happening that was directly interacting with the headset, but I couldn't understand what. Any idea? Thanks.
  • bjw88's avatar
    bjw88
    Honored Guest
    You shouldn't need any blueprint unless there is something you want to do with the the HMD other than use it to move the camera, in which case the blueprint would be unique to the needs of your projects.

    Pretty much everything you need to know for basic usage can be found on these two pages:
    https://wiki.unrealengine.com/Oculus_Rift
    https://docs.unrealengine.com/latest/INT/Platforms/VR/index.html.

    If you need to go beyond that or have difficulties getting the Rift up and running, feel free to ask more questions.
  • Just tried packaging and it didn't work at first but then we added "stereo on" and "hmd enable" console commands to the onbegin play event in blueprint and that worked. Hope that helps.