layerCullDistances farther than farClipPlane

I am looking for a way to overrule the clipping plane of the camera. Why? Because I have an object that is very far away, but should always be drawn. The rest of the objects in the camera should use their normal farClipPlane.

I tested this by setting my layerCullDistances for layer 12 (where the object is in) to 100000, but it still got clipped by the farClipPlane.

Camera.main.layerCullDistances[12] = 100000;

I also read the API: Unity - Scripting API: Camera.layerCullDistances
It only tells me about setting smaller values, but I want it to be larger.

How can I draw my object without it being clipped by the farClipPlane?

My second option is to use a second camera with a larger frustum, but this is not my intention, because it is against my design principles to have two cameras rendering the same way. There is most probably some setting that I can’t find.


Here is a screenshot of what is happening. The object is not culled completely, because the pivot point is in the cameras range, but it is clipped by the shader at the farClip’s distance.

unisky clipping problem

You can see in this image, that it should actually continue to the end. It is a simple sky dome. The complete object is not clipped, but changing the far clip plane does change this image.

I decided to make a camera managing system that has two cameras. One with a giant frustum that only renders the skydome. Its depth is set to -1. The other camera has a normal frustum, but only clears the depth buffer (clearFlags = depth) and depth = 0.

The cameras are drawn over one another, which is fine, but the camera needs polling to values like the FoV to maintain the same ratios.

The clearing of the depth buffer was very important to keep a good ratio for the SSAO-effect (Screen Space Ambient Occlusion-effect).

Another solution could have been, to set the farClipPlane to a large number at OnWillRenderObject. This also works, but the depth buffer still contains large values. So clearing the depth buffer is actually quite important to have high detail in the z-buffer.

The layerCullDistances can only reduce the far clip plane; I think it’s a kind of “fake” far plane, used to avoid drawing unnecessary far objects. The “official” near and far planes play an important additional rule - they set the range of the Z plane. You can set a really far camera’s Far Clipping Plane, but you can experience problems with borders of objects that intersect others or the terrain - the borders become to tremulate when you move the camera. If possible, you can increase the Near Clipping Plane distance to solve this problem - it has a much higher influence in the Z buffer resolution. The problem is that you can have very near objects clipped, since nothing before the near plane is drawn.