• Advertisement
Sign in to follow this  

[DX9] Transparent pixels: no z-value

This topic is 2321 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

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
Advertisement
Sure. Look into "alpha testing" (D3DRS_ALPHATESTENABLE). It's a basic 3D functionality.
If you need accurate boundaries, you might want to look into this paper.
You also have the choice to call clip() 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
Sign in to follow this  

  • Advertisement