Question

My problem is:

i can't draw an Alpha Blend object into render target with it's blend rightly,

i have a few experience on dx9 but not in dx11 so don't know what i miss in dx11.

please follow images...

Any flag must be set in dx 11 when create render target ? or add any code for blend or.. i don't know what i miss.

thanks.

Was it helpful?

Solution

Check out ID3D11Device::CreateBlendState. For standard alpha blending with preserved alpha, use the following parameters:

AlphaToCoverageEnable = FALSE;
IndependentBlendEnable = FALSE;
BlendEnable[0] = TRUE;
SrcBlend[0] = D3D11_BLEND_SRC_ALPHA;
DestBlend[0] = D3D11_BLEND_INV_SRC_ALPHA;
BlendOp[0] = D3D11_BLEND_OP_ADD;
SrcBlendAlpha[0] = D3D11_BLEND_ONE;
DestBlendAlpha[0] = D3D11_BLEND_INV_SRC_ALPHA;
BlendOpAlpha[0] = D3D11_BLEND_OP_ADD;
RenderTargetWriteMask[0] = D3D11_COLOR_WRITE_ENABLE_ALL;

And don't forget to call ID3D11DeviceContext::OMSetBlendState.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top