Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

[Unity pls add this] Added render queue to VFX Graph (Unity 2019.2+)

Discussion in 'Graphics Experimental Previews' started by Kamyker, Feb 2, 2020.

  1. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,092
    Dno why this isn't implemented, took only 3 lines to change/add, replace this file:
    https://gist.github.com/kamyker/d7efe8b9a1c93f65d2f0420cf201d73e

    I'm using Unity 2019.2, newest package supported there: 6.9.2-preview.

    Select output node in vfx graph and change Custom Render Queue in Properties panel. You have to use names like "Transparent+1" etc defined here: https://docs.unity3d.com/Manual/SL-SubShaderTags.html

    Disable "Autocompile" before typing your string otherwise it will recompile every letter.

    Drawbacks: bad performance?
     
    pahe likes this.
  2. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,092
    How is this still not in 8.2.0, it's only 3 lines of code.
     
    pahe likes this.
  3. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    343
    Hey, so what would your Custom Render Queue look like in the end? How's the performance drawback? Thanks for finding this. Can't believe it's not in the official release already.
     
  4. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,092
    Here's what Unity sets by default:
    Code (CSharp):
    1. public virtual string GetRenderQueueStr()
    2.         {
    3.             switch (owner.blendMode)
    4.             {
    5.                 case BlendMode.Additive:
    6.                 case BlendMode.Alpha:
    7.                 case BlendMode.AlphaPremultiplied:
    8.                     return "Transparent";
    9.                 case BlendMode.Opaque:
    10.                     if (owner.hasAlphaClipping)
    11.                         return "AlphaTest";
    12.                     else
    13.                         return "Geometry";
    14.                 default:
    15.                     throw new NotImplementedException("Unknown blend mode");
    16.             }
    17.         }
    Custom Render Queue will basically overwrite these settings.

    For ex "Transparent+1" is render queue 3001
     
  5. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    343
    Thank you. So this should fix my issue where different VFX graph effects are sorted by their bounding box only?
     
  6. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    544
    Bumb. @officials: that would be very nice if that could be supported in the next VFX graph version!
     
  7. SBliznitsov

    SBliznitsov

    Joined:
    Mar 13, 2019
    Posts:
    17
    Hi, Kamyker!
    I replaced the script but I have no parameter Custom Render Queue. How can i solve this problem?

    upload_2020-10-29_15-45-6.png
     
  8. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,092
    Hey, where/how did u change it? VFX package has to be embedded otherwise changes are overwritten.
     
  9. SBliznitsov

    SBliznitsov

    Joined:
    Mar 13, 2019
    Posts:
    17
    I just replaced the script with your version here: Library\PackageCache\com.unity.visualeffectgraph@8.2.0\Editor\Models\Contexts\Implementations

    upload_2020-10-29_20-44-25.png

    This should generally work for URP?
     
  10. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,092
    Nope, u have to move that folder to:
    ProjectName\Packages\com.unity.visualeffectgraph@8.2.0
    and edit Packages\package-lock.json
    Code (CSharp):
    1.     "com.unity.visualeffectgraph": {
    2.       "version": "file:com.unity.visualeffectgraph@8.2.0",
    3.       "depth": 0,
    4.       "source": "embedded",
    5.       "dependencies": {
    6.         "com.unity.shadergraph": "8.2.0"
    7.       }
    8.     },
     
    tsukka and pahe like this.
  11. SBliznitsov

    SBliznitsov

    Joined:
    Mar 13, 2019
    Posts:
    17
    Thanks for your help!
     
  12. skowroshima

    skowroshima

    Joined:
    Oct 14, 2018
    Posts:
    75
    This was really helpful Kamyker!

    But I totally agree, why is the ability to set the render queue not an option for without having locally hack the implementation? Is this something we will see in the not too distant future?
     
  13. skowroshima

    skowroshima

    Joined:
    Oct 14, 2018
    Posts:
    75
    FYI - This still works great with VFX Graph 10.3.

    It would be great if there was core support for setting the render queue for VFX graph, and we didn't have to hack it every upgrade.
     
    michalpiatek likes this.
  14. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    Not sure what your use case is, but you can set the material render queue for a VFX Graph through code without needing to modify the package, at least in HDRP. See this post for how. There's also some info about it from the VFX Graph dev in that thread.
     
  15. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    343
    I can confirm this worked for me. No need to mess with package-lock and move a folder (which source-control doesn't like). Just a simple script did it for me, I call it in my Start() function on the vfx graph and voilà.
     
    Korindian likes this.
  16. Red-Sprites

    Red-Sprites

    Joined:
    Jun 24, 2018
    Posts:
    8
    Is this still possible in 2022?