shadow distance per light(Directional)?

Hi! We are working on a flight simulator and we want to have dynamically changing daytimes, so lightmaps are not an option(at least not an ideal one)…

The realtime directional shadows work nicely over the terrain up to 5000m as we dont need super detailed shadows in the distance but on the aeroplane the shadows look of course very bad with the shadow distance set this high.

Would it be possible in any way to have 2 directional lights with a shadow distance of 0-100m and a seperate directional light with a shadow distance set to 100-5000m?

I think with a setup like this it would be possible to have nice shadows on close objects and have low resolution shadows on far objects.

Thanks in advance for any tips, ideas , thoughts…

Some light on this Problem…

Ok, after some further research and testing i assume that the shadow distance is also limited to the camera far clipping plane not only to the shadow distance.

To be exact: The shadow distance is calculated from the position of the cam(not the near clipping plane) to the set shadow distance OR(!) the far clipping plane of the camera, depending on which value is higher.


To illustrate what that means for a multicamera solution, i used the following setup:

  • A directional light with realtime shadows turned on
  • Shadow distance set to 5000(set in the Quality Settings)
  • NearRangeCamera - near clipping plane: 0,1 / far clipping plane: 100
  • MidRangeCamera - near clipping plane: 100 / far clipping plane: 10000
  • FarRangeCamera - near clipping plane: 10000 / far clipping plane: 100000

(all values are just for demonstrating the issue, i would be very happy with a shadow distance around 2500 as well)


That means that the NearRangeCamera gets shadows on its full view frustrum.
The MidRangeCamera gets shadows up to 5000 units from the camera position(the near clip plane gets ignored by the shadow distance).
The FarRangeCamera gets no shadows at all because its near clipping plane is higher than the set shadow distance.

This knowledge will help you a lot if you’re working on a flightsim or something else with huge viewing distances and long range realtime shadows.

But, does it solve my problem? NO! Unfortunately not!

Why? Well, there is a fade out on the shadow distance that i dont know if it’s possible to disable… this leads to a interuption of the shadow from one cam to the other that moves with the motion of the cameras:

NearRangeCamera → Shadowed Area → Shadow fades out at the end of the view frustrum. → (MidRangeCamera)Shadowed Area → Shadow fades out at the set shadow distance. → FarRangeCamera (does not matter for this as its beyond the shadow distance.)

Is there a solution? I dont know yet, maybe a shadow expert at unity can take a look at this problem. It would be highly apreciated!!!


I really want to know if there is a solution. I was playing with the thought to drop our dynamic daytime feature and use lightmaps but that just threw up another problem: The issues with beast and terrains: Beast takes forever to export a terrain and then uses incredibly amounts of ram, 32GB on my system were not sufficient for the 2049² Hightmap Terrain… This seems to be a known problem but i haven’t heard that there is a solution or progress on it. It was never a problem with unity 3.5… But all that is a different topic!


Please dear moderator, show this post to someone who knows the shadow system well!!
Aras Pranckevičius maybe?

Thanks in advance!!

Regards,

Peter at Team Becoming