Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
pixeledsheep's avatar
pixeledsheep
Honored Guest
10 years ago

NGUi not showing on Gear VR

Hello everybody!

I have searched the forums and on google trying to find a clear answer, but for me it is not yet clear so I will ask here:
Is it a way to display NGUi content on a Gear VR app? I have build a simple project with a sprite rendering via NGUi and I cannot see-it. What is even weird is that if I delete the NGUi setup and manually add another camera, orthographic and rendering only the UI layer, and on the UI layer I add a cube, the cube is rendered correctly on top of my game, like a GUI would do.

So I guess my question is why the manually added camera is rendering and the NGUi camera does not? Anybody can please point me to where or what I am doing wrong?

Thank you!

2 Replies

Replies have been turned off for this discussion
  • Generally you'l want to set up a render texture when using ngui with gear/dk2 since the camera used to render the UI layer isnt taken into account with the oculus camera rig.

    basically you'd do something like this:
    -create a plane or quad and parent it to the center eye anchor of the OVR rig
    -Create a render texture and apply it to the plane
    -Set the render target variable of the Ngui UI camera to the newly created render texture.

    This should give you a basic setup, though you'l probably also want to use an unlit shader for the plane's material and set the z write to Off so as to prevent the quad from being clipped by intersecting objects
  • Hello and thank you for taking the time to reply :)
    Yes, the render texture seems a good solution but I did not used it intensively till now so my mi knowledge are limited.
    I did manage to setup a render texture on a quad, assign the camera to output to that render texture and everything worked fine.

    Now I have another problem: the camera is wide while the render texture is a square :) and I can't simply deform the quad just because the camera image will stretch abnormally. Is there any solution to this?

    Tnx a lot guys!