Search Unity

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

Cutout Shader in UGUI

Discussion in 'UGUI & TextMesh Pro' started by Tef, Mar 5, 2016.

  1. Tef

    Tef

    Joined:
    Apr 6, 2013
    Posts:
    18
    Hey folks,

    I have done a cutout shader, but with a soft edge to it. It's very simple (see attachment), but I have some issues with the canvas render mode: screen space - camera. If I set the screen space to overlay everything works fine and the cutout image is rendered on top of everything else, as seen in this image.


    But if I use camera space the cutout image is rendered behind everything else and not visible in the game. It turns out its rendered at the back, the sky box is even rendered on top of it.


    And if I remove the skybox from the camera you can see that it’s rendered all the way back.


    Maybe I’m missing something about the ordering, or what bucket the cutout shaders renders too. If you have any ideas on how to make this shader work in camera space, or why this is happening, please reply.

    Thank you!
     

    Attached Files:

    Last edited: Mar 5, 2016
  2. T-P

    T-P

    Joined:
    Oct 6, 2014
    Posts:
    1
    Hi Tef, try this: select the cutout material and on top of the inspector very near the locker, click on the little arrow and choose debug, where it says custom render queue type a higher number, for example 2. Hope this helps.
     
  3. Tef

    Tef

    Joined:
    Apr 6, 2013
    Posts:
    18
    The custom render queue was already at 2000, maybe thats default? I increased it to 3000 and it worked. But is that a proper fix or just for debugging?
     
  4. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,683
    Check out @NemoKrad s SoftAlphaMask shader in the UI Extensions project (link in sig). He had similar issues with different canvas modes
     
  5. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    You can also check out the asset's youtube clip off my asset page here.
     
  6. Tef

    Tef

    Joined:
    Apr 6, 2013
    Posts:
    18
    I don’t really see that this extension is relevant to this thread, just looks like you try to advertise.

    I have even bought your extension, and I wouldn’t say it's soft, as it doesn’t even produce a soft edge on the alpha mask.
     
  7. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    I came here as I was mentioned, the code in the UI Extensions in also in my package, I never asked anyone to buy my package. My solution is a soft alpha masking solution, if you are having issues with it, then contact me and we can get to the root of your problem.