• Advertisement
Sign in to follow this  

alpha test with texture

This topic is 4879 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
Yes, see D3DRS_ALPHABLENDENABLE... See also

D3DRS_BLENDOP
D3DRS_SRCBLEND
D3DRS_DESTBLEND

and

D3DRS_ALPHATESTENABLE
D3DRS_ALPHAFUNC
D3DRS_ALPHAREF

and

SetTextureStageState(), and D3DTSS_ALPHAOP, D3DTSS_ALPHAARGn.

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