DX9 and PNG images/sprites?

Started by
13 comments, last by timeshifter 16 years, 2 months ago
Quote:Original post by timeshifter
Doing that actually made every sprite drawn completely transparent so nothing showed...


You can try adding this to his code:

Device.RenderState.ReferenceAlpha = 0x7F;

I've always had weird issues using alpha testing when reference alpha was 0.

Keep in mind that your textures do need an alpha channel for alpha testing to work, so we're assuming you're using PNGs now and not trying it with the GIFs.
Advertisement
Still not working... before I go too much further with this stuff, what exactly is this test doing? From what it seems to me, I'm telling it to test the alpha channel for a value greater than 0x7f, and render it transparent if it passes... is that correct?
timeshifter.Signature = new Signature("Under Construction");
I've modified the title, since it's no longer GIF's I'm dealing with.. .and I have a sneaking suspicion I may not have the transparency I think I do. I'll confirm that when I can... until then, I guess the rotation is the next big thing. How can I draw my Sprite with point rotation? It seems to be eluding me...
timeshifter.Signature = new Signature("Under Construction");
Quote:Original post by timeshifter
I'm telling it to test the alpha channel for a value greater than 0x7f, and render it transparent if it passes... is that correct?


"render it transparent" doesn't really make sense, the whole point of something being transparent is to not render it.

What the test does is test the alpha channel and if it's greater than 0x7F renders its, if the test fails the pixel/texel is ignored. You can of course change the reference value and the operation to something other than greater.

Note that since this is a boolean test, it's either on or off, you can't use it for smooth transparency/blending. However it's a lot faster then blending since blending adds/subtracts/multiplies colors together.
Yeah, i suppose that doesn't make much sense... tells you how new I am to game dev, I guess.

But your description certainly cleared things up. Thanks for that. Now if I could just get my rotations right...
timeshifter.Signature = new Signature("Under Construction");

This topic is closed to new replies.

Advertisement