3
\$\begingroup\$

I am trying to build a game for my son for the Oculus Rift DK2 to help treat his lazy eye using Unity.

I need objects that:

  • Appear only to his left eye
  • Appear only to his right eye
  • Appear for both eyes.
    (this helps force the brain to use both eyes together to form the complete scene)

How can I pull this off?

Thanks!

\$\endgroup\$
  • 1
    \$\begingroup\$ I'm not sure about oculus rift but can you implement two cameras, one for each eye? And when you want to hide an object from one camera(eye) you can utilize the camera view layers? \$\endgroup\$ – Savlon Apr 8 '15 at 12:34
  • \$\begingroup\$ @Savlon there are two cameras, but they're created by the Oculus plugin at runtime. Working with them at design-time is difficult. \$\endgroup\$ – 3Dave Jan 25 '17 at 14:37
1
\$\begingroup\$

Use culling mask for each camera & use corresponding layer for intended object that supposed to disguise for that specific camera.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

The most direct way, unfortunately, is to group the objects that you want to hide - layer, culling mask, custom property or whatever - and enable/disable them before rendering. You'd need to add a component to the Oculus cameras that, in a pre-render event handler, enable or disable the layers.

Note that, for each frame, you'll get at least two renders per update (assuming that your game isn't dropping frames) - one for each eye. In Update(), set a flag indicating that the current eye is left. At the end of the first render, change that flag - probably just an integer - to right, and enable / disable whatever you need to.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.