Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice

Poke hole in UI Image?

Discussion in 'Shaders' started by IAMBATMAN, Aug 19, 2017.

  1. IAMBATMAN

    IAMBATMAN

    Joined:
    Aug 14, 2015
    Posts:
    272
    I'm trying to poke holes and stuff through a UI image so the player can see the background. I thought I could do this with a mask, but it seems I need to reverse how masks work.

    My image is a scroll rect so the hole can move up and down, and the player should see the background through it.

    Any help? I tried a shader I found in some threads, but they weren't working in Unity 2017.

    Please guys this is for a jam, I don't have much time :O

    EDIT, how the background is an image too.
     
  2. brownboot67

    brownboot67

    Joined:
    Jan 5, 2013
    Posts:
    372
    In a shader... Multiply a black, programmatically drawn, circle onto your images alpha positioned in screen uv space. Pass the coords from a script.
     
  3. IAMBATMAN

    IAMBATMAN

    Joined:
    Aug 14, 2015
    Posts:
    272
    Thanks for your help, brownboot! The thing is I've 0 shader knowledge, though I'd love to learn, I'm a little tight on time. I'd really appreciate it so much if you could provide an example or something :p
     
  4. IAMBATMAN

    IAMBATMAN

    Joined:
    Aug 14, 2015
    Posts:
    272
    It seems I forgot to mention that it needs to be a certain sprite shape. Not just a circle (Like a tear or something). Please help? About < 5 days left.
     
  5. IAMBATMAN

    IAMBATMAN

    Joined:
    Aug 14, 2015
    Posts:
    272
    Pleeease help?
     
unityunity