Search Unity

Question Shader Graph shaders and particle sorting fudge

Discussion in 'Shader Graph' started by Carl_Campbell, Sep 18, 2019.

  1. Carl_Campbell

    Carl_Campbell

    Joined:
    Apr 14, 2016
    Posts:
    8
    Hi there,

    I use a mix of standard particle shaders and custom graph shaders for my VFX and when I combine both types into a single particle system, I notice that I'm only able to fudge sort the custom shaders between themselves and the standard ones amongst themselves, but I can't ever get one group to draw over the other; the custom shader particles will always draw behind all the standard shader ones.

    Has anyone had the same problem and how did you solve it?
     
  2. LandonTownsend

    LandonTownsend

    Unity Technologies

    Joined:
    Aug 21, 2019
    Posts:
    35
    If you select the VFX graph in the inspector you should be able to change the Output Render Order from there:
    upload_2019-9-18_11-22-52.png
     
  3. Carl_Campbell

    Carl_Campbell

    Joined:
    Apr 14, 2016
    Posts:
    8
    Thanks for your response, but I'm not using the VFX Graph at all, just regular Particle Systems.
     
    richardkettlewell likes this.
  4. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Are the render queues the same on each material? (The standard particle shaders set it for you based on opaque/fade/transparent sort mode etc.) I would expect SG to offer some equivalent.
     
    Last edited: Jun 1, 2020
  5. Carl_Campbell

    Carl_Campbell

    Joined:
    Apr 14, 2016
    Posts:
    8
    It is possible to set render queue values for SG shaders, yes but I'm not sure about the values for standard shader. Fade doesn't seem to even be available on latest versions, only opaque and transparent.
     
  6. Carl_Campbell

    Carl_Campbell

    Joined:
    Apr 14, 2016
    Posts:
    8
    Now that you mention it, Graph shaders default to a value of '3000 Transparent' so I guess that's the same as a built-in shader set to Transparent, but this is where I have the problem.

    Could you please confirm if 3000 is what the default shaders are set to? Because as I mentioned, I seem to not be able to fudge paeticles between shader groups.
     
  7. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    3000 is indeed the default, but more importantly look at what is set on your materials. Materials can override the queue set by the shader, so make sure it’s showing either 3000 or “use shader” and your Shader Graphs are set to be Transparent.

    If that’s all true, then Unity’s built in draw call sorting may be overriding the fudge factor, as the sorting algorithm may try to keep the same shader together to improve rendering speed. Usually most of that gets disabled with transparent sorting though.
     
  8. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    How do we override render queue?
     
  9. Carl_Campbell

    Carl_Campbell

    Joined:
    Apr 14, 2016
    Posts:
    8
    At the bottom of a Material parameters.
     
  10. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    Sorry, could you include a screenshot?
    I can't find any render queue parameter
    What I can find is:
    1. I can change Sorting Priority to affect render queue, but can't be more than 100
    2. I can see Custom render queue in inspector in debug mode, but it got reset after modification
     

    Attached Files:

  11. ErdTod

    ErdTod

    Joined:
    Jan 7, 2018
    Posts:
    11
    Having same issue. Changing render queue doesn't help, and also isn't a very good solution, since particle material gets reused alot, and I'd like to sort it differently based on system needs. So I hope this gets somehow resolved on Unity side...
     
  12. Carl_Campbell

    Carl_Campbell

    Joined:
    Apr 14, 2016
    Posts:
    8
    What I've discovered since I posted originally is how to use Render Layer order. That works for me every time. You'll find the settings towards the end of the Render module in particle systems. Play with the Render Layer and Order in Layer values.
     
    ErdTod and richardkettlewell like this.