Make shadows fade in distance


I would like to do make the shadows fade away the distances like a mist, the reason for this is to avoid the straight clipping from shadows. I’m able to achieve this effect by combining two materials, one with the receive shadows on and the other one off. After that I’m using camera depth to combine them.

I wonder if there’s a way to do this with only the lamp? Using this method I’ve had to do this with every single material which is very inefficient. Besides that it has to calculate two materials that’s almost identical which I assume decrease the performance.

By the way, here’s the setup:
ShadowFade.blend (552 KB)

I think if you use a spotlight for shadows you can use the blend and cone values to get fall off further away from the center.

That is true, but it doesn’t work for my purpose. Right now I have the sunlight vertex-parented to the same object that I has the camera parented to. This means that the lamp follows the player everywhere.

If you take a look at the Blend-file and fly in viewport (Shift+F) and fly further away you’ll see the effect I’m looking for. It’s mainly for optimizing and make the game more smooth.

(Thought a spotlight would work pretty good if the shadow came from the top.)

I only have one answer, ANGLEBASED TEXTURES. :spin:

Or animate The lamp.

älskar dig

I just had to point out @AllieKmedia those are two answers:D