1
$\begingroup$

In blender is there any way to cycle through colours in an image. For example here is an image with 4 distinct sections of different colours.

enter image description here

enter image description here

How could a setup be made so that it recognises red in the top left? Now the red is at 0% on the color ramp so over 10 seconds it would cycle through the colour ramp until it got to 100%. Then in the next section, it would recognise the green is roughly at 66% of the way through the colour ramp. So over 10 seconds it would cycle from 66% to 100% and then from 0% to 66% of the colour ramp so it returns to its initial colour at the end of the animation. And so on for the other sections.

Also, as the white and black have the values rgb(255, 255, 255) and rgb(0, 0, 0) they should not be affected.

I tried using RGB curves connected to the picture and keyframes to achieve this effect, however, it proved unsuccessful.

$\endgroup$
  • 1
    $\begingroup$ Do you specifically need a texture? This would probably be a lot easier to achieve with a separate text object overlayed over a plane object divided in four $\endgroup$ – Duarte Farrajota Ramos Mar 31 '17 at 22:43
  • $\begingroup$ @DuarteFarrajotaRamos Unfortunately I do. The image I used for this question was just an example. The actual image texture I am working with has about 80 irregularly shaped sections all of different colours with a variety of white markings over the top of it. I used text in this example as it is irregular and it covered parts of all four sections $\endgroup$ – Dan Mar 31 '17 at 22:48
2
$\begingroup$

You can animate the hue. Here's a setup I used some time ago. The hue is cyclic, and often represented by 0° to 360° on a circle, but in Blender it is represented by a value between 0 and 1. Greyscale values, including black and white, will not change by this, because they are completely desaturated.
Further explanations of HSL and HSV on Wikipedia

enter image description here

The Separate HSV and Combine HSV nodes separates a colour into Hue, Saturation and Value and combines Hue, Saturation and Value into a colour. They are located under Converter in the Add menu.

Modulo makes sure the hue never goes above 1. It's a Math node, also located under Converter. However, it doesn't prevent values from becoming negative (specifically, it keeps the value between -1 and 1). The Less Than node (also a Math node) followed by the Add node take care of that, by adding 1 if the value gets below 0. The reason I do not simply select Clamp in the first Add node, is that that would make the cycling stop at 0 if the value became negative and at 1 if the value became greater than one.

Now, animate the value marked with a red rectangle.

enter image description here

Here's a .blend, but I stripped it of the texture I used for the gif above.

UPDATE: The above will make the cycling linear in the positive direction on the hue circle. To make it go the other way, change the first Add node to Subtract. And below is a setup to get more control, for example to make the cycling go back and forth or non-linearly.

enter image description here

The Value node is the one to animate in this case. It's available under Input in the Add menu. The RGB to BW node (available under Converter) isn't strictly necessary; I just added it for clarity, though plugging an RGB into a single value socket, does this conversion automatically.

The output from the ColorRamp node is what gets added to or subtracted from the hue, so by tweaking it, you can make the cycling happen virtually any way you please.

Updated .blend

| improve this answer | |
$\endgroup$

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.