One Material, Multiple Meshes, Different Colors?

Hey,

I just started a project width a lot of colored pencils in it.

As I want to have all of them have the same Material, but a different color, i came up with the question:

Is there a way to create a single Material und assign different colors to meshes that all have this one material assigned?

Or:
Is it possible to link the materials of the pencils, so if I tweak one of them, the rest will have the changes applied, too?

Any Suggestions?
:slight_smile:

there are quite a few ways to get this done…
If you don’t care about which color each pencil gets, then you can plug the ‘Object Info::Random’ into a ‘Color Ramp’ made with the colors you want to use.

For more control, you can use a secondary UVmap for all the pencils, and a texture as color table; or enclose the material into a node group with the color (and any other value you want) connected to an input socket.

3 Likes

You can actually specify the colour using the Object Info node too. If you use the Object Index property instead of random - then set the Pass index of each object - you can actually specify which colours in the colour ramp each pencil should get:

(note the divide math node is required because the colour index in the colour ramp runs from 0-1, whereas the object pass index is generally >1. The divide normalises the pass index into the 0-1 range and should be set to whatever your maximum pass index is - in my case 4.)


2 Likes

I’m interested on this topic, hope is not too late… I’m having the same issue with a material I want to apply on several oil barrels. I have baked the textures from the original procedural shader and then edited it to get 4 colors for the barrels. So basically my idea is to assign 4 color textures in 1 single material and select wich one goes for each barrel. I couldn’t figure it out yet… hope to get some help here. Thanks

Hi there,

So, say, you have 4 colours and 4 barrels. It is one object, you can use the random per island option from the Geometry node. Or, you can vertex paint the barrels separately, to any colour, like R G B and a fourth one, and use those as attributes to mask out the 4 different colour textures. Or, simply assign the colours as separate materials, I guess :slight_smile:

It really depends on your object setup, I would say. But you have various methods to randomize the same material between separate objects for sure.

Cheers!

2 Likes

Thank you for your answer, I’m working on a kinda complex animation with lots of meshes and materials, so I’m trying to optimise it to save render times in cycles (my hardware is not that good, but can handle it). Anyway, that includes reducing the materials to the lower number as possible. I will try this right now!

Thanks!

1 Like