Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Resolved Cutout Option in Master Nodes

Discussion in 'Shader Graph' started by Horus_Sungod42, Apr 9, 2019.

  1. Horus_Sungod42

    Horus_Sungod42

    Joined:
    Oct 30, 2014
    Posts:
    96
    This is more relevant for the LW render pipeline, but having a checkbox of some sort to turn the transparency mode to a old school cutout could be nice.

    Having a parameter in the master node with the "tolerance" for the cutout would be great too.

    Example Use:
    I'm checking to make a shader that would use a single channel for the texture (of graffitis and the like) and its transparency. Hence, currently with a progressive transparency, I can't put dark bits in the texture without those appearing more transparent. With a cutout with tolerance, I could have a texture with an "albedo" with light and dark areas, and cutting out only the very dark bits of the texture.

    Thank you

    (If there is a way to use cutout currently, excuse my oversight)
     
  2. alexandral_unity

    alexandral_unity

    Unity Technologies

    Joined:
    Jun 18, 2018
    Posts:
    162
    What you're looking for is, in Transparent mode, put your cutout map into the 'Alpha' channel on the master node, and your tolerance into the 'Alpha Threshold' channel. That should give you the results you're looking for.
     
  3. Kink3d

    Kink3d

    Unity Technologies

    Joined:
    Nov 16, 2015
    Posts:
    45
    Note that this also works while the Master Node is set to opaque. The difference being the usual between opaque/transparent:
    • Front-to-back vs back-to-front rendering
    • Depth write on/off
    • Etc
    The alpha clip functionality works the same in either case.
     
    foxnne likes this.
  4. Horus_Sungod42

    Horus_Sungod42

    Joined:
    Oct 30, 2014
    Posts:
    96
    Thank you for the answer, 2 issues:

    1. Isn't progressive transparency heavier than old school cutout? Like more overdraw? And non-cutout transparency is way more vulnerable to Z sorting issues, it seems. In a mobile game that might be non-trivial.

    2. The alpha clip threshold does not do the same thing as a legacy cutout threshold, even if they are similar, right?
    - The old threshold decides the color used as a limit, switching the transparency between 100% on and 100% off
    - The new if between progressive alpha where black is transparent and white is opaque (with everything in between is partially transparent). Increasing the clip threshold progressively pulls everything that isn't pure into into pure black.

    I did get the result with a remap between the texture and the alpha (to get everything except pure black to be opaque and pure black to be transparent 100%), but this is another operation that adds complexity (probably not by much, though).

    Did I get this right?
     
  5. Horus_Sungod42

    Horus_Sungod42

    Joined:
    Oct 30, 2014
    Posts:
    96
    Found the answer, writing it here if someone else searches for this:
    To have a cutout materials, the master node must still be set to Opaque, then have an input in its alpha (a texture, or whatever).

    Yes, the Opaque material with have cutout "transparency". Setting the master node to transparent will give progressive transparency.
     
    foxnne and ph_ like this.
  6. foxnne

    foxnne

    Joined:
    Apr 18, 2016
    Posts:
    59
    I'm attempting to do this, but I cant seem to get a cutout using the setting Opaque. I'm plugging in to Alpha, but the quad I'm rendering to fills when using opaque. Any advice?
     
  7. ph_

    ph_

    Joined:
    Sep 5, 2013
    Posts:
    226
    You're probably missing the AlphaClipThreshold.
    upload_2019-4-25_19-18-7.png

    In my version, this works, but if you don't put any value in the AlphaClipThreshold then it doesn't work (even if there is a default value of 0.5, it still doesn't work).
     
    foxnne likes this.
  8. foxnne

    foxnne

    Joined:
    Apr 18, 2016
    Posts:
    59
    Thank you so much! I was adjusting the value already attached as you said. Again, thanks!
     
    Horus_Sungod42 and ph_ like this.
unityunity