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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Help vegetation transparency

Discussion in 'General Graphics' started by canaljuegos32, Jan 30, 2022.

  1. canaljuegos32

    canaljuegos32

    Joined:
    Jun 29, 2015
    Posts:
    63
    I have this problem as you can see in the pic central leaf must be in top of all but is behind the branches and other leaf. Some leafs are ok, some dont. This problem happen also in unity boat attack demo. Im using URP lit transparent, If i put opaque all is fixed, but plants dont look that good. Since in not a programer i ask for a fix :) I did the shader in shader graph.
     

    Attached Files:

    • mess.png
      mess.png
      File size:
      879.6 KB
      Views:
      330
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,248
    Fast and efficient sorting of arbitrary transparent surfaces is an unsolved problem for real time rendering. What you're seeing is unfortunately as good as it gets for sorting of a single model with the URP. You have to choose between transparency w/ incorrect sorting, opaque w/ correct sorting, or break up the model into multiple game objects that Unity will attempt to sort individually, though this is still no guarantee they'll sort properly.

    There are a handful of other mitigation techniques, almost all of which URP & Shader Graph make difficult / impossible to implement.

    One of the more basic options would be to render the object twice using separate opaque and transparent materials. Not using Shader Graph this could be implemented in a single shader two two passes, but Shader Graph does not allow for the creation of multi-pass materials or enough control of render state per-pass to make this possible. So it'd have to be done with two separate shaders & materials. And note this only ensures the areas that are fully opaque sort correctly, the transparent parts will still sort incorrectly. Again, there is no 100% solution to that problem that can be used with the URP.
     
  3. mabulous

    mabulous

    Joined:
    Jan 4, 2013
    Posts:
    198
  4. canaljuegos32

    canaljuegos32

    Joined:
    Jun 29, 2015
    Posts:
    63
    looks like all is fixed in 2021 and the updated URP