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

Resolved Transparency issue with Shadergraph

Discussion in 'Shader Graph' started by skoteskote, Apr 17, 2019.

  1. skoteskote

    skoteskote

    Joined:
    Feb 15, 2017
    Posts:
    85
    Hi, I just started trying out shadergraph, amazing tool really!

    I ran into an issue when using a transparent material, don't really know how to explain it - basically the material show all hidden faces of the same object? I did not have this issue with the same model and texture when using a standard shader with Cutout rendering mode. What am I missing?
     

    Attached Files:

    Sab_Rango likes this.
  2. skoteskote

    skoteskote

    Joined:
    Feb 15, 2017
    Posts:
    85
    Figured it out, I had set the PBR master's surface to Transparent, when all I needed to do was to add a slider to the AlphaClipProperty. Setting the PBR master's surface back to Opaque solved it.
     
    Sab_Rango likes this.
  3. Corvostudio

    Corvostudio

    Joined:
    Jul 19, 2015
    Posts:
    14
    Hello. doing like that we got a problem were we cannot fade the transparency but only make it total or none.
     
    deus0 likes this.
  4. LiliaUlibka

    LiliaUlibka

    Joined:
    May 29, 2020
    Posts:
    2
    Hi!I have exactly the same issues. I need semi-transparent material with a texture. When I switch PBR material to transparent it works really weirdly. Basically what should be underneath is shown on top. Anybody know how to solve this problem?
     
    deus0 likes this.
  5. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,108
    Transparent gives you possiblity to use real transpecy from 0 to 1, but it has render sorting problems, sometims it works and other time its pain. In some situations render queue in material can help, but basic problem is about soring and not writing to depth. Opaque with alpha cutoff (cliping) has no such problems, but allows only full opaque or full transparent pixels.
    I am not expert, but as I know there is no "good" solution to transparent materials.
     
  6. xjjon

    xjjon

    Joined:
    Apr 15, 2016
    Posts:
    591
    Is there a way to fix this?
    Have some similar issues - opaque can only be 0 or 1

    With transparent, the sorting has some problems

    upload_2020-11-24_12-39-36.png

    As you can see, it does not sort with tilemap or sprite floor properly, so it renders "over it" even when it should be below the ground.

    The left one using a 3d object produces the correct result.
     
  7. deus0

    deus0

    Joined:
    May 12, 2015
    Posts:
    256
    Anyone solve this? I guess a temp fix is just switching materials after i fade it in... might loook weird though from the angle that depth sorting fails..
     
    Last edited: Dec 19, 2020
  8. yungking

    yungking

    Joined:
    Jul 28, 2020
    Posts:
    4
    It's 2021 and I still don't know a great solution for ordering transparent materials!
     
  9. transporter_gate_studios

    transporter_gate_studios

    Joined:
    Oct 17, 2016
    Posts:
    219
    you have to turn zwrite on in the shader. then it will occlude faces within itself.
     
  10. yungking

    yungking

    Joined:
    Jul 28, 2020
    Posts:
    4
    Is this something I can turn on in the shader node? I can't seem to find anything, the only workaround I can find is to add a second material that's from the Un Lit Pipeline. But this isn't a solution for me, as my GameObjects "Dissolve" away I can't have a material underneath because the "Dissolving" effect wouldn't be transparent. Also removing the material before I "Dissolve" wouldn't work either because then the objects will not occlude properly... Really annoying issue since I have multiple GameObjects placed in worldspace against each other. How tf is anyone making Transparent shaders without this becoming a massive issue. Seems to be largely overlooked!

    What I would like to achieve:
    what i want.PNG

    What currently happens with Transparent PBR:
    what i got.PNG
     
  11. transporter_gate_studios

    transporter_gate_studios

    Joined:
    Oct 17, 2016
    Posts:
    219
  12. yungking

    yungking

    Joined:
    Jul 28, 2020
    Posts:
    4
    Maybe if you had time you could make a proper tutorial on this right quick. I followed your instructions but I'm missing something. When reimporting the new shader code to the URP Lit its just pink, with no option to edit the shader what did I miss?
     
  13. Xiaozo

    Xiaozo

    Joined:
    Jun 29, 2016
    Posts:
    2
    Was having this issue but read that in 2021.2 that they added some features to solve this. Upgraded then went into my shader graphs settings and switched "Depth Write" to "Force Enabled" and it fixed all my transparent texture issues. There are a bunch of other new settings as well, see attached image.
     

    Attached Files: