Compositing order weirdness

I have a blue sphere and read plane on the origin. Here are the shaders:

Shader "Custom/Sphere" {
	SubShader {
		Tags {Queue=Transparent}
		Color(0,0,0.5, 0.25)
		
		Pass {  }
	}
}

Shader "Custom/Plane" {
	SubShader {
		Blend one one
		ZWrite Off
		Tags {Queue=Overlay}
		Color(0.5,0,0, 0.25)
		
		Pass { }
	}
}

This is the output:

If that image doesn’t show, it is a picture of a blue hemisphere sitting on a red plane. the bottom half of the sphere can be made out through the plane. however, the top half is coming out at 0,0,127 – there is no red component. The plane is simply not contributing to these pixels. Why?

I’m setting the plane to render in the ’ overlay ’ queue, so therefore surely it should get rendered AFTER the sphere.

I’m turning off the Z buffer check, so it should definitely write the pixel. I’m also specifying additive blend mode. These upper half sphere pixels should be coming out 127,0,127. What’s going wrong?

That renders exactly as you should expect it to.

No, you’re not. You are getting confused about ZWrite and ZTest. It doesn’t matter what you use for ZWrite in the Overlay queue, because nothing else will need to test against the depth values.

Oh Hey there Jessy,

I’ve just been watching your excellent set of video tutorials! Thanks a ton for putting those out!

Yes! ‘ZTest Always’ sorts it out. Brilliant!