   Unusual pixel operation
  Hey guys.At some intermediate stage of my rendering pipeline I have a renderTarget.  I wish to perform the following operation on a per pixel basis:If any of the r,g,b values are non-zero, set alpha of that pixel to be 1I presume I'll need to write a shader for this, just wondering if anyone had any other suggestions.Thanks,Ian   
  Yeah the HLSL code for that would be pretty simple, something like:float4 data = tex2d( ... );  data.a = (float)any(data.rgb);  //^^equivalent C++: data.a = (float)(data.r != 0 || data.g != 0 || data.b != 0);//or  float threshold = 1.0f/256.0f;  data.a = step(threshold, dot(data.rgb,float3(1,1,1)));  //^^equivalent C++: data.a = (data.r+data.g+data.b >= threshold)?1:0;return texel;The only thing to watch out for is that you can't use the same render-target as both input and output -- you'll have to render your initial data to target-A,and then when performing this operation you'll write the results to target-B (using target-A as an input texture).   