Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

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

Discussion in '2D Experimental Preview' started by undecyce, Apr 22, 2020.

  1. undecyce

    undecyce

    Joined:
    Oct 17, 2019
    Posts:
    8
    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!
     
    tonytopper likes this.
  2. tonytopper

    tonytopper

    Joined:
    Jun 25, 2018
    Posts:
    226
    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.
     
  3. Devilbro

    Devilbro

    Joined:
    Feb 28, 2020
    Posts:
    2
    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
     
    NotaNaN and tonytopper like this.
  4. tonytopper

    tonytopper

    Joined:
    Jun 25, 2018
    Posts:
    226
    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
     
    NotaNaN likes this.