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 Light 2D volumetric light bleeds through sprites in front

Discussion in 'General Graphics' started by Gibbonfiend, Oct 27, 2022.

  1. Gibbonfiend

    Gibbonfiend

    Joined:
    Jul 23, 2015
    Posts:
    7
    I'm using the 2D renderer to create a deck and I want the bars on the sides to have volumetric light. However, when the cards are spread such that they are overlapping, the volumetric light from the cards below bleeds through. I expected the light to be blocked. See image - I've made it green so the effect is obvious (I've only added light to the right side of the cards so far before I found this problem).
    Volumetric light.png

    Volumetric light 2.png

    I tried adding a Shadow Caster 2D component, but this doesn't work unless I switch "Self shadows" on, in which case the lights on the card itself don't work either! The only other thing I can think of is making each card its own sorting layer, but that doesn't seem right, especially as I could have anywhere between 1 and 20 cards in the hand.

    Any tips very welcome.
     

    Attached Files:

  2. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,503
    2D lights aren't good for this situation. You might instead want to use post-processing and emission if you want something glowy like that.