The alJitterColor shader is useful for applying random color variation to scenes containing many objects. In this short tutorial we will add some variation to the hue and gain of some lemons using a combination of the Utility and alJittercolor shaders.
- Start off by assigning an alSurface shader to the lemons.
- Create a Utility shader and change its Color Mode to Object. This mode uses the name of the shapes to compute the color (this is necessary because the Signal attribute of the alJitterColor shader requires a unique value per object). Change the Shade Mode to flat.
Utility shader set to ‘Object’ Color Mode
The Utility shader outputs values between 0 to 1. However, the alJitterColor input uses in values which are non float values. Therefore we will need to multiply the output value of the Utility shader to a larger number.
- Connect the Outcolor R of the Utility shader to the Input 1 attribute of a multiplyDivide node. You will also need to increase the Input 2 to a higher value. In this case we have used a value of 80.
Utility shader connected to Input 1 of multiplyDivide node
- Connect the Output of the multiplyDivide node to the Signal attribute of the alJitterColor shader.
- Connect the lemon texture map to the Input of an alJitterColor shader.
- Finally, connect the Out Color of the alJitterColor shader to the Diffuse Color of the alSurface shader.
Final shader network
Now that everything is connected correctly, we can have some fun adjusting the hue of our lemons. Before starting, reset the values of the alJitterColor shader.
- We can use the Min Gain to apply a minimum random gain to the lemons.
Min Gain: 1 (left). Min Gain: 0.25 (right).
Max Hue Offset
- We can also use the Max Hue Offset attribute to randomly adjust the hue of the lemon texture. In this case we only want to make a subtle adjustment and so a small value of 0.05 was used.
‘Max Hue Offset’ of AlJitterColor used as a hue shift for the lemon texture
Max Hue Offset: 0 (left). Max Hue Offset 0.05 (right)
That concludes this tutorial on how to use the alJitterColor shader to randomly change the hue and gain of a color texture map.