1
$\begingroup$

I know how to share a material among different objects, customizing it by using the ObjectInfo node. I want do something similar but replacing the ObjectInfo node with a custom property (different for each object, and animated with an F-Curve) that the material can automatically read as input.

How could I do this? Adding a custom property to the object? How would I access it from nodes? Could the ObjectInfo node be enhanced to support this custom property (as well as random, object index, location, material index)?

$\endgroup$
  • 1
    $\begingroup$ Does this help? blender.stackexchange.com/questions/40634/… $\endgroup$ – Ray Mairlot May 8 at 17:28
  • 1
    $\begingroup$ What kind of property do you need? Integer, float, vector? $\endgroup$ – Jaroslav Jerryno Novotny May 8 at 18:15
  • $\begingroup$ I need a float, in the range [0.0, 1.0]. The following answer would work, but I was hoping for an easier way (e.g. augmenting the ObjectInfo node with a custom property). blender.stackexchange.com/questions/72101/… $\endgroup$ – Dazotaro May 8 at 18:21
  • $\begingroup$ @RayMairlot That link does solve my problem using drivers. Thanks for your help. $\endgroup$ – Dazotaro May 8 at 18:33
  • $\begingroup$ You could hack the Object ID property, the maximum is 32767 so that would give you 1 / 32767 = 0.00003 precision in [0,1] range. For real floats you can use vertex colors, but that is bigger workaround. The ultimate would be to script your own cycles node, but you would have to distribute that as an addon to everywhere you want it to work. It's also a lot more work. $\endgroup$ – Jaroslav Jerryno Novotny May 8 at 18:34
3
$\begingroup$

There are not that many options how to input unique data of each object into a shader node tree.

There are vertex colors, hacking UV coordinates as numerical input, and outputs of Object Info node. There is also an option of scripting a custom Cycles node.

Because you need float in range <0, 1>, using the Object Index seems feasible. It's an integer with max value of 32767, which scaled into 0-1 range gives you 1/32767 of precision (0.00003), which is not bad. This is how you'd use it inside your material:

enter image description here

This is the property to animate for each object:

enter image description here

Just multiply your value with 32767 and round it.

$\endgroup$
  • $\begingroup$ This is exactly what I needed. Thanks. $\endgroup$ – Dazotaro May 8 at 21:48

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.