Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Shadows aren't working in URP

Discussion in 'Universal Render Pipeline' started by vkapoor, Sep 27, 2023.

  1. vkapoor

    vkapoor

    Joined:
    Jan 1, 2022
    Posts:
    23
    I am trying to get the ball cast a shadow on the ground in my game but it just doesn't work. I am using URP and Unity 2021.2.17f1 Here are my settings. What could be wrong?

    URP Settings Asset

    upload_2023-9-27_7-9-3.png


    Light

    upload_2023-9-27_7-18-12.png

    Floor

    upload_2023-9-27_7-19-35.png

    Ball

    upload_2023-9-27_7-20-0.png
     

    Attached Files:

  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,468
    The General Dicussion sub-forum is not a support forum. Please use the dedicated feature forums instead. I'll move your post for you.
     
  3. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,362
    1. Make sure the floor material has receiving shadows enabled (especially with custom materials). Also make sure you use urp lit or urp simple lit
    2. Make sure that's the only directional light
    3. Maybe increase the resolution and shadow draw distance?
    4. Make sure you use the right quality tier
     
    vkapoor likes this.
  4. fleity

    fleity

    Joined:
    Oct 13, 2015
    Posts:
    289
    max shadow distance 10 units seems dangerously low.
     
    vkapoor likes this.
  5. vkapoor

    vkapoor

    Joined:
    Jan 1, 2022
    Posts:
    23
    It was 50 and still not working. I reduced it to 10. Player height is like 1.7 m and the ball never goes more than 5 m from the court so I was thinking 10 would be sufficient. I will set it back to 50 in any case to take that out of the equation for why its not working.
     
  6. fleity

    fleity

    Joined:
    Oct 13, 2015
    Posts:
    289
    Maybe you can share a project / slimmed down version, just state of the scene without any scripts?
    That would make finding out whats wrong certainly easier. Apart from that the 4th point DevDunk mentioned often causes issues because suddenly a different quality level is selected than expected and then nothing works.
     
  7. vkapoor

    vkapoor

    Joined:
    Jan 1, 2022
    Posts:
    23
    Its a huge project since its a production VR game on Oculus but I will do the work to share it if needed. I found that floor materials didn't receive shadows checked. I have fixed that but it still doesn't work. I directional light seems to have no effect at all. If I turn it off there is no change in the lighting. So first step is to fix that somehow.
     
  8. vkapoor

    vkapoor

    Joined:
    Jan 1, 2022
    Posts:
    23
    Fixed #1 but still doesn't work. Directional light has no effect in the scene which is wierd. Quality tier is ultra and has the right URP asset selected.
     
  9. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    625
    I saw a warning message in the attached png file. Do you mean that there's no lighting in scene view?

    Maybe the lighting (light bulb icon) is disabled in scene view's toolbox.
     
  10. vkapoor

    vkapoor

    Joined:
    Jan 1, 2022
    Posts:
    23
    Thanks all. The issue was that there is a setting in the light for shadows. It was set to "No Shadows". I changed it to "Hard Shadows" and shadows started working. I haven't tried "Soft Shadows" assuming those take up more resources.
     
    DevDunk and wwWwwwW1 like this.