Can you create a shader with multiple render queues?

Hi!

I have been trying to create a dissolve effect where I render a 3D model that disappears in a similar fashion to this effect on Xcom.


For this effect I need to render the Wall as a solid object that is affected by light and a “Ghost” transparent wall that is only rendered when the real wall has been clipped with a 3D noise. I think the best way to achieve this would be to have two Subshaders that render the gameobject in different queues, but is this even possible?
I have tried to use multiple Subshaders in one shader and only the first one is rendered.

This is what I want to do:

Shader "Custom/WallDissolve"
{
    Properties{ ... }

    Subshader { ... } //Renders in Transparent queue

    Subshader { ... } //Renders in Opaque queue

}

For now I have made it work using two different materials, but I want to know if it could be done in one shader (I am sure it is).

Nope.

There can only be one queue for the entire shader, and it more accurately works as a hint for the material rather than something in the shader, the first queue seen in the shader is the one the material uses to draw all its passes, it there isn’t an explicit queue set on the material overriding the shader. I agree it’d be useful to be able to assign different queues to each pass though. It’s something I’ve wanted to have multiple times.

2 Likes