1
$\begingroup$

I am attempting to use a pattern image, however, I wish for each shape to have a different color, without it having the same color every time it is repeated. I turned the image into a mask, and fed it into the mix RGB. What could be the next step?

enter image description here

$\endgroup$
2
$\begingroup$

You cannot apply a colour to each shape because Blender has no concept of what "Shape" means in your context. If the shapes were of a set size and offset from each other, you would be able to make a mathematically accurate base layer of colour and mix that into the material matching the locations of the shapes.

But try the following and see if it gets you further in the direction you wanted to go.

Create a UV for your mesh (Unwrap) and pipe the colour from the Image Texture into a ColorRamp node that can isolate the two colours (you already did this) and gives us the mask.

enter image description here

Now create a new Texture. Here I use a quick and dirty Noise Texture but you could use almost any Texture to give you a base colour layer. You could also create an image for this purpose (*).

enter image description here

This can now be Mixed in with the Mask as the Factor.

enter image description here

And finally we Mix the initial texture back into the final result.

enter image description here

The result is imperfect, but you can tweak the Texture to try and better match the locations of the shapes.

(*) This not as silly as it sounds. You could create an image with a very low resolution e.g. 8x8 pixels and use that grid of coloured pixels as the backing colour layer.

And as always with Blender you could use Python to code a solution with shape detection, but I cannot help with that.

$\endgroup$
  • $\begingroup$ Impressive! Alternatively, could I have Blender apply a different shade of color to the texture every time it is repeated? What I precisely wish to achieve is a pattern of shapes where each shape is a different shade of Red, and I wish for the shades to be colored slightly different so no two shapes are colored exactly the same. I could make it so that the texture is black and white, with shapes colored different shades of Grey, and apply a color to them in Blender, but I wish for every texture repetition, the shade applied is randomized/changed. $\endgroup$ – H01 Feb 8 '19 at 8:37
  • $\begingroup$ You can use a Black and White or Red-Pink collection of of colour stops in the ColorRamp in the example rather than my high contrast Blue, Cyan, Green, Pink, Yellow. I used the Constant blend type in the ColorRamp also to create a strong contrast. By changing the blend type and playing with the Mapping X,Y,Z and scaling you should be able to get a close approximation to what you want.The question is how exact do you need the final result. You may be better off duplicating the image for the repeat and hand colouring the image in GIMP or equivalent. $\endgroup$ – rob Feb 8 '19 at 12:29
  • $\begingroup$ Now that I think of it, I will, Indeed, be better off creating a larger image of the pattern, with the randomized colors. Thank you so much! $\endgroup$ – H01 Feb 9 '19 at 3:33

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.