Mr. Mendelli Posted August 11, 2022 Share Posted August 11, 2022 I am working with texture files for a game that uses an image format that packs channels in a given image file in a strange way, essentially each channel is akin to it's own layer. Pictured in my screenshot is the A (alpha) channel, it makes it seem like this is all that is there, but after speaking with someone else doing the same kind of work with this game's textures, they use GIMP which they said is the only software they know of that can reveal the other channels with this format. They haven't used Affinity Photo and this is my first time working with this format and I would like to know how (if) Affinity Photo handles this format. I have experimented with changing the color profile but I can't seem to get the rest of the texture to reveal its self. Here is a video demonstration they provided of how it is supposed to work:https://gyazo.com/5fbae0474f53d5694840ff2497b50f4c Quote Link to comment Share on other sites More sharing options...
Staff DWright Posted August 12, 2022 Staff Share Posted August 12, 2022 Can you please let me know which file format that your RGBA image is using and if possible can you please post a copy of the file. Quote Link to comment Share on other sites More sharing options...
Mr. Mendelli Posted August 12, 2022 Author Share Posted August 12, 2022 It's a portable network graphic: gravity_body_bc.zip Quote Link to comment Share on other sites More sharing options...
Hangman Posted August 13, 2022 Share Posted August 13, 2022 @Mr. Mendelli you can reveal the content of the alpha channel in Affinity Photo as follows: Open your PNG file Show the Channels panel (View > Studio > Channels) In the Channels panel, right click the Background Alpha layer (8th layer from the top of the list) and select Create Spare Channel. Right Click the Spare Channel you've just created and select Load to Background Alpha. Right Click the Background Alpha layer again and select Create Mask Layer to create a Mask layer in the Layers panel. Nest the newly created Mask layer to the Background layer by dragging the Mask layer over the Background thumbnail in the Layers panel and release the mouse. Make sure you have the Background layer selected in the Layers panel (not the Mask layer). From the Channels panel right click the Background Alpha layer and select Fill. Now turning the nested Mask layer in the Layers panel off and on will reveal then hide the hidden alpha channel content. Note: In the video, I've renamed the Background Layer to Gravity Body BC... Background Alpha.mp4 Quote Affinity Designer 2.4.2 | Affinity Photo 2.4.2 | Affinity Publisher 2.4.2 Affinity Designer Beta 2.5.0 (2402) | Affinity Photo Beta 2.5.0 (2402) | Affinity Publisher Beta 2.5.0 (2402) Affinity Designer 1.7.3 | Affinity Photo 1.7.3 | Affinity Publisher 1.10.8 MacBook Pro 16GB, macOS Monterey 12.7.4, Magic Mouse Link to comment Share on other sites More sharing options...
Mr. Mendelli Posted August 13, 2022 Author Share Posted August 13, 2022 Thank you for the detailed explanation @Hangman, this is working for me on my end so far. Quote Link to comment Share on other sites More sharing options...
Hangman Posted August 13, 2022 Share Posted August 13, 2022 @Mr. Mendelli, that's good to hear, does it give you everything you need from the file? Quote Affinity Designer 2.4.2 | Affinity Photo 2.4.2 | Affinity Publisher 2.4.2 Affinity Designer Beta 2.5.0 (2402) | Affinity Photo Beta 2.5.0 (2402) | Affinity Publisher Beta 2.5.0 (2402) Affinity Designer 1.7.3 | Affinity Photo 1.7.3 | Affinity Publisher 1.10.8 MacBook Pro 16GB, macOS Monterey 12.7.4, Magic Mouse Link to comment Share on other sites More sharing options...
Mr. Mendelli Posted August 13, 2022 Author Share Posted August 13, 2022 For this particular texture, yes. There is another that has more layers than this I will have to test though. If I can't manage to get all of the layers visible that I need than I will report back. Additionally, I will have to experiment with re-encoding and packing back into the game to make sure that my edits carry over properly. Quote Link to comment Share on other sites More sharing options...
Hangman Posted August 13, 2022 Share Posted August 13, 2022 No problem... Quote Affinity Designer 2.4.2 | Affinity Photo 2.4.2 | Affinity Publisher 2.4.2 Affinity Designer Beta 2.5.0 (2402) | Affinity Photo Beta 2.5.0 (2402) | Affinity Publisher Beta 2.5.0 (2402) Affinity Designer 1.7.3 | Affinity Photo 1.7.3 | Affinity Publisher 1.10.8 MacBook Pro 16GB, macOS Monterey 12.7.4, Magic Mouse Link to comment Share on other sites More sharing options...
Lisbon Posted August 13, 2022 Share Posted August 13, 2022 This "channel packing" appears very often here on the forum. Has anyone tried using imagemagick instead of Affinity Photo, GIMP or any other software? Probably the time needed to open the files in a regular photo editor should be enough to combine all channels in imagemagick. Has anyone tried it? Quote Link to comment Share on other sites More sharing options...
Hangman Posted August 13, 2022 Share Posted August 13, 2022 Not tried it but there are plenty of posts in various forums talking about the best way to do it, e.g., https://stackoverflow.com/questions/71161092/imagemagick-mass-extract-alpha-from-png-combine-files-back Lisbon 1 Quote Affinity Designer 2.4.2 | Affinity Photo 2.4.2 | Affinity Publisher 2.4.2 Affinity Designer Beta 2.5.0 (2402) | Affinity Photo Beta 2.5.0 (2402) | Affinity Publisher Beta 2.5.0 (2402) Affinity Designer 1.7.3 | Affinity Photo 1.7.3 | Affinity Publisher 1.10.8 MacBook Pro 16GB, macOS Monterey 12.7.4, Magic Mouse Link to comment Share on other sites More sharing options...
Mr. Mendelli Posted August 13, 2022 Author Share Posted August 13, 2022 I am running into some trouble saving edits @Hangman. I need to be able to save and export these textures the same way they are when I extract them from the game. Do I need to make changes to the channels as well after I make my edits to cement them? Currently the "hidden" portion of the texture is being replaced with all black pixels. I'd like to add that while there are other tools that can work with this type of image, I would prefer to use Affinity Photo for workflow purposes. Quote Link to comment Share on other sites More sharing options...
Hangman Posted August 13, 2022 Share Posted August 13, 2022 I'm not sure if this helps? Quote Affinity Designer 2.4.2 | Affinity Photo 2.4.2 | Affinity Publisher 2.4.2 Affinity Designer Beta 2.5.0 (2402) | Affinity Photo Beta 2.5.0 (2402) | Affinity Publisher Beta 2.5.0 (2402) Affinity Designer 1.7.3 | Affinity Photo 1.7.3 | Affinity Publisher 1.10.8 MacBook Pro 16GB, macOS Monterey 12.7.4, Magic Mouse Link to comment Share on other sites More sharing options...
Lisbon Posted August 13, 2022 Share Posted August 13, 2022 33 minutes ago, Mr. Mendelli said: Currently the "hidden" portion of the texture is being replaced with all black pixels. This is a known issue in A. Photo. If alpha = 0 then all RGB values are replaced by 0 (black). See if this helps: Method 1 Method 2 Quote Link to comment Share on other sites More sharing options...
Mr. Mendelli Posted August 13, 2022 Author Share Posted August 13, 2022 Thanks, channel/image packing in this context is a new concept to me as of the last few days. Looks like I just need to do some homework to learn a new format as I had to with Direct Draw Surfaces. Quote Link to comment Share on other sites More sharing options...
Mr. Mendelli Posted August 13, 2022 Author Share Posted August 13, 2022 I will look this over @Lisbon, thank you for the assistance. Lisbon 1 Quote Link to comment Share on other sites More sharing options...
Mr. Mendelli Posted August 30, 2022 Author Share Posted August 30, 2022 I have been experimenting and this isn't going anywhere for me. I have looked into the Channel Packing video as well as the other proposed suggestions. Method 1 has become too convoluted and I can't tell if I am doing it right, and I believe Method 2 will not work with this type of texture packing due to the colors. At this point I'm just very confused and this feels overly-complex. I was going to try the alpha masking method from Method 1, but I think I need to make a separate layer for R, G, B, and A individually(?). And even if that is what I am supposed to do for that method to work, I have tried and failed multiple times to make an individual layer for each channel. I have attached an attempt document using the mask/erase method. gravity_body_bc.afphoto Quote Link to comment Share on other sites More sharing options...
Lisbon Posted August 30, 2022 Share Posted August 30, 2022 Hi @Mr. Mendelli You managed to replace the R,G and B channels, right? Assuming you already done the channel packing for R, G and B channels as shown in the video, this should be your starting point. I will also assume you already have your layer which you will use to replace the alpha channel. If I understand correctly, you are using a color image to replace alpha. If youre using a grayscale it wont make a difference. Just follow the steps. Since you are using a color image to replace alpha i had to update the formula for method 2. var lum=rgbtoi(R,G,B); var a=step(lum,0); a/255 + (1-a)*lum Finaly, use"Replace Alpha Channel (Pixel)" to replace the alpha channel in the same way that you replaced the RGB channels. After replacing alpha, delete de layer "Replace Alpha Channel (Pixel)". Export as a PNG. Hope this helps. Quote Link to comment Share on other sites More sharing options...
NotMyFault Posted August 30, 2022 Share Posted August 30, 2022 (edited) On 8/13/2022 at 6:16 PM, Lisbon said: This is a known issue in A. Photo. If alpha = 0 then all RGB values are replaced by 0 (black). See if this helps: Method 1 Method 2 I've tried all methods on Mac and iPad, and it seems they don't work any more under Aph 1.10.5. Update: it works correctly. Exported PNG files have all RGB info lost where alpha is 0 I think it has been working before in older versions / under Windows. Can you please check if it is still working for you? Edited August 30, 2022 by NotMyFault Quote Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080 LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 iPad Air Gen 5 (2022) A2589 Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps. Link to comment Share on other sites More sharing options...
Lisbon Posted August 30, 2022 Share Posted August 30, 2022 Thank you for your feedback @NotMyFault. 1 hour ago, NotMyFault said: Can you please check if it is still working for you? I only tested method 2 and it works on Windows. All RGB information is kept. NotMyFault, is it possible for you to test a 3rd method? This also works on windows. Just open the file (download at the end) and export as a PNG. mac_experiment.afphoto Quote Link to comment Share on other sites More sharing options...
NotMyFault Posted August 30, 2022 Share Posted August 30, 2022 4 minutes ago, Lisbon said: Thank you for your feedback @NotMyFault. I only tested method 2 and it works on Windows. All RGB information is kept. NotMyFault, is it possible for you to test a 3rd method? This also works on windows. Just open the file (download at the end) and export as a PNG. mac_experiment.afphoto 3.09 MB · 0 downloads Not NotMyFault. It does work if handled correctly. Fill on alpha channels brings back the RGB pixels. I used (from memory) a wrong method in my earlier tests. Lisbon 1 Quote Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080 LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 iPad Air Gen 5 (2022) A2589 Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps. Link to comment Share on other sites More sharing options...
Lisbon Posted August 30, 2022 Share Posted August 30, 2022 8 minutes ago, NotMyFault said: Fill on alpha channels brings back the RGB pixels. Thanks NotMyFault. If neither method worked I would run out of cards to play. NotMyFault 1 Quote Link to comment Share on other sites More sharing options...
Mr. Mendelli Posted September 6, 2022 Author Share Posted September 6, 2022 I thank everyone for their input. I have this partially figured out now. I can now get the texture to show properly in my texture swapping program I am using (they're packed into a container of sorts) and they show up as they should in that program, but still render as pure black in-game for reasons that elude me. On the note of my partial progress, I think I was either misunderstanding, or this is a bug. I tried the masking method, but before revisiting this from a new angle I was masking the layer I wanted to change directly. Now with the semi-functional method I am making the mask layer it's own layer as well as placing it on top of the stack as the sample document had. I'm not sure why this makes the difference it does, but it's there regardless. Going back the the in-game issue, I believe it's a color format or color profile issue when exporting which is an entire other matter that will need to be addressed at another time in another thread if I am unable to resolve it on my own. Upon closer inspection with my texture tool, I noticed what the issue might be, though I don't know how I'd fix it. It seems the red channel is not being handled correctly. Seen here is what the original looks like in the channels preview in my texture program: ...and this is what it looks like after I make my changes and replace it: Quote Link to comment Share on other sites More sharing options...
Kuso77 Posted January 20, 2023 Share Posted January 20, 2023 I want to thank all the devs at Affinity for making Texture Packing way more convenient in Affinity 2!! I was looking for ways to texture pack using Affinity Photo/Designer a few years back. While there were some solutions, I found them to be extremely tedious - at least compared to GIMP. Did a quick search to see if my new Affinity 2 supports it and was brought here. (I found no announcement or tuts about Texture Packing in Affinity 2.) So, I gave it a shot myself, using Affinity Photo, and found it works...for the most part. I haven't fully tested alpha, but I think it has 1 somewhat superficial restriction that others apps, namely GIMP and photoshop, don't have. That is, you need alpha in order to see the RGB values. I think they are all separate and intact, but you just can't see what's there on RGB channels in any of the preview panes or the main viewport w/o having alpha there. Both black and white on the alpha channel are treated as positive (show up as white), whereas on RGB channels black is negative and white positive. In order to get a negative alpha value, you have to erase it. Anyway, so long as you don't turn the background transparent, you can go straight into Grayscale color mode, and start clicking on the RGB channels, paint and see your RGB channels display the correct colors! I basically just did the following: 1) Created a new 1024x1024 2) Changed Color mode (in the top-right in the Color pane) to Grayscale 3) Added a new Pixel layer 4) Click on Composite Red/Green/Blue/Alpha (shortcut for making them editable) 5) Exported as TGA 6) Imported as is, w/ no changing of import settings, into UE5. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.