Jump to content
  • Advertisement
Sign in to follow this  
Crazyfool

Rendering problem (D3D9)

This topic is 4169 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 have a little game (not so mucha GAME right now hehe) that draws the player moving around, animated. The sprite is drawn from one of 12 parts of one large texture, depending on direction and stance. I have him slanted up, to give a more 3d look (youll see when you see vertex buffer). I have pink as the 'invisible' color that allows you to see whats behind the sprite. Ok, everything looks fine until I have another player drawn on screen. What happens is, when one player 'walks over' anpother pplayer or sprite, if it comes from the left, right or above, it looks fine. However, if spriteA moves UP towards spriteB, spriteA's texture will begin to cover spriteB, even though spriteA has the transparency color. Here's the vertex buffer:
{0.5, spriteAngle, -0.5, 0xffffffff,	0,				0,},
        {-0.5, spriteAngle, -0.5, 0xffffffff,	1.0/X_FRAMES,	0,},
        {0.5, 0, 0.5, 0xffffffff,		0,				1.0/Y_FRAMES,},
        {-0.5, 0, 0.5, 0xffffffff,		1.0/X_FRAMES,	1.0/Y_FRAMES},

where sprite angle is 0.6f I can try to get a SS if you cant understand. Thanks

Share this post


Link to post
Share on other sites
Advertisement
From what you described, this sounds like a Z-buffering issue. What technique are you using to hide the pink areas of the texture? Are you using Alpha Blending or Alpha Testing? You'd want to either be using the second, or both, for this kind of thing. From the behaviour you're encountering, I'd say you're only using Blending right now.

If you don't quite understand the differences, look up the two terms in the SDK Documentation.

Hope this helps.

Share this post


Link to post
Share on other sites
Ah! I believe I'm using just blending, do you have a recomdation on what I should use ? (that is, both or just testing)

Thanks

Share this post


Link to post
Share on other sites
AlphaTesting should be used in any case you want to remove pixels completely using their alpha value. Alpha testing does a "boolean" test per pixel, either it passes or it fails.

Alpha Blending allows for a smooth transition between visible and not visible. If your texture has alpha values between 0 and 255, and you want them to be blended according to alpha, use that.

All in all, Alpha Testing should be used in nearly any alpha-related rendering. Alpha Blending should only be used if intermediate values of alpha are possible, and should be disabled when they are not (blending incurs a small performance penalty when enabled).

Hope this helps.

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!