Forum Discussion

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

Skybox doesn't appear in OVR

in Unity 5.1.1 I've got a skybox texture set up using Window->Lighting->Environment Lighting->Skybox. The skybox shows up fine in non-VR, but the moment I go into VR mode, all I get is the default plain blue skybox. Any ideas what I'm doing wrong?

10 Replies

Replies have been turned off for this discussion
  • What type of shader are you using for the skybox? I just tried it and it seems to work for me.
  • dustums's avatar
    dustums
    Honored Guest
    It's from a skybox I got from the asset store, using a "Skybox/6 sided" shader. What are you using to get a functional skybox under VR?

    I also wrote my own PlayerController since there were issues with OVRPlayerController. Is there any dependency on OVRPlayerController for skyboxes to work? I didn't see any.
  • Yeah, I was using 6-sided as well, but with the Unity first-party VR support (i.e. "Virtual Reality Supported"). If you are using the legacy integration, then it's possible the skybox is still broken (it was for a while, haven't checked recently).
  • In the Camera component make sure that clear flags parameter is set to Skybox. Hope it helps ^^
  • Did anybody figure this out? I'm having the same issue: the skybox renders fine in normal mode and in camera preview, but not in Oculus DK1.

    However, this only happens in one of my two scenes. In the other scene, the skybox works great. Camera settings and Skybox/6-sided shader are identical in both; the only difference was that one used 2048 bmp images for the mat and the other used 1024 png, but I tested by converting to 1024 png and still have the same problem: wherever the viewing window of the Oculus is facing, it creates a background-color rectangle instead of the Skybox in that location (which fills the Oculus field of view with the scene's background color, not showing the Skybox at all)

    I am also seeing this coincide with two error messages which, for some reason, I don't get in my other scene, so I wonder if it's related:

    rc.right == m_GfxWindow->GetWidth() && rc.bottom == m_GfxWindow->GetHeight()

    GUI Window tries to begin rendering while something else has not finished rendering! Either you have a recursive OnGUI rendering, or previous OnGUI did not clean up properly.


    I can't figure these out, because I don't have any OnGUI calls or GUI elements being used in my scripts...

    Anybody else having this issue? :?

    EDIT 1: I am using 5.1.1p3 and implementing Unity's native VR (not the Oculus tools/SDK)

    EDIT 2: I just tested the scene with another camera (a static one, not a moving one which I am using for the first-person view of my game), and the Skybox works just fine... but when I make this camera become a moving, animated, first-person camera, I get weird culling/occlusion which shows background color instead of skybox...
  • Okay, here are some further things for OP to test/try, if you haven't, because I have pinpointed where my problem is (but I'm still not sure why this is a problem):

    The problem occurs when I have the camera nested within other game objects. Here's my hierarchy: I have a "Character container" that moved both my main character as well as a jet he is in; I have them grouped so that I can easily use one Animation View/Window to do intro fly-in/cut-scene for the plane and the FPS player inside, who then ejects from the jet (at which point the plane object is shortly removed, leaving just the player mesh/avatar inside the CharContainer)

    So I have CharContainer-->Player-->CameraContainer-->MainCamera . The camera is nested under the Player object, in the head location of the player model; it is placed inside of a blank GameObject because that is the only way I was able to enforce camera moves/rotations in Unity (for intro animations with moving/animated viewpoint)

    This all works well, but for some reason this level of nesting is causing background to appear instead of SkyBox. Even if I take it to just CharContainer-->CameraContainer-->MainCamera, it still has this problem.

    However, if I place the MainCamera at first or second level of hierarchy (in main scene, or nested directly under CharContainer), the problem goes away.

    This seems like a bug?

    Strangely, I don't get this problem in my other scene, in which my main camera is nested at:

    Jetplane-->CameraContainer-->MainCamera
  • Update: I cannot figure out any rhyme or reason for what causes the clipping/Skybox problem. To original poster: if you have your camera nested/childed under things, try taking it out from under the parents and see if that fixes the problem.

    For me, it is a major hassle, as I have a whole animation sequence set up for it, but alas I'm just going to have to carefully reanimate (if I do it right, I can pull things out of hierarchies and copy/paste positions and rotations to duplicate what I had)

    I did a test to see if I rearranged the grouping/parenting a bit whether that would fix the problem. In this case, my path was only PlayerObject-->Camera, and yet even with only one parent, the Skybox wouldn't appear.

    Yet if I create an empty GameObject and place the camera in there, everything works fine. So I thought maybe it could be affected by the skeleton also in my PlayerObject? Its Animator Controller/controller/rig? Its other child meshes (the body of the character)? Its collider or rigidbody? But, funny enough, even when I removed ALL of that, the problem persisted. Even after I had, essentially, turned PlayerObject into an empty GameObject!

    So, to get this straight: placing a camera under a new empty GameObject = fine, but turning an existing GameObject into an empty one and having camera as a child = no-go.

    Something is rotten in Denmark.

    Anyway, so I give up. Going to just take some time to redo things. Should've figured this out sooner and aborted my animation once I saw a problem with skybox, but didn't think the solution would be as weird as this...
  • FIX:

    Okay, I pinpointed the problem... the camera doesn't play nice with the Skybox if its parent is a GameObject that has any sort of scaling done to it. It appears as long as it its parents have 1/1/1 scale for X/Y/Z, then the Skybox issue does not exist.

    Not sure what the logic behind this is (I mean, you can apply a scale to the Camera itself, and it doesn't cause a problem), but there you have it... for anybody who runs into this problem (or for the Unity crew to take into consideration, if this is not intended behavior. It would really be preferable if it didn't happen)


    So, OP, go ahead and check to make sure that your camera isn't the child of any scaled parent objects. That fixed my issue, which sounds a lot like yours... (it was showing just "blue", but would actually show whatever "background color" I chose in the scene lighting settings, just wouldn't show the Skybox)
  • I am using the OVRCameraRig which is inside the OVRPlayerController and I am facing the same issue of skybox. Skybox is working good if I am using normal Camera, but it is not working for OVRCameraRig. Please share the solution of this problem.