Author Topic: NGUI and Oculus Rift DK2  (Read 7314 times)

Martin Schultz

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 37
    • View Profile
    • Decane
NGUI and Oculus Rift DK2
« on: November 18, 2014, 03:43:02 AM »
I'm struggling to find a way to get NGUI working with the latest 4.3 SDK of the Oculus Rift DK2. As the new camera rig doesn't offer a depth value, I fail to see how I can get NGUI to render of the Rift camera view. Has anyone gotten this to work? Or is there something obvious I'm overlooking?

Thanks
Martin

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI and Oculus Rift DK2
« Reply #1 on: November 18, 2014, 05:29:36 AM »
Sounds like a question you should ask on the Occulus forum. What do you mean by "camera doesn't offer a depth value"? All unity cameras have depth.

Martin Schultz

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 37
    • View Profile
    • Decane
Re: NGUI and Oculus Rift DK2
« Reply #2 on: November 18, 2014, 06:34:22 AM »
I asked on the forums over there - no reply. Mabye they think it's something for this forum. :-)

The Oculus camera rig has of course 2 regular cameras, but changing those values doesn't seem to have any effect. The NGUI camera never renders over the Oculus camera rig, regardless what depth I put into any of those. I also tried setting the renderQueue manually to 7000 or 9000 in NGUI. Also no effect.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI and Oculus Rift DK2
« Reply #3 on: November 19, 2014, 03:13:03 PM »
Render queue is specified on panels. You should be changing camera depth, not panel depth. And make sure that the UI camera can't see the world and vice versa.

Martin Schultz

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 37
    • View Profile
    • Decane
Re: NGUI and Oculus Rift DK2
« Reply #4 on: November 20, 2014, 04:45:00 AM »
Found out why. The new Oculus SDK renders into a RenderTexture. So the RenderQueue doesn't work out unfortunately here - camera depth neither.

It was possible to put the NGUI UI as child of the right camera in the OVR camera rig at a distance of 1, but if you have geometry in front of the camera like me (sitting in a roller coaster), the object gets rendered in between. Not a solution.

I had the idea then to render NGUI out directly into the render texture of the right camera. Technically works, but the UI is rendered then half of the width in the middle of the screen.

I'm now experimenting with rendering NGUI to a render texture and then copying over the render texture over both render textures of the 2 OVR (Oculus) cameras. Will see if that works out. At least this way NGUI is rendered over the 2 cameras.