2
$\begingroup$

I wonder if maybe the Attribute node in Cycles can bring in a Custom Property of an object.

I have a model that has an LED light, and I wish I could change the color of the LED on different instances of the model, without using different materials.

Custom property

Atrribute node

$\endgroup$
2
$\begingroup$

An alternative to using the pass ID is using the object name and an OSL script. It is not very elegant either, but at least allows for setting multiple values. I have explained it here.

$\endgroup$
  • $\begingroup$ I upvoted your post. However, including a summary of the method (copy paste it maybe) would be great. $\endgroup$ – Leander Sep 1 at 16:50
1
$\begingroup$

Use the object's pass ID.

That's a less than elegant, jerry-jigged way of doing it, but I've managed to animate the emission of some cartoon stars independently with this, even they're sharing the same material.

shader nodes

I collect the objects pass ID with the Object Info node, then perform some operations on it so I can operate under an arbitrarily defined range of 100 to 110. You can use any range you want. Notice I have only 10 different brightness levels on my shader. If you need something smoother, get yourself a wider range.

After doing that, it's just a matter of setting the object's pass IDs and the material will react accordingly on a per-object basis. You can even animate them by hitting I on the pass ID field.

This approach has lot's of limitations, though:

  • You'll waste some pass ID channels on this, and you'd better not use them elsewhere. Make sure you have them marked as used if you're on a larger project.
  • You have a single channel to transfer information, so no complicated things like colors can be properly and freely animated.
  • Also, the pass ID is an integer, and that means either using a large enough range if you need fine detail or going for a coarser animation.

But it's the best I've found until now.

$\endgroup$
0
$\begingroup$

There's a patch that adds exactly this functionality in the works:

https://developer.blender.org/D2057

$\endgroup$
  • 2
    $\begingroup$ note that this has been in the tracker unchanged since juli 2016. $\endgroup$ – zeffii Oct 14 '17 at 19:12

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.