# Shading - Circles array along concentric circles

I am trying to figure out a way to do this but with shaders on a plane:

I found this post How do I procedurally spread a number of circles across the sides of a bigger one? that manages to do that to one ring. But I need to have many rings and it should have more instances of circles when the rings have a bigger perimeter.

I guess it could be forced using the method from to post above, but that would require a lot of manual tweaking of values, and a ton of nodes, I know it must be a smart way to do it, but I am not that smart hehe...

• sorry! Fixed now Commented May 11, 2023 at 14:41

• Based on given parameters, calculate the nearest ring (of circles) towards the center, and the nearest ring towards the outside.
• Calculate the distance in the custom group to not repeat the same logic twice.
• Take the lesser distance ("Greater Than" node might be misleading here, but this way I cross links less).
• Now you have a voronoi-like distance, so without applying a threshold or color ramp etc. you would get this:

Custom Group:

• Object texture coordinate is hard-coded, which goes against good programming principles.
• Multiply the radius by $$τ$$ ($$2πr$$) to get circumference.
• Calculate how many circles will fit into the circumference by dividing it by the diameter. This is only an approximation but it's good enough.
• $$1/n$$umber of circles is a reciprocal telling you the subrange of the 0..1 range for each circle.
• Using "wrap" we can have that repeating subrange.
• Using "divide" $$.5\over n$$ and $$-.5\over n$$ instead of $$1\over n$$ offsets the range so it is signed (rotating in either of two ways, whichever is closer).
• Move towards the processed ring, and rotate towards the circle nearest on this ring.
• Calculate distance from obtained position to the original position.

Some parameters give weird results:

You can combat this with random rotations of the input vector, with seed based on the radius of the ring (so the entire ring gets consistent rotation offset):

Ultimately, the pareidolia will always make you see some patterns:

While working on the animation below, I found a small bug in the above file, the rotation should be inverted!

• oh my... thank you so much for this answer! I am trying to replicate it on an object that is 8 by 8 cm and I can't make it work. The closest I got is to have control over the rings, but not to form the little circles, I will keep trying to find my mistake! Commented May 12, 2023 at 0:33
• @Martín I uploaded .blend file, typically test stuff on the default plane - Texture Coordinate: Object relies on dimensions. Commented May 12, 2023 at 8:28
• I noticed now, there are issues with those rotations, circles can be cut in halves. I was worried this might be an unreliable hack… Commented May 12, 2023 at 10:47
• Great shader ... Thanks a lot :) Commented May 12, 2023 at 11:08
• a m a z i n g ! truly, what a shader you made! Commented May 12, 2023 at 12:41

## EDIT

I forget to mention one disadvantage ... this technique requires subdivided plane ... it can be sub-div inside geo-nodes too, but for some some complex meshes it can be heavy to handle. The thing is the attribute (color) is transferred to vertices.

If you don't mind you can use Geometry Nodes and use Geometry Proximity of generated points ...

With this node tree you can generate points directly for object...

• whaaaaaaat? That is amazing! thank you so much :) I'll use that! Commented May 11, 2023 at 21:29
• I see you're adding some animations too :D Commented May 12, 2023 at 10:39
• @MarkusvonBroady It was possible before too ... it is just more catchy :) I'm still running behind you ... GN version is in section of workaround (due the topology), than your proper way of shader. Don't worry :) Commented May 12, 2023 at 11:13
• you guys rock! thanks a lot :D Commented May 12, 2023 at 12:41

Here's a start at a more general 'Radial Tile' group, which divides the given texture-space into concentric rings of tiles around texture-0, each with their own UV.

It makes use of Cartesian to Polar and Polar to Cartesian subgroups. Most of the manipulation is of the space measured in polar coordinates.

Inputs:

• Overall scale
• Ring Density
• The number of cells in the innermost ring (which determines the outgoing pattern).

At the moment, it outputs

• Cartesian Cell UV (by default oriented with incoming UV)
• Cartesian Cell Center
• Cell Polar UV and Center, which can be used in other ways. (The Polar UV will deform mapped textures.)

Some effects:

It could do with a lot of improvement I think. But .. just chucking it in in case it's useful in its current state.

• Welcome to the party :) Commented May 12, 2023 at 19:04
• you guys are so smart! I'll certainly write all of this down :O Commented May 12, 2023 at 20:51
• I forgot to follow this thread, closing some old tabs (tab hoarder here) discovered this answer. Pretty cool: instead of solving my problem of patterns emerging it arranges circles in a nice pattern, especially with Inner Count 2..4. It looks like only Inner Count 2..3 the rings can touch, the Inner Count = 3 has a nice, tight packing of circles. Commented May 16, 2023 at 20:19
• Thanks, @MarkusvonBroady! It's not quite good enough, yet, for me. I want 'distance from edge' and simpler variable radial offset per ring, for paving patterns, tiles on conical roofs, etc. Commented May 16, 2023 at 20:24