How To/Use GIMP to create a PBRMetal parameters image
This tutorial demonstrates how to create a PBRMetal parameters image within GIMP.
GIMP (GNU Image Manipulation Program) is a free image painting program available from the GIMP website. The version used for this tutorial is GIMP 2.10.2.
This tutorial only discusses the use of uncompressed Targa (TGA). These files use 8 bits for each channel so a RGBA texture would have 4 * 8 = 32 bits per pixel. Trainz will accept PNG files and PNG files may work with this process.
Using your own images
This assumes you have your own images for use in the:
- Red Channel - Emissive
- Green Channel - Roughness channel
- Blue Channel - Ambient occlusion
- Alpha Channel - Metallic
These files should all have the same dimensions, the same size as the target parameters file, and correctly sized for Trainz purposes.
Four images are provided for tutorial purposes and can be found in File:GIMP-parameters-tute-images.zip:
For convenience, the file names reflect the channel id and the type of texture. The emissive and ambient occlusion textures are plain colours but the roughness and metallic have shades of grey. Here is how the channels look in Images2TGA:
- Start GIMP. You will need the Layers and Channels windows open. If those windows are not visible then look in the Windows drop down menu -> Dockable Dialogs (or Ctrl L). You may also find it useful to run GIMP as a single window. (Windows->Single-Window Mode)
- Select the Layers tab. It should be empty.
Load the channel images
- Use the "Open as Layers" control (Ctrl+Alt+O) to load the red (emissive) channel image. The emissive image is displayed.
- Repeat for the green (roughness), blue (AO) and alpha channel (metallic) images.
- On completion, the GIMP window should look like the following. The four "channels" are loaded as layers and the channels of the image are the product of those layers. The channels will be black for this example.
- The order of the layers is not important.
- Save the data as a new image in XCF format. This will preserve the layers. Use a name like working_parameters.xcf or whatever suits you.
Composing the channels
- Use the Image->Mode->Grayscale command to change the image to greyscale. GIMP will change to a single channel called Gray plus an alpha. The Gray channel will probably be black.
- Open the Compose Channels dialog using the Colors->Components->Compose command. You may want to widen the dialog box as the filenames can be long.
- Change the Color model to RGBA.
- For each channel change the link to the appropriate input file. After this the dialog should look something like the following:
- Select OK and a new image is created and should look like the image below. GIMP treats the image as being partially transparent due to the alpha channel.
- Make sure the parameters image is selected and export as a TGA uncompressed or PNG file.
- The exported image should look like the following image as shown in Images2TGA.
Making an Emissive channel in GIMP
Rather than making an emissive image you can manufacture it within GIMP. This can be useful if you want zero emissive (black) or some self illumination (greys), See M.pbrmetal for more information.
- Instead of importing an emissive image create a new layer and fill the background with the colour of your choice.
See also: M.pbrmetal