Search Unity

Can the default render queue positions (e.g. "Transparent") be changed?

Discussion in 'Editor & General Support' started by Zergling103, Dec 19, 2013.

  1. Zergling103


    Aug 16, 2011
    A couple observations:

    • When you set a shader's queue to "Transparent", its position in the queue becomes 3000. This is the default for all transparent materials.
    • The range of values considered to be inside the transparent queue is 3000-3999.

    What this basically means, is that you cannot have materials, marked as transparent, that render before all other transparent materials in the default position, 3000.
    In other words, if you mark your shader with Queue = "Transparent-1", it isn't actually transparent anymore - it's put into the alpha cutout queue.

    Why is this a problem?

    Image effects tagged with [ImageEffectOpaque] will render over top of all materials in queue positions less than 3000.

    In our exact case, we want clouds - a transparent shader - to be rendered before all other transparent materials. This requires putting it in queue 2999, since all other transparent shaders default to 3000 and higher.
    However, when you are above the clouds, you can see AmbientOcclusion from the ground underneath being rendered overtop of the clouds. Really the clouds should be drawn overtop of the ambient occlusion, as with any other transparent material.

    But... 2999 isn't in the transparent queue.
    But... putting it at 3000 or higher causes the clouds to be rendered overtop of other stuff.

    What I feel is the solution:

    The default queue position should always be halfway between the range allocated for that queue. So for example, the default transparent queue position should be 3500, so that there exist the same number of open queue slots both above and below.

    This is similar to what happens inside the Script Execution Order manager. The default is 0, but you can move a script into both positive AND negative numbers. That way you can instruct the script to execute BEFORE all other scripts or AFTER all other scripts.

    Is there a way to change the default position to 3500? If not, this should be changed at some point.