I got the following set-up Multiple materials

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:

enter image description 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)

enter image description here

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.

  1. Go the Node Editor
  2. Select all Nodes except the Node you want to be flexible, in this case every node except the Color Node
  3. Hit Ctrl+G
  4. Hit Tab to toggle between the general node view and group node
  5. 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.