Jump to content

.dds mipmap transparency problem


Recommended Posts

Hello, I just noticed that when exporting .dds files with fully transparent pixels, these pixels lose their color information in the mipmaps and get set to black. Ususally that is not a problem because the transparent pixels are not displayed, anyway, but for example when exporting a normal map for a game like The Elder Scrolls: Oblivion, where glossiness is controlled by the alpha channel of the normal map, this can become an issue (and this is also where I noticed this in the first place). Of course, making these pixels not completely transparent, but keeping them a little opaque can prevent this from happening, but I still wanted to report it because I don't think it is supposed to happen (and also it does not happen with other dds exporters like the gimp plugin, but I usually prefer Paint.NET because I made the observation that it generates better mipmaps).

Link to comment
Share on other sites

If some program is using the alpha channel for a purpose that it was not designed (showing glossiness instead of transparency) do not be surprised when the file doesn't work properly.

 

When outputting pixels, if the alpha level is 0, the R, G, and B components are undefined (and can therefore be any value).

 

Your best workaround is to set the alpha value to 1 instead of 0 as this will preserve the R, G, and B components.

Link to comment
Share on other sites

Well, the normal map alpha channel controls glossiness in Oblivion, and if I want a texture to be partly glossy and partly matte, I have to make the matte parts transparent (or at least mostly transparent). The color values are still used correctly for normal mapping, even if the pixels are transparent. Now if I export a texture with transparency as dds, the color values remain correct in the main texture (the full-size image), but transparent pixels become black in the mipmaps, even though they stay transparent. That means, the normal map does not work any more in these parts when the mipmaps are used. The Gimp plugin generates mipmaps with transparency correctly, Paint.NET does not.

 

The original game also contains normal maps with fully transparent pixels, with the RGB values intact, so it is supposed to work like this,

 

I hope the picture makes clear what I mean. The images in the upper right and lower left corner are what the mipmap in the upper left corner looks like with the alpha channel removed after exporting as .dds with Gimp and Paint.NET, respectively.

dds_issue.jpg

Edited by Pherim
Link to comment
Share on other sites

3 minutes ago, Pherim said:

it is supposed to work like this,

 

The game may work like this, but the file format they're using is not designed to work like this.

 

Both programs are outputting according to standard*.  If you like the gimpy program output better than paint.net's output, I suggest using that.

 

 

 

*for undefined values, paint.net chooses to output them as black and that gimpy program chooses to output them as the RGB values as if the alpha was set to 1 instead of 0.  The values are UNDEFINED, so any output is correct according to standard.  If your game chooses to read those UNDEFINED values and act on them as if the undefined bytes have some value, that's their problem.

Link to comment
Share on other sites

Alright, I get that, but Paint.NET actually exports them with RGB values for the main surface, as I said, the problem is only in the mipmaps. And as I also told you, I prefer Paint.NET for exporting .dds, but I guess I just have to use Gimp for normal maps then. I also don't think it makes much sense to set them to black, it's not like it changes the file size or anything. But I guess you know more about that than I do.

 

Thanks, anyway.

Edited by Pherim
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...