Search Unity

URP Lit Shader transparency issue

Discussion in 'Universal Render Pipeline' started by Lazy_Evaluation, Mar 29, 2021.

  1. Lazy_Evaluation

    Lazy_Evaluation

    Joined:
    Nov 16, 2019
    Posts:
    9
    Hello! I'm trying to turn an object semi transparent with URP shaders. I spent the past day looking for a solution and I found hundreds of people with my problem but none of those solutions worked for me :-(
    I've got a tree with URP/Lit shader. I need to turn it semi-transparent. The alpha value in the color setting doesn't work if the surface is opaque, but if I set the surface to transparent transparency works but I get two drawbacks:
    1) The shadows cease to exist, even with "Shadows ON" on the mesh rendered
    2) The objects are rendered in the wrong order (this is the worst and seemingly common problem!)

    Opaque:

    Transparent:


    As you can see the leaves are behind the tree's trunk, and the leaves are rendered in the wrong order. I found a workaround for the shadows: I followed a tutorial online and created my Lit shader graph, added the texture, and set the shader to transparent, and shadows works fine with my fresh lit shader. I can also set transparency there. But the objects gets still rendered in the different order! I also tried to set the priority to high (value "50" in the urp Lit shader, value 5000 in my shader), but nothing changed...
    What can I do? I'm currently using URP 10.3.2, and Unity 2020.3.0f1.
     

    Attached Files:

    Last edited: Mar 29, 2021
  2. bluebrain

    bluebrain

    Joined:
    Jun 18, 2014
    Posts:
    29
    Any solution? I'm struggling with this issue as well.
     
  3. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,386
    Technically it's not possible and it is not used in any game or engines
    I think all leave shaders are opaque with alpha cutout effect
    Fade mode(transparent in URP) is not suitable for leave shaders. It's for particle effects
    Untitled.jpg
     
  4. bluebrain

    bluebrain

    Joined:
    Jun 18, 2014
    Posts:
    29
    OP, I figured out the solution. The objects with transparency (leaves) must be a different object and material than the opaque object (trunk).
     
  5. OmarVector

    OmarVector

    Joined:
    Apr 18, 2018
    Posts:
    60
    Actually this not a fix to the problem, its just a fix to your model, and the problem still exist

    I do not get it, why Unity havent fixed this issue so far, when there is a model that consist of different objects combined, when apply a transparence map, it start act like a flipped normal model and render what is behind, like not Z test
     
unityunity