1

I am trying to make a RGB mask for game development purposes using GIMP. I am trying to add a gray scale mask to the red channel and then a different gray scale mask to the green channel. So that the game engine can read different values from different channels. This is useful because one can then use one texture for three different applications for example Ambient Occlusion data in the red channel, roughness values in the green channel and metallic values in the blue channel.

Unfortunately when I paste something into a selected channel it gets pasted into all the channels. When I try to erase something from only one selected channel then it erases it from all the channels.

Not sure what to do but, I will appreciate any help I can get, thank you.

1

If you are developing the Game Engine yourself, I'd suggest you to use the OpenRaster ".ora" file format, and different layers to convey the needed information.

In the likes of LibreOffice's Open Document Format, OpenRaster is a specification to allow standardized exchange of rich-raster images, including multi-layer information. It is used by GIMP, Krita and MyPaint software to exchange images (and the later program even uses that as its native file format.)

Each OpenRaster file is a zipped directory containing a XML file with the digest description and one .png file for each image layer - therefore you can convey an arbitrary number of dimensions in a single image file - all you need is to have your game engine to fetch the png files from within the zipped ".ora" container.

That said as a general advice, GIMP can easily allow you to modify any combinations of the R, G, B and Alpha channels: on upper half of the channels tab (the second tab just after the layers dialog on the standard configuration, or Windows->Dockable Dialogs->Channels to activate it from anywhere), just unselect the channels you want to protect from change.

By default, and almost all the time, the 3 or 4 channels are visible and selected. Click on them on this dialog to unselect them - for example, if you want to paste something to the Red channel exclusively, unselect the Green and Blue channels, make your paste as usual, them select them back to allow these other channels to be changed. These modifiers apply to all layers on the image at once.

Be aware that selecting and unselecting these channels is a distinct action from toggling their visibility - which happens by clicking on their "eye" icon.

(You can also create extra channels that are grayscale drawables, usually copy of selections - those will show on the bottom half of this dialog, and are an entirely different thing - don't bother with them)

0

Probably your best bet is to open a new image, then use Colours > Components > Decompose. This will turn the channels into editable layers named red, green, blue, and open the result as a new greyscale image in a new tab for you to edit.

Once you have finished editing these layers, click Colours > Components > Recompose, and the other image open in the tabs along the top will update.

Here's a screenshot showing each channel with different content, edited using decompose then recompose. Obviously if you want masks, you'd need to invert each of the RGB layers, like this example.

enter image description here

So if you wanted to erase something from one channel, all you need to do is paint over it or fill it in black.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.