Looking for a workaround: How to render an ImageEffect after or before a certain RenderQueue

All render queues except the transparent one render material passes like so:

pass 1 of object 1
pass 1 of object 2
…
pass 2 of object 1
pass 2 of object 2
…

Here’s how the transparent render queue renders its material passes:

pass 1 of object 1
pass 2 of object 1
…
pass 1 of object 2
pass 2 of object 2
…

That makes depth mask passes useless for transparent materials, i.e. adding a pass like this:

Pass
{
    ZWrite On
    ColorMask 0
}

It’s the purpose of these depth mask passes to write all z values first. All additional passes using ZTest LEqual would only write transparent fragments once, so there wouldn’t be blending between multiple transparent fragments.

To circumvent this issue I made my transparent materials use the AlphaTest render queues instead. However, this has some implications:

  • sky boxes will be rendered after all AlphaTest materials, i.e. you can’t see the sky behind my transparent materials
  • ImageEffects with the attribute ImageEffectOpaque as in SSAO or GlobalFog will also be rendered after all AlphaTest materials, so you get ugly looking artifacts here, too

I already created a bug report for the order problem of the transparent render queue passes but I am not sure how Unity reacts (is this realy considered a bug or some weird decision by design?), so I would like to find ways to workaround this problems. I was able to create my own sky box and I am rendering it before the AlphaTest materials. However, I don’t know how to make the image effects render sooner.

So I guess that’s my main question: How can I make Image Effects render after or before a certain render queue? Or is there another way to accomplish something similar?

I second this question. Being able to run a CommandBuffer before or after any RenderQueue value would be priceless

[Edit] I’m trying to use SRP. Looks promissing but there different new problems, fortunately only a few that hopefully can be worked around. Trying SRP is only possible because there’s not much to migrate, otherwise this would not be an option