I am having a really hard time finding any useful information on this subject, as my main source book is quite wanting. MSDN isn't very helpful in describing how to implement this.
What I want to do is for each sprite texture (all of my graphics are 2D), any pixels that I want to make transparent are solid black, i.e. R=0, G=0, B=0. I am using the color format DXGI_R8G8B8A8_UNORM. Is there some way I can set up the application to look for that specific pixel color and set its transparency level? I have experiemnted with the flags in the D3D10_BLEND_DESC structure but I cannot seem to make anything work.
I did it the way Wendy Jones does it in Beginning DirectX 10 Game Programming, but the book is VERY lacking in detailed explanation on how it works. It just specifies some defaults; the source code example does little to clear things up.Code:D3D10_BLEND_DESC BlendState; ZeroMemory(&BlendState,sizeof(D3D10_BLEND_DESC)); BlendState.AlphaToCoverageEnable=false; BlendState.BlendEnable=true; BlendState.SrcBlend=D3D10_BLEND_SRC_ALPHA; BlendState.DestBlend=D3D10_BLEND_INV_SRC_ALPHA; BlendState.BlendOp=D3D10_BLEND_OP_ADD; BlendState.SrcBlendAlpha=D3D10_BLEND_ZERO; BlendState.DestBlendAlpha=D3D10_BLEND_ZERO; BlendState.BlendOpAlpha=D3D10_BLEND_OP_ADD; BlendState.RenderTargetWriteMask=D3D10_COLOR_WRITE_ENABLE_ALL;