Hoping someone can help me with this. I’m trying to create procedurally generated stripes of uniform width around the Z axis. I’ve tried a hundred and one different node combinations and just cant get it to work and can find no reference to a method online.

I can create the stripes individually and layer them but this is messy and not suited to animating the texture. The ability to set the number of stripes is required.While that can be achieved with the radial gradient method,it unfortunately does not produce stripes of uniform width.

I’m guessing it may involve modulating around an axis but i’m not sure if thats even possible and maybe I’m just over thinking it now. Any help greatly appreciated.

See attached. To messy to try to explain. It supports up to ten spikes, if you want more then it should be self explanatory how to do it. Although it still uses some “layered approach”, animating it should be easy given the exposed nodes. Although it might be possible, I can’t think of a way to achieve this without code flow and loop nodes. To locally optimize, if you’re doing only 3 spikes you can take out the result earlier in the chain. CountMax is forced integer, so can’t animate count fractionally.

So again, guaranteed not the best way to do it, but might put ideas into your head that might get the job done.

Cheers Carl. Got stuff to do today but will go at that tonight as soon as I can. Will get back to you.

here’s a simpler version. It allows any number of stripes, with any width:

The center will be at coordinate[0,0,0] and you need to feed some coordinates in it.
Just a note: since I used the dot function directly on the vector, this node will not work very well in 3D objects (where Z<>0).

To correct that, you can use the Mapping Node, not only to scale Z to 0, but also to control rotation.

Edit: to be more precise in getting exactly the first post example, you can change the last node from ‘less than’ to ‘greater than’. That way, stripes will be black and the background will be white

if these are rectangular then it is not really radial anymore!

radial would be like the first pic on the left!

but nice to see a way to do a rectangular one with proc text!

could also be done with spin tool I guess for real mesh

happy bl

Use Secrops version, looks 1000 times better than my crazy setup I was hoping he’d show up and show how it’s really done

for making the left picture you can use this example and thanks to secrop and carl for the other versions

there are some problems with my equation that only now I’ve notice. I’ll try to fix this as soon as possible and them i’ll tell you the path i took to reach this result, and hopefully to the correct on.

Hello all, sorry for delayed response.
@CarlG, Thats one serious setup, and while Secrops approach might suit me better you’ve given me a lot to look at and take advantage of in other circumstances. Going to take me a few evenings to fully pick it apart I think. Much appreciated,cheers.
@Secrop, As I am probably only mapping to a planer object, you’re method should be perfect for what I neeed. I understand (for the most part anyway) what your doing but an explanation would be great as I dont fully understand what the dot product does. Many thanks for this.
@BennyG, There are I suspect a number of ways of creating the left image, the method I used is very basic and only uses 4 nodes. You’re method is interesting and far more useful for more complex situations. Something more for me to play with.Cheers.

The setup I’ve posted has a small flaw… While using more than 5 rays will minimize the distortion to 0, having less than that will start to make the center a bit shrinked…
I figured the problem but the solution is far more complicated and slower… So if just 3 or 4 stripes, and you want the corners straight, CarlG’s setup is better. Otherwise use mine setup.

In the setup, the top part is where I create the stripes, by multiplying the radial gradient by 2N for N=number of stripes. (you may want to have the node wrangler on for looking to is step by step)
The radial gradient has a range that goes from 0 to 1 and uses the origin of the coordinate system as center; after multiplying it becomes a radial from 0 to 2N.

Then,with the modulo node I split the radial in N parts (of size 2). This turns the gradient into N slices of a smaller gradient from [0 to 2].

Subtracting 1 and using the absolute, turns the [0,2] gradient into [1,0,1] for each slice.

My thought was to scale the values of the [1,0,1] gradient by the distance to the center. So that some value in that gradient would become closer to 0 in relation to a longer distance. Since the scale is linear, I thought using the distance directly, but here is the flaw. The gradient is circular, and I would need to transform it in to a linear gradient and do the scaling after (which is not so trivial to do with nodes).

The bottom part is just the distance to the center (the dot product).
The dot product is a nice tool for handling vectors.

Dot(vectorA, vectorB)=cos(A,B) * lengthA * lengthB,
or by components:
Dot(A, B)=AxBx+AyBy+Az*Bz

If we use the same vector as in Dot(vector A, vector A), we know that the angle between A and A is 0, so the cos(A,A)=1.

This ends as Dot(vectorA, vectorA)= lengthA * lengthA. The square root of it is therefore the distance from the origin of any vector.
If you look closer to the component version, if you change the Bx, By to Ax, Ay, and use 0 for the Az and Bz, you’ll see that what you get is the Pitagoras theorem.

I understood the first group of nodes and the implementation but the dot product is maths I’ve not delved into before. Been reading about it in relation to vectors this evening and understand a bit more. With regards to the “flaw”, I see why its happening alright, certainly dont have the skills to rectify it myself but it bares no relevance to my needs as the origin will be masked out.
Many thanks again,especially for the explanation.

I know this thread is already marked [Solved], but it came to me that if we use the gradient with radians as unit, we could solve the distortion using some trignometric function. Initially I thought the ArcTangent would do the trick, but it turns out that the sine is what is needed!

So just for closure on this one:

Now, there will be no distortion, and the width units are in the same scale as the input vector.
And to avoid Z distortions, the input vector is scaled to the XY plane.
It’s also possible to include a rotation input… There are already plenty of examples here in the forum.

I’m not gonna lie Secrop, thats one sexy bit of node work. I did spend considerable time last night trying to adjust your other set up to retain the width while changing the count. Your a star,thank you.