New Nvidia Texture Tool Exporter doesn't save alpha channels

New Nvidia Texture Tool Exporter is not saving alpha channels. Only cut-out .dds files.

Previous exporter would allow me to save RGBA with mipmaps. This current version is making everything a cutout, even when not selecting the cut out option. Maybe I am missing something but neither myself or other artist on the team can figure it out.

Using both Photoshop 2019 and PhotoshopCC

1 Like

Hello,

I’m using 2020 and having the same issue. Although I don’t think the problem is the in the way DDS are saved (the alpha channel is there - there is no such thing as “DDS cutout”) but the problem is the with the way the nVidia tools load them in PS.

Intel plugin asks you whether or not you want the alpha channel loaded as transparency or into a alpha channel.
Having worked with DDS files for well over 8 years now I have never wanted my alpha channels to be displayed as transparency in Photoshop. I always want them to be in my alpha channel as a separate channel.

Intels solution is annoying because you need to click that every time you load a dds file. There should be a way to set a default setting to this.

We use alpha channels for far more than just transparency. Having them displayed this way in PS makes it literally impossible to work with for me.

For me sadly, despite really wanting to use these tools, this makes them impossible to use.

If the tool developer insists on having the ability to load DDSs as “cut outs” than give us an option for RGBA instead that we can default to so that I dont have to specify that every time i load a texture. Until then, im back to Intels tools sadly.

Thank you

1 Like

With previous nvidia tool there was a popup with options when you opened a .dds. I believe options for alpha channel, and viewing mip levels as well.

Current functionality make it impossible to use for me also.

Pretty sure this is a bug but this doesn’t seem to be a commonly used tool.

1 Like

Hi all - this is one of the lead developers for the new NVIDIA Texture Tool Exporter. Sorry for taking so long to get to this, I just saw this thread!

Could you maybe elaborate more on what you mean by cutout .dds files? In the context of the plugin, cutout alpha refers to the sort of binary alpha thresholding that you see with textures like leaves and fences, where the alpha channel is either completely opaque or completely transparent per texel. (Since most engines do this thresholding when displaying the texture, the Cutout Alpha checkbox serves mostly as a way to preview alpha thresholding.) Note that some texture formats such as BC1a only have support for a 1-bit alpha channel, so there effectively all textures use cutout alpha (which is one of the reasons we have BC7 at the top of the list, since it has more sophisticated alpha support).

But from mikeecze and r.m.falck’s comments, it sounds like this is referring instead to how the plugin loads .dds textures by default, as transparency rather than as a separate alpha channel. This is a good use case to have, and might be implemented in a future version.

At the moment, a workaround for this is to create an alpha channel from the layer’s transparency using the following method (note that this could also be recorded into a Photoshop action, so that you could press a hotkey instead of manually performing these steps each time):

  • Select the layer and click Layer > Layer Mask > From Transparency
  • Go to the Channels pane, click on the layer mask, and select Duplicate Channel
  • Go back to the Layers pane, and delete the layer mask.

As a side note, if you’re working with textures that use the alpha channel for data other than transparency, make sure to uncheck the “Premultiplied Alpha Blending” checkbox, so that mipmapping treats each channel separately, instead of assuming that the alpha channel represents transparency.

Hope this helps, and please let me know if there are any more questions I can answer.

Thanks.

Indeed we are using alpha channels for data other than transparency. When opening .dds files with alpha information, the photoshop plugin applies this as transparency. Yes, you can get the alpha channel information from the layer transparency, but the RGB channel information is lost in those now transparent pixels.

Unchecking “Premultiplied Alpha Blending” does not seem to make a difference when opening in photoshop. Curious if the information is still there as the separate channels when saving from source .psd’s. Will have to test the .dds in a different application to see if it’s reading alpha instead of transparency.

Ah, OK, I think I might know why you’re seeing what you’re seeing here, thanks (it might be a known bug that will likely be fixed in the next version)! Is the RGB data getting set to black only for those pixels that have an alpha value that is exactly 0? (The RGB data should be preserved for pixels that have any nonzero alpha value, even a value of 1/255.)

If so, here’s what’s going on: Because of some of the nice mathematical properties it has for blending colors more accurately (which was a major focus for this version), the plugin tries to internally store colors using premultiplied alpha as often as it can - i.e. it stores an unpremultiplied (r, g, b, a) color in the form (r*a, g*a, b*a, a). (Many of the operators in the plugin, such as the RGBA scale/bias sliders, still work on unpremultiplied alpha colors, so the plugin converts between unpremultiplied and premultiplied colors often). Given a premultiplied color (r*a, g*a, b*a, a), so long as a isn’t equal to 0 (e.g. if a is 1/255), you can get the unpremultiplied color back by dividing by a. But when a is equal to 0, that information gets lost - (r, g, b, 0) premultiplies to (0, 0, 0, 0). One of the solutions for this is to avoid multiplying by a when a is equal to 0 - i.e. having (r, g, b, 0) premultiply to (r, g, b, 0) instead of (0, 0, 0, 0), but this hasn’t been implemented yet in the current version. (I believe Photoshop stores colors using unpremultiplied alpha, so the RGB information doesn’t go away with a transparent layer mask or alpha channel, but this can also lead to some artifacts when blending transparent colors.)

The “Premultiplied Alpha Blending” setting only applies to export, instead of import, and affects how higher mips are generated so that colors are blended correctly when the alpha channel represents transparency (which isn’t the case in this case). To see what it does, you can take a texture with varying colors and transparency, slide the Mip slider to Mip 1 or higher, zoom in on a transparent edge, and toggle the setting on or off. John McDonald talks a bit about this here: Alpha Blending: To Pre or Not To Pre | NVIDIA Developer

No the pixels in RGB Channels are not turned black. They are turned transparent/ gone.

Open any .dds with an alpha channel and the alpha is applied to RGB channels as transparency.

Obviously this is a bug for now. Hopefully it will be fixed soon

Yes, please fix the bug that multiplies alpha into RGB on import; or at least make an option to suppress it. Is the source code for nvidia teture tools available somewhere… or beta versions?

1 Like

I have a similar issue. If I have an alpha channel some pixels in color channels are black. I’m expecting that alpha channel doesn’t have any effect on RGB data. This is a critical bug for me.

Thanks Neil! This works but ideally should be a feature for opening DDS files with the plug-in, as it was in the legacy plug-in.
Similarly, the exporter doesn’t seem to recognize alpha channel. So in order to have the alpha exported i had to flatten image and apply the alpha as a layer mask. I assume i’m missing something here.

Hi all,

We just released version 2020.1.3 of the Texture Tools Exporter today, which should solve many of these issues:

  • The Photoshop DDS reader now asks you whether you want to load the alpha channel of a DDS file as transparency or as a Photoshop alpha channel. You can set defaults for this by unchecking the “Show This Dialog” checkbox to always read DDS files with your chosen settings - and if you want to show the dialog again, you can re-enable it from the About box (Help > About Plug-ins > DDS - NVIDIA Texture Tools Exporter).

  • RGB values will now be preserved when alpha = 0. In other words, the information for fully transparent pixels is now preserved. (We fixed this by having the tool use unpremultiplied rather than premultiplied alpha internally). The option to enable premultiplied alpha downsampling has also been renamed to “Premultiplied Alpha Blending (Alpha is Transparency)” - but even if you accidentally leave it on, the tool now uses a bit of a trick that allows it to preserve RGB colors when alpha = 0 even when using premultiplied alpha downsampling. Note that the exporter (not the importer) doesn’t quite recognize additional alpha channels yet, so when exporting you have to apply them as layer masks; I think this is due to how Photoshop treats additional alpha channels as different from both RGB channels and transparency.

  • The popup that shows when you load a file now also has options for loading mipmaps (we load them from bottom to top in layers, so that if you import an opaque image and immediately re-export it you get the same result) and for flipping the texture on the y-axis (requested in a different post).

Hope this helps!

2 Likes

That’s great to hear! Will try it out.

Awesome work!

Appears to be working as expected. Appreciate the new functionality.

One Question if I may, Does the “premultiplied alpha blending” have a CMD argument so i can stay out of the GUI?

Yep! This is the --mip-pre-alpha flag to use premultiplied alpha blending (or the --no-mip-pre-alpha flag to turn it off - --mip-pre-alpha is on by default). It uses the slightly older name (since it controls whether premultiplied alpha blending is used during mipmapping), but it’s in the Mipmap Options section of the nvtt_export --help screen.

Hey I have a question regarding this, I have the new exporter but its not seeing the alpha in the plugin tool, however when i save the PSD open it in the standalone program, it shows up.

Am i doing something incorrectly for the plugin?

Hmm - that is weird; I don’t think you’re doing anything incorrectly here. Is it possible to send me a copy of the PSD file so that I can try to figure out what’s going on internally?

Thanks!

1 Like

Sure! Its almost a 1GB though! I can send you in a private message my gdrive link.

That’s alright! I should be able to pull it from anywhere it’s posted, or if you see the same artifacts after downscaling it, I can work with a downscaled version of the file as well.

1 Like