Background color instead of Skybox appearing in viewing plane?

In my project, I have two scenes, using skyboxes that were included as assets in two different packages from asset store. The first scene has a space background for an Earth asset, and the space Skybox works just fine.

The second scene is a Quantum Theory arid/canyon landscape with sunset skybox. When I preview the camera view of the scene, it looks like all will be fine, but when I run through Oculus DK1, the skybox doesn’t appear – and you can see (on the Unity editor window) that it is being replaced/occluded with a rectangle matching the Oculus viewing angle/plane/field-of-vision. That rectangle happens to match the Background color set in the camera, so it’s like it is specifically choosing to render background color instead of Skybox. (all other meshes, etc. render fine in the scene, just not the skybox)

These error messages also appear in console:

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

and

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.

Any ideas what is going on here? I’m going to investigate the skyboxes and see what the differences are, but … I’m a little baffled by the GUI Window error message, as I’m not (to my knowledge) using any GUI elements or calling OnGUI in any scripts…

A few more details (will experiment to see if these are causing problems, because I’m baffled as to what the heck is going on here):

Both skyboxes are standard cube-type, but the working one is comprised of 1024 png images, while the busted one is 2048 bmp.

I’m going to downsample to a 1024 png version and see if that fixes anything, but I can’t see how the resolution/image type would be causing these GUI and GFXWindow errors…

Did some more testing. The skybox works okay when I added a new camera at the top level of the scene.

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/parenting 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 as a child directly under CharContainer), the problem goes away.

This seems like a bug? It simply doesn’t seem logical?

Strangely, I don’t get this problem in my other scene, in which my main camera is a grandchild, located 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…

Just figured I’d post this “solution” (really a workaround/redo because I can’t for the life of me debug what is happening) here for anybody who happens to run into the same problem and finds this thread. If anybody sees this and has any idea why I’m getting those console messages, I’d still be curious to hear…

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)

Can you try on 5.1.1p4 or higher? From release notes:

VR: Fix rendering issues when camera parent is scaled.

Hi

I know it is an old thread. But I am experiencing the same problem. The camera has been parented under an empty gameobject which has positios (0,0,0) , rotation (0,0,0) and scale (1,1,1). But still only background colour is seen. I am using Unity 5.3.1.

If the camera is not animated, it shows fine, but after animation , Only blue background colur is seen.

Well, I was able to work it around myself.

Instead of “Animator” component , I used “Animation” component by enabling “Legacy” in Debug Mode. It worked!