managing shadow distance with a very low FOV perspective camera.

Hey all, I’m playing around with using an extremely low field of view camera (I’d like to go single digits, between 3 and 5 or so) and I’m moving the camera wayyy back to get all the scene I want in the camera’s viewport. The side effect of this is that shadow distance has to be set extremely high, which seems to be really bad for shadow quality. The only objects which need shadows rendered are grouped together very closely on the z axis, so all that extra distance the shadow settings are presumably allocating resources to cover is wasted.

I’m wondering if there’s any way to get the setup I want – an extremely low field of view camera, but with shadow distance set to a low value, or at least get shadows set up in some way that I’m not wasting resources trying to render shadows in the empty space between the camera’s position and the actual scene, which are very far apart.

Is the correct solution to scale all of my objects in the scene down, so the camera doesn’t have to be so far back? I’ve heard using extreme scales in unity can cause other problems in both physics and lighting.

I was hoping setting the near clipping plane of the camera to a high value near the far plane would affect the shadow distance (since shadows don’t need to be rendered for anything being clipped by the camera) but this doesn’t seem to be the case.

Thanks for reading, sorry for the noob question! (My first topic!)

@Alic , any luck with this? I was attempting to do something similar, and had the same issue.

Bumping this. I have an almost-isometric camera for which my FOV is very low. Is there a way to adjust the shadow settings to account for this without setting the shadow distance to an extremely high value?

Bump

Also interested in a solution for this, a project I’m working on recently made the switch from a reasonably distanced orthographic camera to a 10,000 unit+ distanced 1.0f FOV perspective camera and we are finding realtime shadow artifacts/skewing…
It’s been 6 years… maybe no solution is available for this approach after all?

I’m not really a visual guy, so my expertise is khm lacking on this area, but the SRPs are offering extensive tweaking on shadow distances. I doubt that the built-in would support this in any way. But again, I’m not sure in my answer, only offering a perspective, maybe the SRPs (either URP or HDRP) would solve this problem?

same problem here

I use 18 FOV for a single screen game and I’m finding performance is pretty bad and shadows are a big hit.

it seems clear this is not the way the shadows are intended to be used (all 3D games are fps or chase cam?) but I have no idea what the correct method would be here.

I wanted to decrease FOV in top down camera in our game, but we encountered the same problem with shadows.
My current version is URP 2020.3 and I can confirm, that setting camera near clipping plane to higher value affects shadow quality and solves the problem.

which problem does it solve? I changed mine from the default 8 to 100 and saw nothing tangible personally.

that said, the number of shadow casters went from 1800 to 2400, and the performance didnt really decrease either. so maybe shadows isn’t a huge problem even though it counts for a vast amount of my draw calls.

The problem: When FOV is set to lower value, to compensate closeness of render, the camera must be set to far away position and this reduces quality of shadows and forces to increase shadow distance.
The solution: Make near clipping plane closer to objects to not render empty space.

Example below has camera 100 units away and renderer has no cascades.

7058866--838291--clip_plane.png

Wild Theory

Maybe it worked in previous Unity versions, but because people have got last cascade set to very low quality in very far distance, they were able to see only the last one?

5 Likes

ah i see, so it kinda makes soft shadows…harder? for me that’s a problem i didn’t know i had, or have. but its a handy trick to know :slight_smile:

performance is consistent.