Random distribution of pre-defined Color Ramps

Hello everybody,

I know that it is possible to assign random colours to objects in Blender, but do you know if there is any way to assign user-defined Color Ramps randomly to a group of objects?

I have three colour combinations and I want to distribute them randomly, but using the MixRGB nodes with Object Info (Random) as Fac mixes the colours instead of keeping the colours I chose. Would you have any idea for this?

Thank you!

why don’t you use a ColorRamp?

Yes, I’m doing it! I didn’t explain properly myself hahaha

The thing is, that I need to put different combinations of colors, for example:
— Object 1: Red and blue
— Object 2: Red and yellow
— Object 3: Blue and yellow
— Object 99: Blue and red

For each combination, there’s already a Color Ramp with an image as an input (to tell which parts are in red and which are in blue). I need to randomly distribute these Color Ramps between the objects, and there’s where I have troubles.

can you show nodes set up!

there is a random value on one of the nodes
i think it is object info node

happy bl

1 Like

How many different color ramps are you using? It seems like this could get very complicated, very fast (“Object 99”).

If you have 99 different combinations, I would probably do this via texture lookups instead. It would be easier, assuming you’re doing linear (or constant) RGB interpolation on your color ramps. And that way, you need 2 texture lookup nodes, with a little bit of infrastructure, instead of having to mix between 99 color ramps.

If I wanted to use object info.random as lookups on a texture, but I wanted them in discrete chunks, no mixing, I would use a map range node on stepped linear mode. For example, object info.random -> map range (stepped linear * 99 steps) -> combineXYZ -> image texture.

1 Like

I needed to use maybe four or five color combinations (each combination is composed of two colors, with an image texture indicating how to map them) distributed randomly in a large number of objects. So, there are few combinations but lots of objects, the ideal would be to assign this combinations in a random way.

I will see slowly this option you’re mentioning as it seems new to me! It sounds pretty useful.

Thank you all!

Like this?

1 Like

Shader efficent way would be not to use Blender ramp generator, but prepare ramp atlas outside Blender eg. In Photoshop
with ramp strip on top of each each other and have shader that pick random ramp strip by random

1 Like

That was exactly what I needed! Huge thanks!