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
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

HDRP lit sprite shader not rendering non-directional lights

Discussion in 'Graphics Experimental Previews' started by Dasky14, Jul 1, 2019.

  1. Dasky14

    Dasky14

    Joined:
    Jun 13, 2013
    Posts:
    5
    This project has HDRP, and I've put a lit sprite shader on my sprite renderers that also cast shadows.
    The issue is that for some reason, the game view does not render any of my non-directional lights, but the scene view does.





    Here is the shader graph:



    Unity Version: 2019.1.6f1

    HDRP version: 5.16.1 preview (also tried 5.7.1, no luck)

    I'm not sure whether this is a Unity/HDRP bug, or whether it's an issue with shader graph, but I am at a complete loss here and do not know what to do about it.
     
    d1favero likes this.
  2. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    703
    I tried to reproduce the issue but I couldn't.
    Note that I tried to use sprite renderers, but even if they do display, they don't project shadows. I had to use quads, do you confirm that you're also using quads in your scene ?
    Secondly, I suspect from the screenshot that your game camera is in orthographic mode, does it also occurs when you set it to perspective ?

    Anyway, if you can share the scene to reproduce and identify the issue, this could help, thanks !
     
  3. Dasky14

    Dasky14

    Joined:
    Jun 13, 2013
    Posts:
    5
    If you open the debug inspector, you can turn on shadows for sprite renderers. I am using sprite renderers in those images. But even if it worked on quads, it'd be an issue because it also doesn't show on the horizontal 2D tilemap that's used for the floor.

    Changing the camera (which is controlled by Cinemachine) to perspective instead of orthographic renders the lighting correctly, but that's also not very useful for my scenario. But hopefully that helps?

    I'm not entirely sure how to share a scene here. Just the scene file, and not the rest of the project? I can't really share the project since it's not mine, I'm simply working on it.
     
  4. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    703
    I did a similar setup, assigned the sprite material to the characters and the tilemap, and I ended up with this :
    upload_2019-7-2_10-23-30.png

    So I don't really know why it doesn't work for you.

    You can maybe use the "assets/export package" function to export only the scene and it's dependencies ? If you're concerned about confidentiality, you can send it via PM.
     
  5. Dasky14

    Dasky14

    Joined:
    Jun 13, 2013
    Posts:
    5
    I noticed that massively increasing the range of the light suddenly makes the point light pop into existence in game view. I noticed this while making a test scene export for you.
    I will PM you the export.
     
  6. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    703
    I tested what you said (increasing the light range) and indeed, it made the light instantly appear/disappear.
    Hopefully, this works as a workaround for you for the moment, but this behavior suggest that there is some issues when calculating the light range when doing the cluster rendering (as it only affects transparent objects).
    I'm building a smaller repro project for the devs.

    Thanks for reporting !
     
    hippocoder likes this.
  7. Justin_Wingfall

    Justin_Wingfall

    Joined:
    May 15, 2014
    Posts:
    125
    is this the on way to light a sprite in hdrp? I used sprite/diffuse to light sprite in standard, but it's pink in hdrp? could someone upload shader that lights sprites in hdrp? thanks.
     
  8. EJSainz

    EJSainz

    Joined:
    Mar 24, 2015
    Posts:
    30
    I just took the steps above and had the SpriteLit material ready. Give it a try.
    1) Create the shader in shadergraph
    2) (Important!) In debug mode, set the SpriteRenderer to cast shadows