GameTechDev / Intel-Texture-Works-Plugin

Intel has extended Photoshop* to take advantage of the latest image compression methods (BCn/DXT) via plugin. The purpose of this plugin is to provide a tool for artists to access superior compression results at optimized compression speeds within Photoshop*.
https://software.intel.com/en-us/articles/intel-texture-compression-plugin-for-photoshop
Apache License 2.0
255 stars 39 forks source link

The plugin doesn't seem to save out the alpha channel in version 1.04 #11

Closed rymdkakor closed 3 years ago

rymdkakor commented 8 years ago

Hello!

I'm using the plugin in our student game project and we might have noticed a problem, but it just might be that we're using the plugin for things it was not intended for.

I devised a texture packing pipeline that is as follows:

1 normal map texture 1 Albedo texture with transparency in the alpha channel. 1 "AOREM"-texture with the Ambient Occlusion map in the alpha channel, the Roughness map in the green channel, an Emissive mask in the red channel and a Metalness mask in the blue channel.

The problem we are having is that the plugin doesn't seem to save out the alpha channel at all, even in the 1.04 release. Thus our textures lack transparency and gets a completely black AO, since our engine is looking for the non-existent alpha channel.

Our deadline is next Wednesday, please help!

Best regards,

Dag Lindwall, Game Art student at The Game Assembly, Malmö, Sweden

christop4D commented 8 years ago

Are you sure you use the Color+Alpha setting where you specify the texture type and select an encoding that supports alpha? What Photoshop version, what win version. Attach some images of the problem and send attach the psd file.

rymdkakor commented 8 years ago

Hi!

We are using the Color+Alpha setting saved in Linear (fine). Our computers are running Windows 8.1 and Photoshop CS6.

It seems that if we save in Linear (fast) instead it saves an alpha channel, but the alpha channel is empty.

I'll post some images shortly, thanks for the quick reply!

rymdkakor commented 8 years ago

Hello again,

I tried adding a .rar archive to the thread but it seems it only supports .zip. I made a new .zip archive but that wasn't accepted either even though I tried creating it with WinRar, 7zip and the Windows default zip tool.

I added it as .rar to my cloud drive instead: https://mega.nz/#!NhMnyY7L!ZQIPerEfZhbeSNuaAn5_LpgtyB9NNBz9JtrYGHg7Et0

Inside is a Photoshop file with 7 layers: A (Albedo) AO (Ambient Occlusion) M (Metalness) N (Normal) R (Roughness) E (Emissive) O (Opacity)

I also added the Photoshop action I created to pack the textures, after you run it (press F8) you are left with 3 files: A (Albedo with alpha), N and "AOREM".

AOREM: R: Emissive G: Roughness B: Metalness A: Ambient Occlusion

When we save these the normal map seems to work fine but as I said, when we save the "A" and "AOREM" textures the plugin seems to discard the alpha channel which results in us losing AO and transparency on our assets.

We use these settings for the problem textures:

Texture Type: Color + Alpha Compression: BC7 8bpp Fine (Linear, DX11+) Mip Maps: Auto Generate

rymdkakor commented 8 years ago

Okay I have an update:

The pipeline I devised consisted of creating the textures in Substance Painter and exporting them as the separate layers I described in a .psd file using an export preset I put together. Substance Painter creates what looks to me like a totally normal .psd file, and for all intents and purposes it is a totally normal .psd file, though there must be some small difference somewhere.

If we export the textures as separate files, .png was what we tested, and copy/paste them manually into the channels where we want them, and then save them using the plugin, the alpha gets saved. Unfortunately this means we can't use the handy photoshop action I made, and it takes us 50 times as long to save out the textures.

The photoshop file I provided in the rar archive was saved from Substance Painter 2, in case someone wants to take a look!

rymdkakor commented 8 years ago

Another update:

We tried exporting the textures as regular .png and pasting them into a new photoshop document, to rule out the possibility that Substance Painter makes an error when creating the .psd. Unfortunately there was no change.

If we preview the file before saving and choose to display the alpha channel it displays as just white and empty. To make things even more confusing, after we save the image the photoshop document changes to the saved file, where the alpha channel is present, but if we close it and reopen it the alpha is gone.

christop4D commented 8 years ago

Your latest update contradicts your previous update.

If we export the textures as separate files, .png was what we tested, and copy/paste them manually into the channels where we want them, and then save them using the plugin, the alpha gets saved.

rymdkakor commented 8 years ago

Yes I see that now! I apologize, I have a lot on my mind!

I was relaying info from a guy on my team and must have mixed up a few things, let me clarify:

If we export them as pngs, open the pngs in Photoshop and copy/paste the textures from the png into the channels where we want them in a new psd document, and then save them, the alpha works.

If we create a new psd document and drag all the files into this document, and then run the Photoshop action (that does the exact same thing as if we did it manually), and then save it, the alpha does not work.

The action is not advanced at all, I just recorded all the steps so we wouldn't have to do it hundreds of times manually. We have gone through the action without finding anything that would suggest why it doesn't work, I would be very surprised if the action was to blame.

Thanks for reading my posts!

christop4D commented 8 years ago

I am sorry, i might have time to look into this during the weekend.

I am not photoshop expert. But one thing i can remember is that once you have layers enabled the transparency will come from the transparency and not the alpha. This means that if you just create one image (Background) with an alpha it will work. As soon as you enable multiple layers the tranparency (this is how layers work in order to combine into the final image) comes form the transparency and not the additional alpha channel.

Is there a way for you to flatten all down so that it removes all layers notion. Because once you have layers on then photoshop keeps this mode even when there is only one layer.

rymdkakor commented 8 years ago

I think we got it!

The file which we create and then paste the texture channels into has only one layer. I had never considered the point of flattening the image as there was only one layer and I thought that flattening an image just mean merging all the layers. If I added a flatten image command to the action and save the file it works!

Though it seems that if the alpha is 100% white (as we do in the albedo texture when there is no transparency on the asset) the plugin will optimize away the alpha channel and not save it. In our engine (made by our programming students) that means that it will default to black since it didn't find an alpha channel, and all assets without transparency will be completely transparent. I fixed this by adding a black pixel in the bottom right corner of the image to force the plugin to save an alpha channel. Not perfect but we don't have time to make a more elegant solution before the deadline.

What confuses me most about all this is when we copied the textures into the channels manually we never flattened the image but it still worked. Oh well, I guess I should just be thankful that we seem to have found a solution!

Thanks!

christop4D commented 8 years ago

This makes sense. By default Photoshop creates a file without layers (already flattened) and names the Layer Background. You can also use an alpha of 254 instead. The alpha flattening was an optimization most users wanted... This is why all this is open source..... In essence you could tweak the plugin to do as you want it to.

Wish you success with your project.