9
$\begingroup$

A friend of mine is creating a mint object and asked me about how I would approach creating the Life Preserver/Mint style texture.

Life Preserver

I've done similar things before with striping using a Wave Texture & a ColorRamp node, looking like this:Wave Stripes

To go for the life preserver effect I've used a gradient texture instead. This is the setup I have right now:Gradient Texture

I'd really like to use math to control the number of stripes instead of playing with the Color Ramp values directly. In the horizontal stripe setup I was able to control the amount of stripes by using the location of an empty.

If I do need to use points on the ColorRamp, thats fine, but its pretty awkward to divide 1.0 by the amount of stripes I want. (in my case I want 6, so I need 12 points on the graph).

In essence, I want to have a robust way of creating these rings via the node editor and have the rings have be the same size.

$\endgroup$
1

3 Answers 3

13
$\begingroup$

Since you don't want to correctly unwrap each new object we need a procedural shader which uses the angle from the objects origin.

enter image description here

That way you can easily displace and distort without worrying about the UV.

First we need an atan2 node to calculate the circular angle as viewed from top.

enter image description here

It is show in the red atan2 box in the node overview. You can also find explanations here. I used the nodes in the first answer. Group them into the atan2 group.

(We'd manage with a simple arctangent node from cycles, but it doesn't hurt to have an atan2 in your library and it's not that complex.)

Use the objects X and Y coordinates as input.

enter image description here

Right now the values and in the range [-pi, pi]. Let's normalize them by adding pi and diving by 2*pi.

enter image description here

After that, multiply by the number of intersections you wish, and add the modulo and greather than to get separations of 0 and 1.

enter image description here

At this point, it would be smart to group the nodes into a rings group. That way, when we make this material a single user to change the colors or the amount of sections all materials will use the same ring group.

enter image description here

$\endgroup$
8
$\begingroup$

Lazy as always, I would do this with a similar setup as that of the original question, using the Gradient texture in radial mode, and feed that as vector for a Checker texture instead.

The number of stripes can then be typed directly as scale of the checker node. Think of the value for scale as "how many times does the texture fit within the object". So you can set the precise number of stripes with ease.

enter image description here

enter image description here

$\endgroup$
0
2
$\begingroup$

Thanks to this post on BlenderArtists I've got a solution. Credit to user Secrop for his setup, though I made one tweak to make it work.

In Secrop's original post, he uses the Y as the input to the multiply node. I simply changed it to be the X. Seems to work exactly as intended.

In order to control the number of turns, you simply set the value node to be one less than the desired amount.

Fixed

$\endgroup$
1
  • 1
    $\begingroup$ This is not really procedural, since you need a correct unwrap. I've have added a procedural alternative in another answer. $\endgroup$
    – Leander
    Commented Jun 1, 2018 at 9:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .