Jump to content
  • Advertisement
Sign in to follow this  
dist0rted

Problems w/ ID3DXSprite Color Keying/Transparency

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

Whenever I render my images with LPD3DXSPRITE, I can't ever get true transparency with color keying values. It'll be transparent with the background, but whenever another object rendered with the Sprite Handler comes near the original object, the one that was rendered first is overlapped by the second's image (even the part that's "transparent"). Do I have to create my textures every frame in the main loop just so the objects behind them will be considered in the transparency or something?

Share this post


Link to post
Share on other sites
Advertisement
When you render transparant objects, you need to either render them last and sorted back-to-front, or disable Z-writes when you render them.
The first method is usually preferable, and ID3DXSprite has a flag you can pass to Begin() to sort them back-to-front.

Share this post


Link to post
Share on other sites
I've tried using that flag, and still the sprites are overlapped by the background on the corners of the square that the texture is drawn to.

EDIT: http://www.welch23.com/gamedev/ has a sample program that demonstrates my problem. You can move the ship with LEFT/RIGHT/UP/DOWN arrow keys, or use W/S/A/D. Try positioning the ship near the other one to where it is behind it, and you'll see what I mean.


EDIT (Again... might as well clear this up): My Begin() call uses D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_DEPTH_BACKTOFRONT

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!