Sign in to follow this  
Shock

PNG loading problem ( transparency issue )

Recommended Posts

Heya all, I am trying to load a 32 Bit PNG file. I created the file in photoshop and it has transparent parts. I am using my own image loader ( using libpng ). When I load this and use it, the transparent areas are light blue! But wait, before you say "there's a problem with your loader code". I used D3DX to load the image...same result! So I went and: Open with windows image viewer: Transparency is correct Open with windows paint: Transparency is light blue! I don't know what is wrong. I tried different exporters to! When I use Paint Shop Pro the transparent sections become black. Any advice? I did not turn any alpha blending settings on in D3D. Do I have to? I tried this same thing using 32Bit TGA / DDS and the transparency works perfectly without enabling alpha related states. Please help, Thanks! - Shock

Share this post


Link to post
Share on other sites
Does Dx even use transparent layer information? Or does it have to have a transparent color key set (that's the way it worked in DirectDraw Version 6) - cause all images get loaded to a in memory bitmap format regardless of source, and I don't think the in memory format has "transparency" ... just colors and color keys (applied while bliting).

Share this post


Link to post
Share on other sites
Since you have loaded the image, you need to tell Direct3D how to handle the rendering of the image. You have to do some kind of alpha blending.
something like this.

Device.RenderState.SourceBlend = Blend.SourceAlpha;
Device.RenderState.DestinationBlend = Blend.InvSourceAlpha;
Device.RenderState.AlphaBlendEnable = true;



I hope this helps.
Take care.

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