My goal is to have these balls all the same material, but with a different colors. I don't want to rely on some random value; I want to assign on my own which object gets a particular color. How to accomplish this?
You can use the Pass Index to discriminate between objects with the same material.
- In Object Properties > Relations, assign a Pass index to each object, between 1 and [ your number of distinct colors ]. You can assign the index to multiple selected objects by right-clicking the Pass Index field on the active object, and choosing 'Copy to Selected'.
- Replace the RGB node in your tree with the nodes illustrated here:
The Divide is just to map the range of integers to 0.0 .. 1.0 for the color ramp, and the subtract nudges the point to make the tabs in the color ramp easier to place)
If you need the Pass index for something else, you can drive a Value node from a Custom Property, but that's not quite so convenient to assign.
By making a Group Node you can easily adjust specific inputs.
- Go the Node Editor
- Select all Nodes except the Node you want to be flexible, in this case every node except the Color Node
- Hit Ctrl+G
- Hit Tab to toggle between the general node view and group node
- Now you can use this group node in your other materials, and adjust the color per specific material. If you make adjustments to the group node itself it will be applied to all other materials