Search Unity

Question Add Sprite Mask to Light

Discussion in '2D' started by rowantichelaar, Jan 17, 2023.

  1. rowantichelaar

    rowantichelaar

    Joined:
    Jan 9, 2023
    Posts:
    1
    Hello,

    I was wondering if it is possible to use sprite masks to cover up lighting. Currently I am using a sprite mask attached a to a mesh that is created using ray-casts to create an FOV effect, but lighting is very important to the feel of my game. I was wondering if I could use that same sprite mask to render only certain parts of my light when they are in the mask.

    Thank you
     
  2. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    Hey @rowantichelaar, thanks for the question!

    So we recently implemented additional Sprite Mask support in 23.1. So Sprite Masks now works with:
    • Tilemap Renderer
    • Sprite Shape Renderer
    • Sprite Renderer (Improved support with)
      • 9-Sliced
      • Animated
    My understanding is that you hope to reuse the same Sprite Mask to mask out certain parts of your light. I'm not aware that's possible but I do know there's an alternative method, which is to use a Sprite Light. It has a Sprite field which allows you to specify a Sprite as a mask.

    Sprite Light.png

    This may be a silly answer altogether but hopefully this gives you a free bump while someone wiser comes along!