2D Shadows--Is it possible to custom a shadow caster's shadow casting length?

Hi everyone,

Recently, I’m working on my top-down game using URP’s 2D lighting features. Everything works well so far, except for a small problem.
In order to make a day/night effect, I’m using a really large point light to simulate daylight. it covers everything in the scene, and what I am thinking is to use shadow casters to simply cast shadows with right direction, which depend on the center of the “sunlight”.
As the title says, the problem is every shadow just extends to the end of the extremely large point light. This is certainly not the effect I was looking for.

So here is the question:Is it possible to custom a shadow caster’s shadow casting length? Or is there any better way to achieve the top-down sunlight effect in URP?

Thanks a lot!

1 Like

I’d like to have a solution to this problem as well.

The only avenue I can think to pursue right now is to overlay some sort of 3D mesh that has a height to it and also traces the shape and then use a standard 3D light. But that might have other unknown drawbacks or issues.

you can check out the urp codes, and find the _ShadowRadius parameter which current decided by lights’ bounding sphere. I’m trying to add some data into the shadow mesh and change this value in “Hidden/ShadowGroup2D”, this should work

2 Likes

I am interested to see how this works out for you. I really need this feature myself, but I still have so much other stuff to do on my project I can afford to continue to wait.

There are so items on the Unity roadmap that may work for me: https://unity.com/roadmap/unity-platform/rendering-visual-effects

1 Like