Modifying Pre-Built Texture Maps For Games
In this post I will be modifying some of the pre-built textures that I’m using for my current Unity project, so that I can change the color of the objects.
Today’s Objective: Modify the texture images used by the structural models, to remove the color, and allow me to set the color tint in engine on a per-material basis.
Finding the textures:
The texture file can be found by working back from the model in the scene.
Model’s MeshRenderer Material -> Material Base Map/Texture -> Texture file.
Changing the color of the texture:
The default textures of the models I am using are already colored in an orange-ish color, which I would like to change.
While I could change the color by changing the Base Map color property on the material like this:
It may work on this occasion, but if I want to make the model grey, I cant:
It still has the orange undertone present, so it can never be true grey.
To correctly modify the texture color, allowing for greys and true colors not influenced by orange, I must open it in an image editing program. I am using GIMP in this case.
The first step is to completely desaturate the image, removing all color but keeping the lightness of the texture.
Depending on the texture, you may also choose to modify the contrast to better suit the texture while you’re here.
Now save the file. If you’re confident about being happy with this result, you can override the original texture, otherwise save it as a copy of the original texture.
If you saved as a copy, you’ll need to change the material’s texture when you go back into Unity:
Now the color of the Material and model can be modified via the Material’s Base Map color, and it will not be influenced by any color, only the texture’s lightness value (white <-> black).