- Home /
Skybox stops drawing at certain angles
I have a very simple skybox material. I am using Render Settings to set the skybox for my scene, and I am using a single camera in the scene. The camera is set to the Skybox Clear Flags option.
Sometimes the skybox draws, and sometimes it doesn't depending on where I am in the scene and where I am looking with the camera. I have tried extending the culling plane but that doesn't help at all. This seems counter to what a skybox is supposed to do, draw at all times.
When it is suddenly not drawing, it defaults to the background color set in the camera. I can't find a reason for this in any of the Unity documentation.
Thanks
Very strange. Your inclination to increase the clipping distance makes sense, since it sounds like the effect you'd see if you were using a mesh as a skybox and the far clipping plane was sometimes culling parts in the distance ... except that you are using the built in Skybox rendering which shouldn't be dependent on the far clipping plane.
A few things to try: Can you replicate the problem in a very simple scene (Plane, Camera & stock First Person Controller) ? In your scene, what happens if you use one of the unmodified Skybox materials from Standard Assets ins$$anonymous$$d of your material ? (this should isolate if it's an issue with your Skybox material, or something general to the scene setup). What shader is your Skybox material using ? What happens if you ins$$anonymous$$d attach a Skybox component to the camera, rather than use Render Settings ?
Answer by Bunny83 · Feb 01, 2015 at 11:39 AM
Well, Unity's skybox is fillrate-friendly. That means it avoids overdraw where possible. What unity does is:
Clear the framebuffer with a solid color.
draw opaque geometry
draw the skybox
draw transparent geometry
Now if you create a shader that is transparent (it uses a blend function) but is drawn in the opaque step, no skybox will be visible behind the geometry.
Your description of your problem is not very detailed. How does it disappear? Suddenly or do you see a clipping edge? Does it vanish completely or only behind certain things?
In our student project we had a similar problem when we used the depthmask shader to clip parts of the terrain. Where we used the depthmask shader the skybox wasn't visible anymore. This is because the depthmask shader draws into the depth buffer and the skybox shader just ignores that parts as well since it should be all opaque geometry at this point.
Our solution was to create a manual skybox geometry that we've drawn with a second camera before everything else.
Your answer
Follow this Question
Related Questions
Problems with Graphics.DrawMesh, where to call it and how to get material property blocks to work. 3 Answers
Creating a Masking Object with Variable Pass Through 0 Answers
Unity 5 Custom Deferred shader 0 Answers
Why is this issue occurring with my models? 1 Answer
Object see-through when rendering mode is set to Fade 1 Answer