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

Error ShadowMap Sampling in Additional Lights - URP Unity 2021.1.2

Discussion in 'Shaders' started by ASSASS1NATE, Apr 11, 2021.

  1. ASSASS1NATE

    ASSASS1NATE

    Joined:
    Aug 19, 2020
    Posts:
    2
    Hello, I am using Unity 2021.1.2. I wrote a custom URP lit shader that is capable of shading multiple lights and casting shadows. It works fine just as my expectation when the point light mode is set to Baked.
    upload_2021-4-11_18-46-17.png

    However, when I am testing the new Realtime mode, the shading result became incorrect.
    upload_2021-4-11_18-47-32.png

    Is this a bug or an error in my code?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    No idea. Does it happen if you use the included Lit shader? And by "custom" Lit shader, do you mean a vertex fragment shader or a Shader Graph shader? And is there a reason why you're not using the one that comes with the URP as it can do all the things you listed already?
     
  3. ASSASS1NATE

    ASSASS1NATE

    Joined:
    Aug 19, 2020
    Posts:
    2
    The original Lit shader doesn't have the problem. The shader I wrote is a vertex fragment shader. Its point light shading works well in Bake mode, but not in the Realtime mode. I'm actually writing a Toon shader, so I can't use the URP Lit directly.