enter image description hereHow do I make it repeat itself along the X-axis?

  • 2
    $\begingroup$ Possible duplicate of Repeat a generated texture in Cycles? $\endgroup$ – Duarte Farrajota Ramos Apr 23 '19 at 23:14
  • $\begingroup$ Yeah, I tried their methods and none of them worked out for me. $\endgroup$ – ilyak Apr 23 '19 at 23:25
  • 1
    $\begingroup$ Then how about giving us something to work with? More than one sentence? Adding images? You can edit your question to make it better. $\endgroup$ – metaphor_set Apr 23 '19 at 23:32
  • $\begingroup$ done that, thought it was clear enough $\endgroup$ – ilyak Apr 23 '19 at 23:39

This is a little more complex than the linked question due to the spherical gradient texture needing a range of [-1,1] to generate a full circle.

The modulo(1) function will generate a repeating pattern by mapping positive values to a new value in [0,1] and negative values to a value in [-1,0]. This means that half the circle will be repeated in either direction from 0, not what we want.

Instead we can generate two versions of our repeating pattern that each work for just one side of the zero point, and then combine them by masking out values we don't want and using a maximum: enter image description here

  1. Modulo(x,2) - 1 generates a repeating [-1,1] range for x > 0 and [-3,-1] otherwise
  2. Modulo(x,2) + 1 generates a repeating [-1,1] range for x < 0 and [1,3] otherwise. This [1,3] range will present problems when combining each side with maximum so we need to set it to something less than or equal to 0
  3. By exploiting the fact that the spherical gradient is symmetrical around x=0, we can invert the part from (2) to avoid the issues with maximum.

Just out of interest.. (this is no better than @Sazerac's answer) .. this set of nodes has the same effect as Sazerac's cluster between the Mapping and Gradient nodes, this time placing the full gradient in the ranges ...[0,2],[2,4]... of whichever space you are using.

enter image description here

The graphs in the illustration below show the sequential effects on the mapping of X by the numbered nodes.The squares are all 8 units on the side.

enter image description here

Thanks to @Rich Sedman for the tip on how to display graphs of f(x).

  • $\begingroup$ Nowadays, Pingpong will do the job. $\endgroup$ – Robin Betts Dec 17 '20 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.