Search Unity

LWRP shadows from sprites

Discussion in 'Shaders' started by LTurek, May 12, 2019.

  1. LTurek

    LTurek

    Joined:
    Feb 21, 2016
    Posts:
    4
    Hi!
    could anyone point me in the right direction?
    I am trying to have shadows on a 2d sprite using lwrp.

    what i found so far:
    i can enable receive shadows and cast shadows in debug mode properties of the sprite renderer
    i have enabled cast shadows on the pipeline asset

    do i have to write a custom shader?
    or use shader graph

    UPDATE
    got it working with a new material asset using lwrp/Lit Surface type opaque and the mentioned debug flags set.

    now i have the problem that it doesnt work at runtime. setting the renderers material in the inspector or via code makes an invisible sprite.
    the inspector for the edit mode (working) sprite and the runtime created sprite is identical.
    weird thing is when i click the Flip bool X i get a black sprite with a shadow.
    (when i click flip x on the edit mode created sprite it gets invisible..)

    UPDATE
    OK thats almost funny the black sprite was an absolute shadow =D
    changing angle did it
     
    Last edited: May 14, 2019