Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to create a drop shadow while keeping illumination from a directional light

Discussion in 'Universal Render Pipeline' started by Fressbrett, Nov 11, 2022.

  1. Fressbrett

    Fressbrett

    Joined:
    Apr 11, 2018
    Posts:
    92
    Hello,

    I have a scene that is lit from a 45 degree angle by a directional light (Light A).
    I also have a character that can jump quite high up.
    To improve depth perception for the player, I want to disable the shadow the character casts to other objects while introducing a new "drop shadow", that is directly underneath the character.

    I want to:
    • Keep my player illuminated by Light A
    • Don't have my character casts shadows on the environment from Light A
    • Have a Light B that doesn't illuminate the character, but lets the character - and only the character - cast shadows on the environment.
    As for now I wasn't even able to create two shadows to exist at once with two directional lights...

    I am using the URP and I am also fine with writing a custom render feature, but quite frankly I have no idea how to even begin here or what would be a good approach to this problem.

    Thanks for any Help!
    - Fressbrett
     
  2. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    761
    Hi, you can use Light Layer to control lights over objects.

    Light Layer allows lights to interact with specific objects.

    You can try changing Directional Light's Light Layer to something like layer 1.

    Set the environment & character (shadow only in mesh renderer) in the same Light Layer (layer1).

    Add the same character (not casting shadow) in another Light Layer (layer2), and illuminate it with "layer2" lights.

    Current URP (and HDRP) does not support 2 directional light shadows.

    For URP, you can use spot lights to approximate another (local) Directional Light.

    It would be better to use Box Shape Spot Lights if exists in future URP.

    Custom renderer features can give you better control if you do custom rendering order.

    But you cannot do it currently without modifying URP package, because most of the render target are marked as internal members. (like Shadow Map)
     
    Fressbrett likes this.