Sign in to follow this  
Juliean

[DX9] Transparent pixels: no z-value

Recommended Posts

Hi,

I'm having a special case of alphablending: I want to use a texture that only has eigther solid (a = 1.0) or completely transparent (a = 0.0) pixels (flags whose edges are torn). I'll have a lot of these objects in nearly every level of the game, so I don't want to waste performance on sorting them from back to front. Is there a way to tell directx not to render completely transparent pixel into the z-buffer?

Share this post


Link to post
Share on other sites
Sure. Look into "alpha testing" (D3DRS_ALPHATESTENABLE). It's a basic 3D functionality.
If you need accurate boundaries, you might want to look into [url="http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf"]this paper[/url].
You also have the choice to call [url="http://msdn.microsoft.com/en-us/library/bb204826(VS.85).aspx"]clip()[/url] in the pixel shader: be careful with that as it interacts poorly with some (most?) D3D9-grade adapters. Alpha testing is your first choice.

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