Search Unity

Question Transparency sorting issues

Discussion in 'Universal Render Pipeline' started by RoughSpaghetti3211, Jul 10, 2021.

  1. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,709
    Is there any way to improve the transparency ordering? Is this a bug or limitation, I don't remember having this many issues on build-in renderer. This simple example is a transparent material with alpha set to 1, the yellow/orange bars are in a line but it is drawing all over the place from the game view. Im using a simple unlit shadergraph shader with a world space gradient.

    game view

    top view
     
  2. moatdd

    moatdd

    Joined:
    Jan 13, 2013
    Posts:
    178
    Could you post a screenshot of your pipeline for these transparents? Lightshot is pretty good for this sort of thing.

    Don't forget to expand the render features.

    It might be that you have to adjust the ZTest
     
  3. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,709
    Here is what im using, it from the example scene
    upload_2021-7-10_21-8-47.png ]

    upload_2021-7-10_21-10-19.png
     
  4. moatdd

    moatdd

    Joined:
    Jan 13, 2013
    Posts:
    178
    Ok, so the problem is the thing doesn't know what's in front of what. When working with opaque objects, they contribute to a depth buffer and are able to sort based on that. Transparent objects don't have that luxury

    Transparent objects may sort based on distance, but I wonder if those pieces are all one mesh, or separate gameobjects, or particle instances. I gotta know more about how those objects are being created.

    Might wanna step through the frame debugger, too.
     
  5. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,709
    So it a very simple scene, all separate instanced cubes scaled in y. Frame debugger on where the cubes are rendered show LessEqual for Ztest. Im not really a shader/render guy so debugging this will be a learning experience.

    upload_2021-7-11_20-56-30.png
     
  6. moatdd

    moatdd

    Joined:
    Jan 13, 2013
    Posts:
    178
    Uh ohhhhh I am seeing DOTS stuff. I will say right now that I am out of my depth with DOTS and how it interacts with rendering. I won't even begin to know how to fix this.
     
  7. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,709
    haha ok, I will try the dots graphic, appreciate you looking at this for me.
     
  8. petersvp

    petersvp

    Joined:
    Dec 20, 2013
    Posts:
    63
    The Sorting Group have undocumented "feature" - it does in fact control the render order of normal GameObjects with MeshRenderer
     
  9. fleity

    fleity

    Joined:
    Oct 13, 2015
    Posts:
    345
    I know the struggle of this case very well. Isometric transparent sorting is the bane of my existance.
    Some maybe helpful information:
    MeshRenderers are always sorted by their bounding box centerpoint.
    You can try to set a custom transparent sorting axis https://docs.unity3d.com/ScriptReference/TransparencySortMode.html

    Sorting groups certainly should work, as long as you can reasonable calculate your sorting indices and they don't need to update all the time.

    I only used DOTS once and it has been years ago, I always hoped that there are some new options to handle these kind of scenarios (and in general per object rendering properties ^^)