I have a small shader that does the following things:
(First cgprogram block)
- Copy the current mesh and scales it along the normals
- Assign a color to the inflated mesh
- Draw the inflated mesh
(Second cgprogram block)
- Assign a color to the original mesh
- Draw the original mesh
In-game you can only see the inflated mesh because the smaller one gets inglobated.
Is there a way to re-order the rendering order, by drawing first the inflated mesh and then the original mesh, resulting in a sort of outline effect?
What I tried
Setting Cull Front on the inflated mesh and Cull Back on the original mesh
I copied this approach from an outline shader. Unfortunately it leads to other problems such as bad intersecting between inflated mesh in-game.
Changing the Queue in the shader between the two CGPROGRAM blocks
I set the first CGPROGRAM block on
"Queue" = "Geometry-10"and the second on
"Queue" = "Geometry+0"but.. no effect.
Is there a way to obtain the desired effect? Thanks in advance.
Here are some images to make the question a bit clearer:
Current wireframe situation
Original mesh inside, inflated mesh outside
Current shaded situation
Inflated mesh set on Cull Front
This is the aforementioned problems between intersecting meshes. The inflated meshes have z-fighting going on.