Procedural Repeating Rainbow Stripes Material - Help?

With Pride month starting tomorrow I’m thinking of posting something for it (yeah, I’m running a bit behind :flushed: ). The objects will be UV mapped similiar to the example objects (edge-to-edge on X), and although the material will be procedural, I intend to use the UV mapping.

Using a Wave node to get the Color Ramp to repeat four times, I expected the scale to be something like 4, or 2, or .5 – you get the idea. Instead it turns out I needed to set the scale to 1.25664 :

PrideRainbowMaterialTest003.blend (1.1 MB)

Although I used the Mapping Node Scale for this, it does the same thing if I use the Wave Node’s Scale instead. And I’ll go with it if need be, but given how counter-intuitive the value is I feel like I’m missing something I should be doing. Any help?

2 Likes

I think what you’re seeing is 1.25 with floating point errors, which does seem loosely correlated to 4 repetitions :thinking:

you could just forego the wave texture entirely and directly map from your UV coordinates:

1 Like

Okay, I’ll bite: how does 1.25, however loosely, correlate to 4 repetitions? :confounded:

I notice your Multiply value is 16.8 – again, the value needed to get a specific number of repetitions of the Color Ramp is a weird decimal. Without the Wave node, getting just one repetition reasonably exact took a Scale of 2.1212. I’m trying to figure out why this is taking such odd scale numbers to get whole repetitions of the Color Ramp.

1 Like

Looks like the wave texture has a pi factor in there somewhere, at least it looks like 3.14159 repetitions to me:

4 Likes

and if you scale it by pi, you get exactly 5 waves… per each half:

2 Likes

Sorry, that weird number was my bad, if you set that to 1, you get one repetition:

2 Likes

And π multiplied by 0.40 gives four repetitions of the Color Ramp, looks exact:

Yep, it’s π. You get the checkmark – thanks! And for anybody wondering? Yeah, it’s for the ducks.

2 Likes

In the color ramp click the menu button (the v between the - and the RGB and select Distribute Stops from Left. Then you can see the 7th color too. Look at SterlingRoths Color Ramp.

Good advice, but in this case the six color showing are what I’m going for – as set, the fuschia on the last stop will only show up under a few “something’s-wrong” conditions.

1 Like

Hey, that’s a good tip! I just typed in 1/7, 2/7, 3/7 etc. in the position box for each stop, which is just a little annoying!

1 Like

My error. Never absorbed the reality that the Pride Flag is only 6 colors.
Thats my lesson for the day. :nerd_face:

1 Like

Currently six colors – it’s had more, including a fuschia-like pink.

1 Like