Customizing material invidually for each object with a driver

I’m trying to have multiple objects with the same material shader. I’d like to add a driver within the shader so every object has a custom property which has a value related to its distance to an Empty.

I figured out I could add a custom property driver to each object to do the calculation and call the custom property value from the shader.

Can’t seem to figure out a way where material shader calls the value of each object separately. Are there any simple solutions other than making a different material for each object?

Welcome :tada:

have you looked into some tutorials like for example this a bit older one:

How to use a driver in a shader ?

The Attribute node let’s you get values from custom properties.
If your property is set for objects, then you need to choose the ‘Object’ as type, and use the name of the custom property.

The node allows to also get values from other places (scene, view_layer, etc)… You could read about it in the manual.

Hi, thanks for the answers! Youtube tutorial seems to end where I’d like it to begin.

I added attribute node and it seems to work fine. I added custom object property and custom shader property and they work fine too.

Problem is that in this case I’d like to control image sequence node’s offset value. There is no input for that and I can’t find a way to add one. So I figured only way to control it is with driver. The problem is that I can’t fetch any data that is not linked to a single object. Tried to check “use self” with no luck. Tried different ways of formatting the property, not working. As soon as I link it to a certain object, everything works.

I try to avoid having to create 100+ variables or unique materials for every object.

Unfortunatelly, drivers or attributes won’t work in that case.

You could use Python for doing that, specially if that ‘offset value’ changes during an animation.
Can you elaborate in more detail what you’re trying to accomplish?

1 Like

Ok, thanks! I’m just tinkering around with green screened video files. 2d video planes in 3d environment. I ditched After Effects over a year ago for Blender and still testing how I should make things.

Many image sequences/videos as textures seem to be very gpu consuming on 3d-space anyway.