Jump to content
  • Advertisement
Sign in to follow this  
guyaton

alpha test with texture

This topic is 4994 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 texture (.png) that has alpha components. when rendering using x, y, z, rhw, as the vertices (a box), how to i make the pipeline not render the alpha bits of the texture? thanks!

Share this post


Link to post
Share on other sites
Advertisement
you mean *enable* alpha blending.

You can enable alpha blending be using render states. See the IDirect3DDevice9::SetRenderState function and the D3DRS_ALPGABLENDENABLE render state

Share this post


Link to post
Share on other sites
If you want all alpha values less than 100% to be discarded, you can use alpha testing which is much faster than blending and disable alpha blending.

SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_EQUAL);
SetRenderState(D3DRS_ALPHAREF, 100);
SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);

This ignores alpha values not equal to 100.

Chris

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!