Search Unity

Transparency Sort Mode and Lightweight Render Pipeline

Discussion in '2D' started by Jack31081988, Mar 27, 2019.

  1. Jack31081988

    Jack31081988

    Joined:
    Oct 20, 2013
    Posts:
    2
    Hello,

    I have issues with the Lightweight Render Pipeline and the Isometric Tilemap

    I want my player to be rendered infront of the object, when behind the object, if want it to be rendered behind.

    You can do this with the Transparency Sort Mode, but it is disabled if I choose the Lightweight render pipeline. I need the LWRP for the sprite shader to be affected by light and the Fire which I created with the Shaker-Graph Tool

    Bildschirmfoto 2019-03-27 um 19.52.20.png

    is there a workaround for using the Transparency Sort Mode with the Lightweight render pipeline?

    Thank you!
     
  2. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    328
    The settings for Transparency Sort Mode do not show up with you have a Render Pipeline Asset set in Graphics Settings. As a workaround, if you are using Graphics Settings to handle the Transparency Sort Mode, you can set the Render Pipeline Asset to None, set the Transparency Sort Mode settings now that the option is there, and reset the Render Pipeline Asset. The Transparency Sort Mode settings will still be set even though the UI is gone.

    Otherwise, you could try something like this script:

    Code (CSharp):
    1.  
    2. #if UNITY_EDITOR
    3. using UnityEditor;
    4. #endif
    5.  
    6. using UnityEngine;
    7. using UnityEngine.Rendering;
    8.  
    9. #if UNITY_EDITOR
    10. [InitializeOnLoad]
    11. #endif
    12. class TransparencySortGraphicsHelper
    13. {
    14.     static TransparencySortGraphicsHelper()
    15.     {
    16.         OnLoad();
    17.     }
    18.  
    19.     [RuntimeInitializeOnLoadMethod]
    20.     static void OnLoad()
    21.     {
    22.         GraphicsSettings.transparencySortMode = TransparencySortMode.CustomAxis;
    23.         GraphicsSettings.transparencySortAxis = new Vector3(0.0f, 1.0f, 0.0f);
    24.     }
    25. }
    26.  
     
    MeOnX, Th0re and Jack31081988 like this.
  3. Th0re

    Th0re

    Joined:
    Sep 4, 2015
    Posts:
    32
    Thanks a lot!, ChuanXin.The method to empty the asset temporarily to see the setting does not work (in 2019.1.0f2), but the script does. For other total newbies, go to to Edit > Project Settings > Graphics > Scriptable Render Pipeline Settings and empty it to test out the values you need. Then set the asset again, and make a script in your assets, name it TransparencySortGraphicsHelper, and set the values you tested out before. The script doesn't need to be attached to anything.