Random Color
The Random Color procedural generates a variation of color in the ranges specified by the user in the hue, saturation and value parameters. The random colors are based on the Seed parameter and the object ID of the object and additionally, it can also generate color variation per UV tile. The color variations are predictable, so with the same seed, you obtain always the same result, making it coherent in animations. Also, if you make two objects have the same object ID, you will get the same variation in both so you can also tune the result up manually.
One material and one tree with random color procedural scattered over one object
You can find this texture in the Texture Picker window > Procedurals section > New dropdown menu, with the name of RandomColor. Selecting it will open a new window with the following parameters, to configure a random HSV color:
Random Color panel
Parameters | Function |
---|---|
Blending Factor: | This is the weight of the Random Color in the procedurals stack. It also allows for blending the Random Color with a texture loaded in the Texture Picker, affecting the latter with the color variations of the former. A value of 0 means opaque (the texture loaded in the Texture Picker won’t be seen), a value of 100 means transparent (the Random Color effect won’t be seen). |
Seed: | This changes the random pattern, giving you different color variations for each object ID or tile. |
From Hue / To Hue: | Here you can define the range of values for the hue which will be taken into account to generate random colors. You can type values from 0 to 359, however, the values can also go, for example, from a minimum value of 350, to a maximum value of 20, and it will use all the values from 350 to 359 and 0 to 20. |
From Sat / To Sat: | Here you can define the range of values for the saturation that will be used. These values can go from 0 to 255. |
From Val / To Val | Here you can define the range used for the value parameter. These can go from 0 to 255. |
Randomize tiles: | This activates or deactivates the generation of random colors also in the UV repetitions (tiling). |
In the image below, you can see the configuration for a fixed saturation and value with a random hue. In this case, all the Lego pieces are using the same PLA plastic from the gallery, but the Reflectance 0 is set to Random Color.
The same material applied to five different objects
The Random Color procedural can be used in the material editor on any field that accepts a texture: color, roughness, weight, opacity, anisotropy…
Seed
The seed of a texture pseudo-random generator is a combination of the seed from RandomColor parameters and the object's Object ID. This means if you want to change them all, you can select a new seed from RandomColor, but if most are ok, and you want to change a few, you can change those object's Object ID. The objects that share the same Object ID will have the same color. For example, let’s say we want to make the fourth piece the same color as the second one, then we only have to make fourth’s object ID color, the same as the second’s one.
Same Object ID means same color variation
Playing with HSV
These are the hue, saturation and value ranges:
You can play with the minimum and maximum values to achieve different effects. In this example, we set hue values to bluish values and saturation and value from medium to high values.
Representation of the active ranges set in the panel
This would be the resulting render
You can set the “From” value to something higher than the “To” value. That would produce some interesting effects. For example, if we set the From Val parameter to 240 and the To Val to 10, it would mean the active range will cover 240 to 255 and 0 to 10. In this case, you would achieve highly contrasting values.
Notice how the Value parameter range goes around the count from the higher to the lower values
Highly contrasting Value parameters
Randomize tiles
Additionally, the random colors procedural can be used within one object to generate random colors per tile if the procedural texture is repeated.
You need to set the repeat value on Projection Properties on a value above 1. Then inside Random procedural texture mark Randomize tiles check. Then every tile will have a different value.
Random Color procedural set to rendomize tiles too
Resulting render
Other examples
The Random Color procedural can be blended with a texture to alter the coloration of that texture (this technique was used in the leaves material of trees shown in the first image above). Please, notice the Blending Factor value.
Random Color texture blended with a texture
All the examples above are using the Random Color in the Reflectance slot, however, it can be used in any texturizable parameter. In this case, we are using Random Color to set the opacity of one layer. We have the material for the mailing box, and we are adding a new layer with scratches. We want the scratches to be stronger on one mailbox than others, so not all of them look with the same amount of damage. The way to make this work is to create a Random Color texture in the opacity of the layer. As this field is monochrome, the hue and sat values can be ignored, and just use Value parameters. We set values From 50 to 180, to exaggerate the effect and make scratches really visible.
The Random Color procedural used to change the opacity of the scratches on each instance
As you can see in the image above, every mail-box has a different scratch intensity. But the scratches are in the same place on every mailbox. We can fix this with the other Random procedural texture: RandomUVs to randomize the position of the scratches texture in the reflectance channel of the material. This would be the result:
Random Color and Random UVs procedural textures combined to achieve different intensities of the scratches and different positions on each instance.