Jump to content
You must now use your email address to sign in [click for more info] ×

Recommended Posts

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

Untitled.thumb.jpg.3b67729b7f270521cc810a69c1a948a2.jpg

Link to comment
Share on other sites

@Mr. Mendelli you can reveal the content of the alpha channel in Affinity Photo as follows:

  1. Open your PNG file
  2. Show the Channels panel (View > Studio > Channels)
  3. In the Channels panel, right click the Background Alpha layer (8th layer from the top of the list) and select Create Spare Channel.
  4. Right Click the Spare Channel you've just created and select Load to Background Alpha.
  5. Right Click the Background Alpha layer again and select Create Mask Layer to create a Mask layer in the Layers panel.
  6. 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.
  7. Make sure you have the Background layer selected in the Layers panel (not the Mask layer).
  8. From the Channels panel right click the Background Alpha layer and select Fill.
  9. 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...

Affinity Designer 2.4.1.2344 | Affinity Photo 2.4.1.2344 | Affinity Publisher 2.4.1.2344
Affinity Designer 1.7.3 | Affinity Photo 1.7.3 | Affinity Publisher 1.10.8
MacBook Pro 16GB, macOS Monterey 12.6.8, Magic Mouse

Link to comment
Share on other sites

@Mr. Mendelli, that's good to hear, does it give you everything you need from the file?

Affinity Designer 2.4.1.2344 | Affinity Photo 2.4.1.2344 | Affinity Publisher 2.4.1.2344
Affinity Designer 1.7.3 | Affinity Photo 1.7.3 | Affinity Publisher 1.10.8
MacBook Pro 16GB, macOS Monterey 12.6.8, Magic Mouse

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

No problem...

Affinity Designer 2.4.1.2344 | Affinity Photo 2.4.1.2344 | Affinity Publisher 2.4.1.2344
Affinity Designer 1.7.3 | Affinity Photo 1.7.3 | Affinity Publisher 1.10.8
MacBook Pro 16GB, macOS Monterey 12.6.8, Magic Mouse

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Affinity Designer 2.4.1.2344 | Affinity Photo 2.4.1.2344 | Affinity Publisher 2.4.1.2344
Affinity Designer 1.7.3 | Affinity Photo 1.7.3 | Affinity Publisher 1.10.8
MacBook Pro 16GB, macOS Monterey 12.6.8, Magic Mouse

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

I'm not sure if this helps?

 

Affinity Designer 2.4.1.2344 | Affinity Photo 2.4.1.2344 | Affinity Publisher 2.4.1.2344
Affinity Designer 1.7.3 | Affinity Photo 1.7.3 | Affinity Publisher 1.10.8
MacBook Pro 16GB, macOS Monterey 12.6.8, Magic Mouse

Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
Share on other sites

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.

rgb.jpg.ac18480ac13fe8e727fbd78301e4ffcd.jpg

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.

alpha.png.aa766dea976829ad96f35202929bc9a1.png

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

PT.png.3da491c709f8ca7173ecfb48738768db.png

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.

Link to comment
Share on other sites

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 by NotMyFault

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

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

Link to comment
Share on other sites

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.

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

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:
unknown.png

...and this is what it looks like after I make my changes and replace it:
unknown.png

Link to comment
Share on other sites

  • 4 months later...

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.

2023-01-19_22-52-59.png

 

 

UnrealEditor_2023-01-19_23-12-51.png

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.
Note: Your post will require moderator approval before it will be visible.

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.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.