1
$\begingroup$

When defining drivers for Material Node properties, self references the Node itself. While this may have its uses, it would be great to be able to access the object being rendered. This way you can create a single material that produces correct results for a batch of similar objects, all linking to that same material.

I'm in a situation were I had to create 40 copies of an object, all having 2 custom properties of type float. Those 2 properties are meant to control a driver defined in a material node.

The problem: that I needed to create 40 copies of the same material, reference the correct material from the correct object, and edit all drivers to change the object's name.

The process of going into all objects to edit their material slots, to copy the previous one, then unlink the previous one, then go into node editor and edit all drivers only to change the object's name is very inefficient.

$\endgroup$

1 Answer 1

2
$\begingroup$

You don't need drivers if you're using a more recent version.

You can directly access object custom properties in the Shader Editor, using the Attribute node. Set the Type to Object and type out the name of your attribute.

Example :

Have an object with a color custom attribute named color and a float attribute named roughness.

enter image description here

Using 2 attributes node in the node tree :

node tree

Control values individually, with the same material.

enter image description here

As a bonus, check Is Library Override in the custom property.

enter image description here

In a new file, link the object, Right click on it in the hierarchy > Id Data > Make library override. You can now control linked objects' custom properties, and by extension their material.

enter image description here

$\endgroup$
1
  • $\begingroup$ Just perfect. Thank you. I'm switching to this method. Blender version is 2.93. $\endgroup$ Commented Jun 10, 2021 at 12:08

You must log in to answer this question.

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