Jump to content
  • Advertisement
Sign in to follow this  
maxmaxmax

DX11 Having trouble creating a .DDS file with an alpha channel

Recommended Posts

I have a bitmap file that I created in photoshop that contains an alpha channel. When I try to use texconv to create the texture, the resulting texture only contains a fully white alpha channel instead of the alpha channel that I created in photoshop. The arguments that I passed to texconv are:

-f BC3_UNORM .\cat_bmp.bmp -dx10 -y

the output from texconv is this message:

reading .\cat_bmp.bmp (600x400 B8G8R8X8_UNORM 2D) as (600x400,10 BC3_UNORM 2D α:Opaque)
writing cat_bmp.DDS

I find it suspicious that the output says that it`s reading alpha as "Opaque" since the result I get is an alpha mask that is fully white... which sounds like what the output means by an "opaque" alpha.

What could be causing my alpha channel to turn all white?

Share this post


Link to post
Share on other sites
Advertisement
Posted (edited)

Do you have to use BMP? It's not exactly a convenient or portable format to use with alpha channels. Not to say the format is obsolete altogether.

Try a more common format such as PNG and see how that works.

Edited by Prototype

Share this post


Link to post
Share on other sites

PNG should work. Are you perhaps using an older version of Photoshop? I had some problems with that in the past, TGA is your safest bet in such case.

Share this post


Link to post
Share on other sites
Posted (edited)

I'm using photoshop cs5 here, is it considered old at this point? I just tried TGA and it does save the alpha channel!

The output from texconv is:

reading .\cat_bmp.tga (512x512 R8G8B8A8_UNORM 2D) as (512x512,10 BC3_UNORM 2D α:NonPM)
writing cat_bmp.DDS

It says that the alpha is "NonPM", however it clearly seems premultiplied to me since the transparency effect is visible in the image. Shouldn't the transparency effect not be visible unless the alpha is premultiplied?

Also interestingly texdiag.exe says that the alpha mode of the .DDS file is "Unknown". Maybe it's actually premultiplied?

Edited by maxmaxmax

Share this post


Link to post
Share on other sites

Make sure there are no transparent pixels in your base image, or color changes on the edges of opaque areas. The colors there should bleed outwards to fill the entire canvas. Also check your alpha channel in the channels panel.

Not sure if premultiplication is an issue but I have never faced it. How do you mean the effect is visible? Inside a viewer, your application? Frankly, I'm currently not using Photoshop nor DDS files so I cannot give you any more particular information than that.

Share this post


Link to post
Share on other sites
Posted (edited)

Thanks a lot for your help, it looks like everything is normal. I`m able to create premultiplied and straight alpha images. The RGB channels are intact when in straight alpha and they're properly "clipped" when premultiplied. I was just interpreting the results incorrectly from inside my application. So using .TGA was the fix I needed.

Edited by maxmaxmax

Share this post


Link to post
Share on other sites

Great to hear, however I'm not sure if using TGA permanently is the best thing for your workflow. It's kind of an ancient format and filesizes are usually large (often uncompressed). It may also be marginally supported by other tools you might want to use. Aren't there any other converters that can do the job more easily?

Share this post


Link to post
Share on other sites

In my experience using TGA or PNG as input for texconv, delivers good results in the DDS (with alpha layer). I also found that GIMP works pretty easy when creating the alpha layer, copying in existing images, into the alpha layer of another image. The old DDSTEX tool can only do so much, too bad it doesn't support 'modern compression DDS formats'.

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  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!