I imagine this is a problem that gets asked quite often, but reading up on it I can't seem to get a definitive answer on how to solve it.
I've got two HLSL shaders (I've simplified them in the example to just output a colour) that require RenderTargets. For example Blur shaders.
There are two balls spinning around a central point. As they spin, one passes between the other and the camera occluding the other ball and vice versa.
If I render them both to the same rendertarget (using the same technique) they obviously share a depth buffer, and the depth testing happens correctly.
However, when I need to use different techniques to render each ball seperately (one ball to one rendertarget and the other ball to a different) and then try to composite them depth testing fails and they are just rendered on top of each other.
Attach is the code I'm using. I've simplified it down a lot, but it indicates the problem I'm having.
How do I go about rendering two different objects, using two different techniques to two different rendertargets and then composite them?