title: Direct3D: Output 4 color channels and a separate alpha?
body: <p>Something I'm wondering about, that's probably not possible unfortunately, but thought I'd ask - I'm setting up a deferred lighting shader that takes in 2 textures and outputs to 2 render targets. Their channels are:</p>
  
  <pre><code>Input Tex 1: Color Texture
    Channel 1: R
    Channel 2: G
    Channel 3: B
    Channel 4: A
  
  Input Tex 2: Normal + Specular Texture
    Channel 1: X
    Channel 2: Y
    Channel 3: Z
    Channel 4: Specular Amount
  
  
  Output Target 1: Color Target
    Channel 1: R
    Channel 2: G
    Channel 3: B
    Channel 4: A
  
  Output Target 2: Normal+Specular Target
    Channel 1: X
    Channel 2: Y
    Channel 3: Z
    Channel 4: Specular Amount
  </code></pre>
  
  <p>Pretty simple. Except - when outputting to the Normal+Specular target, I want to mask the pixels that are written using the Color texture's alpha channel to control the amount of blending. But - I'm outputting a vector4 as my second color from the shader, whose channels are all used up. </p>
  
  <p>So is there any way of having Direct3D use an alpha value temporarily as a blend parameter, use it to "mask" my 4 norm+spec channels, then discard it after use? Or to have render target 2 use render target 1's alpha as its blend parameter?</p>
  
  <p>I know I can represent a normal vector using only 2 components - e.g. store X &amp; Y then recalculate Z on the fly - but the process would be simpler &amp; probably perform better if I could get away with leaving them unchanged - so hoping to find a solution that way. </p>
  
  <p>Thanks!</p>