# Is there a hard maximum far/near clip plane ratio?

Hi,

My team and I are developing Cesium for Unity:

It makes it easy to render large-scale geospatial datasets in Unity, up to including the entire Earth. As you can imagine, this involves some very large view distances, such as when viewing the whole planet from space. And it’s also possible to have something up close to the camera (a satellite, perhaps), while also having something very far away (perhaps the planet itself). This sort of application always poses a challenge for depth buffer precision, and the graphics team at Cesium has been thinking, writing, and presenting on this subject for many years.

To summarize very briefly, we have generally found the following depth buffer solutions to be adequate for the needs of most applications, in order of preference:

1. A 32-bit reverse floating-point depth buffer
2. A logarithmic 24-bit depth buffer
3. When all else fails, render with multiple frustums in a far-to-near order

As virtually all modern hardware and graphics APIs these days support solution (1) at this point, we expected that would be Unity’s approach. But we’re running into an odd problem.

The problem is that Unity seems to simply forbid us from setting the near and far clip distances such that the far/near ratio is greater than ~100,000. Or, to be precise, it lets us set the values to whatever we want, but then effectively clamps the far distance to be no more than 100,000 times the near distance. A reverse floating point depth buffer should be able to support a much greater range than this without major artifacts, so we’re not sure why there’s such an arbitrary limit.

Is this expected, and is there any known workaround? In case it matters, most of our tests have been in Windows (D3D11) with URP and Unity 2021.3.

Thanks for any insights,
Kevin

1 Like

Yes, weird artifacts will appear, covering mostly the sky and the edges of far elements on screen. You will experience ASCII symbol like artifacts in makro size or jumbo size if you like that term more. It can happen that you run passively into that trap, not knowing it is because of that ratio.
In most cases it is not something complicated and also in most cases BiRP does support the vast amount of visual effects, just with a different quality. (To cover some peoples issues here)
Well it might not help at all the beloved Cesium Team, but all that come here for the same stupid mistake to forget about that ratio… good luck