Jump to content
  • Advertisement
Sign in to follow this  
david_watt78

directx 11 alpha blending

This topic is 3339 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am having trouble with alpha blending on directx11. I am running vista with a dx10 card so I am using feature level 10. I have set srccolor and destcolor correctly and that seems to work fine but the alpha settings seems to do nothing at all. The basic issue is that zero alpha is still slightly opaque and it should be completely transparent. Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
I am using the effect framework like so


BlendState EnableBlend
{
BlendEnable[0] = TRUE;
SrcBlend[0] = 3;
DestBlend[0] = 9;
BlendOp[0] = 1;
SrcBlendAlpha[0] = 5;
DestBlendAlpha[0] = 6;
BlendOpAlpha[0] = 1;
};

technique11 GUI
{
pass Render
{
SetVertexShader( CompileShader( vs_4_0, VS() ) );
SetGeometryShader( NULL );
SetPixelShader( CompileShader( ps_4_0, PS() ) );

SetRasterizerState(DisableCulling);
SetDepthStencilState(DepthEnabling, 0);
SetBlendState(EnableBlend, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF);
}
}

Share this post


Link to post
Share on other sites
That's color blending, and probably not what you want.
See http://msdn.microsoft.com/en-us/library/ee415357(VS.85).aspx and scroll down to the table of default values. You should be able to use the default values for everything but SrcBlend and DestBlend, which should probably be SRC_ALPHA and INV_SRC_ALPHA, if you want to blend depending on the alpha.

I apologize if I have misunderstood. If so, try explaining what kind of blending you want to achieve, and perhaps I or someone else can help better. =)

Share this post


Link to post
Share on other sites
ok i want alpha blending maybe I am confused I thought the srcblend & destblend where how to handle the RGB colors and srcblendAlpha and destblendalpha specified what to do with alpha.

Share this post


Link to post
Share on other sites
It does, but do you really want to blend the alpha?
Usually you want to use the alpha to blend the color. The alpha-blend modes in the structure are used to pre-blend the alpha before multiplying the color with it. By specifying SRC_COLOR for blend, you basically multiply the RGB values by themselves, and then add the result to the RGB values at the destination multiplied by themselves by DEST_COLOR, and you don't use the alpha for the color-blending.
When specifying SRC_ALPHA for source color blend, you mean that the source RGB will be blended with the source alpha.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!