Resource:Using pallettes for recoloring in Fallout 4

Using pallettes for recoloring in Fallout 4 is a resource guide written by Ajhakra.

Info
Before starting, I, by no means, am an expert in this subject and I actively encourage those who are more experienced or have more knowledge to step in and contribute to the page.

In Fallout 4, Palette textures/files essentially act as colour Lookup Tables(LUTs). These allow us to have multiple texture variants, without the need to have a separate texture set for each variant, i.e allows us to have multiple colour options using a single texture set, saving on file size.

Understanding the Palette File
As mentioned before, palette files act as LUTs in Fallout 4. These allow us to select certain colours from the palette files, using a coordinate system, in order to colour our textures the way we want them.

From experience, these maps are limited to a horizontal size of 256 pixels. This is because each pixel will be mapped to a value on greyscale colour range, which ranges from 0-255(256 options total). Think of this as the X coordinate in a graph.

For the Y coordinate, this is specified using the "Grayscale To Palette Scale" value in your material file, or using the "Color Remapping Index" value in a plugin material swap.

<>

Using the above image as an example, we'd calculate this value as per below:
 * Get the number of colour sets in our palette,
 * 10 in this example
 * Divide 1 by the number of colour sets,
 * 1/10=0.1
 * This value would indicate the range of values that we can use for each colour set,
 * E.g If we want to reference set 1, we'd set the "Grayscale to Palette Scale"/ “Colour Remapping Index” to a value between 0.0 and 0.1. To reference set 2, we'd use a value between 0.11 and 0.2. Set 3 0.21 to 0.3 etc

Using the Palette File
Now that we’ve got a brief understanding on how the palette file works, how do we functionally use it in-game?

First for the easy bit, enabling it in our material file. Simply enable the “Grayscale to Palette Colour” option as shown below:

<< INSERT BGSM MATERIAL EDITOR IMAGE>>

This will enable our material file to start using our palette map.

Secondly for the slightly more difficult part, setting up our Diffuse texture correctly. For palettes to work correctly, your diffuse must purely use greyscale as these will be the colours getting mapped to our palette image. Colour can be present here, however, there are no guarantees that it will map correctly, and the colour in your diffuse will not be used in-game.

As mentioned above, we can use the greyscale value of a pixel in our diffuse map to map it to our palette file. Using a cutout of a diffuse texture file as an example, we’ll walk through it.

<< INSERT DIFFUSE IMAGE WITH GREYSCALE VALUES>>

So as shown above, we have 3 greyscale values that we are using for different parts of the diffuse. This is what we’ll be using to map each greyscale value to a colour in our palette file

Main Colour - 229 Colour Scratches - 255 Lettering - 30

This would map to the colours shown using the below vertical cyan lines:

<< INSERT PALETTE IMAGE WITH MAPPED LINES>>


 * Lettering - would result in it being white, regardless of our  "Grayscale to Palette Scale"/ “Colour Remapping Index” value.
 * Main Colour - would result in the colour change that we are looking for. The exact colour chosen would be dependent on the "Grayscale to Palette Scale"/ “Colour Remapping Index” value.
 * Colour Scratches - would result in the scratches being black, regardless of our "Grayscale to Palette Scale"/ “Colour Remapping Index” value.

In-game Examples
Using all of the above information, we can now show off some in-game examples of this

For the first image, the below values are being used: Main Colour - 229 Greyscale Colour Scratches - 255 Greyscale Lettering - 30 Greyscale "Grayscale to Palette Scale"/ “Colour Remapping Index” - 0.35

<>

As we can see, this rightly results in us getting a yellow gun, with “black” scratches and white lettering. Note that the scratches do not show as black due to our specular map being setup to make these scratches more specular/glossy

For the second image, the below values are being used: Main Colour - 229 Greyscale Colour Scratches - 255 Greyscale Lettering - 30 Greyscale "Grayscale to Palette Scale"/ “Colour Remapping Index” - 0.35

<< INSET WHITE GUN IMAGE>>

As we can see, this rightly results in us getting an off-white gun, with “black” scratches and white lettering. Note that the scratches do not show as black due to our specular map being setup to make these scratches more specular/glossy

And finally for the 3rd example image, the below values are being used: Main Colour - 229 Greyscale Colour Scratches - 255 Greyscale Lettering - 30 Greyscale "Grayscale to Palette Scale"/ “Colour Remapping Index” - 0.35

<>

As we can see, this rightly results in us getting a black gun, with “black” scratches and white lettering. Note that the scratches do not show as black due to our specular map being setup to make these scratches more specular/glossy, whereas the main slide is setup to be less specular.

License
This tutorial is under Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)

Credits

 * Ajhakra for transcribing and testing this.