In this tutorial, we will use the versatile Utility shader to generate random colors for the sprinkles on a donut. We will then use a variety of MAXtoA shaders to further adjust the colors of the sprinkles.
|A simplified scene file can be downloaded here.|
- Start off by creating a Standard Surface shader and rename the shader 'Sprinkles'. Assign it to the sprinkles.
Utility Shader - Color Mode
- Create a Utility shader and connect it to the Base Color parameter of a Standard Surface shader. We will use the Object Mode of the Utility shader to add random colors to the sprinkles. This mode uses the name of the shapes to compute the color.
- We don't want any shading from the Utility shader as we are already using the Standard shader, so change the Shade Mode to flat. 'Flat' renders the model as a pure, solid, flatly lit and shaded color.
Utility Map connected to Base Color of Standard Surface shader
Random - Seed
We can use the Random shader to create variations of color for our sprinkles.
- Create a Random shader and connect it to the Base Color of the Standard shader. Connect the Utility shader to the Input Color of the Random shader.
- Change the Seed parameter number. You should notice that the color of the sprinkles randomly changes.
Random's 'Seed' parameter animated (Utility shader set to 'Object' mode)
We can also use the Composite shader to mix in another color using a blend mode.
- Delete the Random shader and create a Composite shader. Connect it to the Diffuse Color parameter of the Standard shader. Connect the Utility shader to Input A of the Composite shader.
- Change the Operation parameter of the Composite shader to multiply and change the Input B color to orange. You should see that the colors of the sprinkles now have an orange tint to them.
Change B color to orange and Operation to 'multiply'
Color of sprinkles tinted with an orange color using the 'multiply' operation of the Composite shader
Another way to change the colors of the sprinkles is to use a Color Convert shader.
- Delete the Composite shader and create a Color Convert shader. Connect it to the Diffuse Color parameter of the Standard shader. Connect the Utility shader to the Input parameter of the Composite shader.
- Try changing the color space to see the effect it has on the color of the sprinkles. In this case it was changed to xyY.
Color space converted to xyY
Once you are happy with the general colors of the sprinkles, you can use a Color Correct shader to further fine tune their appearance.
- Create a Color Correct shader and connect it the Diffuse Color parameter of the Standard shader. Connect the Utility shader to the Input parameter of the Color Correct shader. You can adjust the Exposure and Multiply parameters, for example, to add more variation to the color values.
Fine tune the colors using a Color Correct shader
That concludes this tutorial. Have a go at experimenting with some of the other MAXtoA shaders to create some different variations of color.