6
$\begingroup$

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

[1]: https://i.sstatic.net/soQA0.png

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...

Thanks for your time

$\endgroup$
2
  • $\begingroup$ The page in your link brings up a 404 (not found) error here. $\endgroup$
    – John Eason
    Commented May 11, 2023 at 14:39
  • $\begingroup$ sorry! Fixed now $\endgroup$
    – Martín
    Commented May 11, 2023 at 14:41

3 Answers 3

6
$\begingroup$

  • 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!

$\endgroup$
5
  • $\begingroup$ 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! $\endgroup$
    – Martín
    Commented May 12, 2023 at 0:33
  • $\begingroup$ @Martín I uploaded .blend file, typically test stuff on the default plane - Texture Coordinate: Object relies on dimensions. $\endgroup$ Commented May 12, 2023 at 8:28
  • $\begingroup$ I noticed now, there are issues with those rotations, circles can be cut in halves. I was worried this might be an unreliable hack… $\endgroup$ Commented May 12, 2023 at 10:47
  • $\begingroup$ Great shader ... Thanks a lot :) $\endgroup$
    – vklidu
    Commented May 12, 2023 at 11:08
  • $\begingroup$ a m a z i n g ! truly, what a shader you made! $\endgroup$
    – Martín
    Commented May 12, 2023 at 12:41
4
$\begingroup$

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...

enter image description here enter image description here

as Attribute in Shader ...

enter image description here enter image description here

$\endgroup$
4
  • 1
    $\begingroup$ whaaaaaaat? That is amazing! thank you so much :) I'll use that! $\endgroup$
    – Martín
    Commented May 11, 2023 at 21:29
  • $\begingroup$ I see you're adding some animations too :D $\endgroup$ Commented May 12, 2023 at 10:39
  • $\begingroup$ @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 :) $\endgroup$
    – vklidu
    Commented May 12, 2023 at 11:13
  • $\begingroup$ you guys rock! thanks a lot :D $\endgroup$
    – Martín
    Commented May 12, 2023 at 12:41
3
$\begingroup$

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.

enter image description here

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:

enter image description here

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

$\endgroup$
4
  • $\begingroup$ Welcome to the party :) $\endgroup$
    – vklidu
    Commented May 12, 2023 at 19:04
  • $\begingroup$ you guys are so smart! I'll certainly write all of this down :O $\endgroup$
    – Martín
    Commented May 12, 2023 at 20:51
  • $\begingroup$ 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. $\endgroup$ Commented May 16, 2023 at 20:19
  • 1
    $\begingroup$ 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. $\endgroup$
    – Robin Betts
    Commented May 16, 2023 at 20:24

You must log in to answer this question.

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