In this tutorial, we'll see a way to quickly change the hue of a Texture on an object, allowing us to create multiple copies with different colors.
Video Transcript
Hello everyone!
In this tutorial, we'll see a way to quickly change the hue of a Texture on an object, allowing us to create multiple copies with different colors.
We will accomplish this without having to modify the original Texture image and without having to create additional materials, but by starting with just one Material and using the Object Index field of the different copies.
This tutorial was made using Blender 3.6.
Alright, let's get started! On screen, you can see a Blender scene in which I've imported my 3D model as it appears right after downloading.

There are two objects that share the same Material and the same set of PBR Textures.
Specifically, the Base Color Texture colors the main body and the tip of the highlighter yellow, using UV mapping. If I duplicate these objects to get more highlighters, I obviously get more yellow highlighters.

To change the colors of the copies, there are many ways, some more suitable than others depending on the circumstances. In this particular case, the color to be changed is uniform, and most importantly, the rest of the object is black, so we can use the Hue Saturation Value node to change the hue of the Base Color Texture. Let's see how to do it.
In the Shader Editor, I add a Color HSV node between the Base Color Texture and its input to the PBR node. This node is a simple PBR node that I've used in many of my 3D models, and it can be easily replaced by the Principled BSDF node. Don't be influenced by its presence here.

By adjusting the value of the Hue field between 0.0 and 1.0, we can change the hue of the Texture in the colored areas, leaving the black parts unchanged.

However, this way, we will alter the color of all objects created by duplicating the original, as these copies will share the same material.
For each copy we can assign a numerical value called Object Index or Pass Index. We have just to select the body of a highlighter, open the Object tab in the Properties editor, then change the value of the Pass Index field within the Relations section.

I perform this action for the other copies as well. Obviously, objects sharing the same numerical index will also share the same color. There's no need to adjust the Pass Index for the highlighter caps since those objects are entirely black.
The Pass Index value of an object can be retrieved, within the Shader editor, using the Object Index output from an Input Object Info node.

However, the value output from the Object Info field will be an integer greater than or equal to 0, while what we need is a value between 0 and 1 as the input for the Hue field of the HSV node.
Well, no problem! Blender provides us with a couple of nodes that allow us to reduce the values we set to a range from 0 to 1.
We can use, for instance, a Converter Math node in Divide mode, dividing the value coming from the Object Index by the maximum value we set for the Pass Index.

We can also use a Converter Map Range node and set the max Pass Index value in the From Max field. The effect will be the same as the Math Divide.

Of course, we can also use different values for the division or mapping, resulting in clearly different colors.
In this respect, the Map Range node offers an advantage, as it allows us to limit the mapping to a narrower range of values. Look at what happens, for instance, if I set the To Min and To Max fields to 0.0 and 0.5, or if I set them to 0.5 and 1.0.

In summary: we can change the hue of a single image Texture applied to multiple objects using a numerical value, called the Pass Index, freely associated with the copies of the original object. This way, we can obtain objects with different appearances but originating from a single Material and a single set of Textures.
I hope this tutorial was helpful to you! See you soon!