2
$\begingroup$

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?

$\endgroup$

3 Answers 3

1
$\begingroup$

Use an Object Info node, connect the Color output to the Principled (or other material node) node.

Then, assign the color for the object from Object Properties > Viewport Display > Color. It works both on viewport and renderings. Very practical and without strange workarounds.

$\endgroup$
6
$\begingroup$

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.

$\endgroup$
2
$\begingroup$

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
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .