Sign in to follow this  
guyaton

alpha test with texture

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this