Hi all,
I recently had some problem with the Unity particle emitter.
Indeed, I wanted to display some particle in front of a cube. This cube have a transparent/diffuse material.
The problem was that when you look to the particle it seems that they are behind the cube while in fact they were in front of…
A picture is worth a thousands words :
You can see on the scene that particle are in top of my cube, but the zbuffer decided to put it behind the cube…
I search how to fix that, and I finally found a great solution.
I needed to change the shader of the green cube, in order to indicate to the z buffer that it will be calculater after particles emitter (or before, if the latest object calculated is the nearest…).
The shader came from the “transparent/diffuse” Unity shader:
Shader "Transparent/DiffuseZ" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
SubShader {
Tags {"Queue"="Transparent-1" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 200
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Transparent/VertexLit"
}
I changed this line:
Tags {"Queue"="Transparent"
to
Tags {"Queue"="Transparent-1"
I hope this will help someone who has the same problem…
Enjoy 
This issue has nothing to do with the Z buffer, as transparent shaders usually (and in this case) do not write depth. Instead, they are sorted back-to-front and rendered in that order.
The problem you are seeing occurs when the sorting, which is done by each object’s origin’s distance from the camera, does not reflect the geometry of the objects involved. In your second screen shot, you can see that the centre of the cube is closer to the camera than the centre of the particle system, which results in the cube being drawn second, or closer.
However, the solution you’ve used is appropriate in this situation: when you know the geometric order of two transparent objects will not always match their sorted order, then you should force the draw order by putting the objects in separate render queues. Note that in addition to modifying this value in the shader, you can change it per-material by using a script to modify Material.renderQueue.
Thanks for answering Daniel Brauer 
If I’m right, with my solution the particles emitter will be always in front of the cube, even if in reality they are behind…
That’s not a problem for my project actually, but it could be in the future…
Your solution is so great ! By this way it’s possible to change dynamically the material zbuffer order.
Rewriting Shaders wasn’t a smart solution, yours is far better.
Thank you so much 
Glad to hear it works in your situation. Unfortunately, sorting transparent objects is difficult in the general case, so the number and complexity of tricks you have to use varies from case to case.