Search Unity

Why is my alpha cutout not working in LWRP ?

Discussion in 'Shaders' started by Loquinette, Jun 11, 2018.

  1. Loquinette

    Loquinette

    Joined:
    Feb 13, 2014
    Posts:
    12
    Hi guys,

    I created a really simple shader in shader graph using the LWRP but it seems the alpha cutout isn't working.
    It works (with sorting issues) if I use a transparent surface, but I want the alpha to be cutout so I guess I have to keep the surface as Opaque right ?



    On the left you can see that the alpha isn't working and on the right, I plugged the alpha of the texture into the emission just to show that the texture has alpha.



    For info I'm using Unity 2018.1.0f2, I'm using Shader graph 1.1.9-preview and Lightweight Render 1.1.10-preview.

    Thanks and have a good day.
     
    OG_oliver likes this.
  2. deadlyshadoff

    deadlyshadoff

    Joined:
    Jan 23, 2016
    Posts:
    15
    Add a slider to AlphaClipTreshold to regulate cutout
     
    OG_oliver and noio like this.
  3. Loquinette

    Loquinette

    Joined:
    Feb 13, 2014
    Posts:
    12
    Oh thanks a lot !
    It seems weird that entering a fixed value isn't working but in a way that's good with a slider too :D
    Two things though is that I have two other problems now.

    One you already mentionned here : https://forum.unity.com/threads/shader-graph-cutout-shader-issue-with-shadow.535489/ with the shadows not taking into account the alpha.

    And the other one is that the shadows behind the transparency aren't rendered
     
  4. deadlyshadoff

    deadlyshadoff

    Joined:
    Jan 23, 2016
    Posts:
    15
  5. Object-Null

    Object-Null

    Joined:
    Feb 13, 2014
    Posts:
    70
    hello, any fix for this? i got the same problem with the alpha cutout
     
  6. Ehredt

    Ehredt

    Joined:
    Jun 20, 2018
    Posts:
    79
    Same here! It worked fine using the HDRP, but broken with the LWRP. Can confirm, using a slider for the AlphaClipThreshold fixed it, but the shadow alpha is still broken.

    I was also having that shadow alpha problem with the HDRP, but only some of the time and from certain angles. Pretty strange.
     
  7. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    Had the same issue in the LWRP with trying to get an Opaque object to properly dither. Adding the magical slider worked. Thanks for that - would have taken ages to figure this out...
     
  8. swanijam

    swanijam

    Joined:
    Nov 14, 2016
    Posts:
    23
    Any solution for the shadows? I still haven't found a feature that matches the old addshadow keyword. Seems pretty important to me. *shakes fist at unity logo*
     
  9. DavidSvrvive

    DavidSvrvive

    Joined:
    Jan 26, 2018
    Posts:
    1
    I had this working without the slider for the last two weeks (since I added alpha clip to the shader graph in the first place) but for some reason it has now stopped working, and the quick fix was to simply add a slider. I have not identified what has changed but will continue to investigate, so that we can maybe have a better solution than a slider.
     
    OG_oliver likes this.
  10. GiorgiLoria

    GiorgiLoria

    Joined:
    Sep 13, 2021
    Posts:
    1
    TGA file with alpha channel worked for me, PNG does not
     
  11. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    PNG files work fine. However some applications (*cough* photoshop *cough*) have abysmal PNG file handling and won't save the alpha if it's in a separate channel. Only if it's part of the layer transparency. It will also let you save PNG files with no alpha at all even if you do have layer transparency. I recommend everyone who is using Photoshop to download SuperPNG and use that instead as it has a lot more options for how it saves and loads PNG files.
    https://www.fnordware.com/superpng/

    TLDR: If you're having problems with PNG files and transparency, the issue isn't with Unity.

    That said, the specific problem being talked about in this thread was caused by two separate bugs with the URP & Shader Graph that have since been fixed.
     
    DEEnvironment likes this.