It is currently Thu Apr 25, 2024 6:59 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: How to put masks in each color channels?
PostPosted: Sun Apr 19, 2015 9:24 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Apr 19, 2015
Posts: 15
GIMP Version: 2.8.14
Operating System: Windows
OS Version: 7 Pro, 64 bit
GIMP Experience: Intermediate Level



Hi all!

I need to create a PNG file containing masks stored in its colour channels. These masks will be used by a game engine (UE4).
The question is: How to get those masks in their corresponding channels?
It has been advised to use Decompose to separate the colour channels, and while separated one can edit them. Then once done, you put the 3 RGB channels back together with either Recompose or Compose. The problem I have with this method is that after I define what the masks should look like for each colour channel, and put it together, each of the colour channels show the same thing, just in their respective colours of course.
I would have placed an image showing what I'm talking about so you could better understand, but I was not allowed to do that :(

I attached the a PNG file (from the original TGA), if you inspect it you'll see how each colour channel stores a different mask.

Thanks in advance guys :)

Attachment:
T_Chair_M.png
T_Chair_M.png [ 24.55 KiB | Viewed 4510 times ]


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: How to put masks in each color channels?
PostPosted: Sun Apr 19, 2015 10:39 am  (#2) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
drpeppercan wrote:
I need to create a PNG file containing masks stored in its colour channels. These masks will be used by a game engine (UE4).
The question is: How to get those masks in their corresponding channels?
I do not understand. If the masks are already in the PNG image's color channels, what are these "corresponding channels" of which you speak?

Quote:
I attached the a PNG file (from the original TGA), if you inspect it you'll see how each colour channel stores a different mask.
Is this file the starting point ("masks stored in its colour channels") or the end goal ("masks in their corresponding channels")?

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: How to put masks in each color channels?
PostPosted: Sun Apr 19, 2015 11:51 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Apr 19, 2015
Posts: 15
saulgoode,

Thanks a bunch for replying :)
The "corresponding channels" are the Red, Green, and Blue colour channels.
The PNG file is the goal. I've got that file from a tutorial. The tutorial shows how to do a different thing, it does not show how to store these masks because it assumes you know how to do it. I do understand the purpose, I just can't figure out how to get my masks stored in the RGB channels, as it has been done on this PNG file.


Top
 Post subject: Re: How to put masks in each color channels?
PostPosted: Sun Apr 19, 2015 1:12 pm  (#4) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
If you have your masks in three separate PNG files, such as:
Attachment:
3-masks.png
3-masks.png [ 25.24 KiB | Viewed 4420 times ]

Open the blue channel file and then use "File->Open as Layers" to open the green and red channel files. You should end up with a layer stack such as:
Attachment:
SS-merge.png
SS-merge.png [ 7.92 KiB | Viewed 4420 times ]

Change the image mode to grayscale ("Image->Mode->Grayscale") and then run the "Colors->Components->Compose..." command to open the following dialog:
Attachment:
SS-compose.png
SS-compose.png [ 8.54 KiB | Viewed 4420 times ]

After ensuring that the "Color mode" is RGB and that the red, green, and blue layers specified in the dropdowns correspond to their "Channel Representations" in the dialog, click OK and a new image will be created with your masks in separate channels (just like the example PNG file you posted).

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: How to put masks in each color channels?
PostPosted: Sun Apr 19, 2015 8:55 pm  (#5) 
Offline
GimpChat Member
User avatar

Joined: Apr 19, 2015
Posts: 15
Thanks for such a nice explanation saulgoode.
I have been doing basically the same thing, except since I Decompose to layers on the 1st place, I don't need to import them into layers. Other than that it's the same procedure. Yet in the end my masks edits are no kept.
I did uninstall the previous Gimp along with GimpShop too just in case. Then I did reinstall the latest version. But no difference :( . Still using Recompose does nothing (and the original file is open while I use it).
I attached a ZIP file with 3 XCFs. The original, the Decomposed, and the Composed, for you to inspect should you feel inclined.

I hope we solve this mystery :gaah

DPC


Attachments:
3_XCF_files.zip [190.28 KiB]
Downloaded 112 times
Top
 Post subject: Re: How to put masks in each color channels?
PostPosted: Sun Apr 19, 2015 10:15 pm  (#6) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Since your original image has an alpha channel, you should be decomposing it to RGBA. This should produce an image with four layers, which you can then edit as needed (the following shows the layerstack with the blue channel modified).
Attachment:
SS-layer-stack.png
SS-layer-stack.png [ 6.75 KiB | Viewed 4365 times ]


Here is the final result when recomposed back to RGBA.
Attachment:
rgba-compose.png
rgba-compose.png [ 63.78 KiB | Viewed 4364 times ]

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: How to put masks in each color channels?
PostPosted: Mon Apr 20, 2015 7:40 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Apr 19, 2015
Posts: 15
Thanks a million to you saulgoode for solving this mystery!
I can finally move on!

DPC


Top
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Layer masks darkening color channels (forced premultiplied alpha?)

2

No new posts Attachment(s) Toolbox and Dialog Box for Layers/Paths/Channels, etc.

26

No new posts Attachment(s) ofn-luminosity-masks

8

No new posts Help with masks and layers please!

3

No new posts Attachment(s) New Luminosity Masks Scripts

6



* Login  



Powered by phpBB3 © phpBB Group