Jump to content
  • Advertisement
Sign in to follow this  

Alpha blend problem

This topic is 5199 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 have a quad which needs returning based on the alpha in the diffuse and the color key black. I know how to do one or the other -- I have have the alpha come from the diffuse, thus per-vertex alpha. I also can load a texture with 0xFF000000 as the colorkey and have all black be transparent. I cannot figure out the states to combine the two. Is it not possible?

Share this post

Link to post
Share on other sites
You need to both enable alpha blending and alpha testing. Set your colorop to modulate and the colorargs to diffuse and texture. Same with alphaop.
Don't forget to set the alpharef value (8 is a good value) and the alpha compare func to greaterequal.

Set srcblend to SRCALPHA and destblend to INVSRCALPHA.

Share this post

Link to post
Share on other sites
Okay I attempted that just as you explained and i'm getting diffuse alpha but the black isn't not transparent.

Edit: Okay my fault, forgot to modulate the alpha values... Anyway, works fine now :) Thanks a ton.

//Set up the alpha and texture stage states
::Graphics()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
::Graphics()->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
::Graphics()->SetRenderState(D3DRS_ALPHAREF, 0x08);


//Set the alpha to come completely from the diffuse

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!