I need to write to two render targets: one for colour and another for depth+normal (for post-processing). I have a problem, though. Both targets seem to be getting the value output by COLOR0, while the second should logically be getting the value from COLOR1. What did I do wrong?
RT Initialization:
renderTarget = new RenderTarget2D(device, gameResolution.Width, gameResolution.Height, false, graphics.PreferredBackBufferFormat, DepthFormat.Depth24);
extraTarget = new RenderTarget2D(device, gameResolution.Width, gameResolution.Height, false, SurfaceFormat.Color, DepthFormat.None);
Using RTs:
Device.SetRenderTargets(new RenderTargetBinding(renderTarget), new RenderTargetBinding(extraTarget));
Relevant HLSL:
struct Pixel
{
float4 Color : COLOR0;
float4 Extra : COLOR1;
};
Pixel PS(Middle input)
{
Pixel output;
// perform other shader code
output.Color = float4(totalDiffuse * matDiffuseColor * color.rgb + totalSpecular * matSpecularColor, color.a);
output.Extra = float4(input.Position.z / input.Position.w, clippedNormal);
return output;
}