Hi,
So, this is an issue that has peeved me for a good while now, I reckon now is as good a time as any to ask about it.
The problem is as follows:
My game world (KSP) is too large for a single camera to render accurately. I have very close foreground objects (ships and such) and very distant objects (terrain). A single camera can’t render the near objects without causing severe z fighting issues on the terrain (especially along shorelines), and to render terrain stably, I have to push the near clip so far it clips off the player’s ship.
So, the solution is to use two cameras (on this layer. There are more cameras, but these are the ones that draw shadows, so they’re the ones that matter). A Near camera starts off at a very close near plane and far clips at about 1km. Then a far camera picks up from there and draws the world from 1km to 80km (past which the terrain is replaced by the scaled layers, which are beyond the scope of the issue).
The problem I have is in the transition between the near and far cameras. They stack up nicely for geometry, but there is a noticeable artifact with shadows. You can see it plainly here:
That hard edge is where the far camera’s frustum begins. If you look closely, you’ll notice that the edge is caused by the near camera fading off shadows as they approach the far end of its frustum.
I’ve looked far and wide, and so far haven’t had much luck finding anything about this… Admittedly, a multi-camera rendering stack isn’t exactly common, and for most single-camera rendering setups, this is actually a feature, as shadows gradually fade from view as they get farther away.
I’ve tinkered with the shadow settings quite a bit too. In the KSC scene as seen above, the shadow distance is set to 5000m, well past the far clip of the near camera. The problem is that the shadows will fade both when approaching teh shadow distance, or when approaching the far clip plane, and there seems to be no way to adjust this behaviour.
Just for reference, I’m in Unity 5.2.4 now, but this has been here since U4.x and possibly even earlier. I have never not had this behaviour. It also seems to be consistent across platforms and rendering APIs too.
If anyone has useful knowledge to share about this, it will be hugely appreaciated!
As always, thanks in advance!!
Cheers