Sign in to follow this  
alundgren

Partially Transparent Textures - Wire Fence

Recommended Posts

alundgren    115
Hi all, I've been researching this for a while and I'm not entirely certain how to do this, I'm sure someone could tell me immediately what the main options are. I can research them on my own from there. I'm looking for how to render textures that have partial transparency, not alpha blending, but parts are totally transparent. Something like a wire fence - I want to just have a square surface and have the texture accomplish the appreance of the wire hatch. In other drawing APIs I've used there is a Mask you apply and everything with the designated masking color is drawn(or not drawn). Is there something similar in D3D9? Thanks -Drew

Share this post


Link to post
Share on other sites
darookie    1441
You can use alpha-masking for that. Create your texture with an alpha-channel (i.e. use DXT1 with 1-bit alpha) and set the D3DRS_ALPHATESTENABLE state to TRUE. You can use D3DRS_ALPHAREF to select an alpha value threshold for the pixels and set D3DRS_ALPHAFUNC to D3DCMP_GREATEREQUAL to discard all pixels that have an alpha value of less than the chosen threshold. Pixels that don't pass the alpha test are simply not rendered, which should give you the desired effect.

HTH,
Pat

Share this post


Link to post
Share on other sites
legalize    116
Quote:
Original post by alundgren
In other drawing APIs I've used there is a Mask you apply and everything with the designated masking color is drawn(or not drawn). Is there something similar in D3D9?


In addition to what's already been mentioned, the feature you're describing above is called "color keying" and Direct3D doesn't have it.

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