To properly explain my question and what I know about it so far, this will be a bit lengthy, so please forgive me for this long preface:
I'm creating procedural textures in Blender nodes with seamless, symmetric boundaries but interior values generated from a related non-seamless, asymmetric texture. As a kind of minimal working example, suppose I have this texture, and I want to make make it seamless:
Given the origin is centered, a natural way to make this seamless (and without the stretching caused by e.g. spherical coordinates), but with obvious symmetry artifacts in the interior, is to re-map the input vector under absolute value, like:
To remove the symmetry artifacts in the interior, I thought that I could just mix the symmetric and asymmetric input coordinates, based on a continuous, rectangular mix factor, but this creates extremely noticeable seams/tearing-like artifacts along the rectangle defining the boundary (NOTE: my example object's Object coordinates range in [-1.5, 1.5], so the choice of x - 1, y - 1 correspond to a rectangular boundary occupying 1/3 of the width, length, respectively):
If I add a color ramp to emphasize the regions where abs versus non-abs coordinates are fully in use, the tearing is even more obvious. Of course, there is no artifact in the upper-right region, where abs(x)=x and abs(y)=y, so that the two vectors are identical in this quadrant:
I thought perhaps this problem was due to to the non-differentiability of abs at x=0, y=0, but building a small spline with nodes that swapped a shifted, differentiability-preserving quadratic in the region where abs meets x=0 and y=0 did not remove the artifacts (and is also reasonably involved and error-prone to implement in nodes; that node system not pictured here, but happy to share upon request if anyone thinks it is relevant). In retrospect, because the artifacts occur where the mix factor indicates the boundary is, and not where x=0 or y=0 in either coordinate system, this guess was probably wrong.
I have since discovered one solution to this problem, which is that generating two entirely separate versions of the node system, one with symmetric and one with asymmetric coordinates, and then mixing on these, does not yield artifacts:
(I go a bit further in my actual application and restore world coordinates in order to allow the interiors of the two adjacent planes' textures to be distinct from one another, while still preserving identical seamless boundaries, but that isn't needed to motivate this question)
So, with that lengthy preface, my question comes in a few parts:
- Why did my original strategy not work, and what causes the stretching artifacts when mixing the input vectors like that?
- Why does "post-"mixing the noise rather than the input vectors avoid these problems?
- Are there alternative, best-practices ways to achieve seamless boundaries with asymmetric interiors in procedural nodes (and without significant visual stretching, as I would expect from e.g. using
sinorcosfor this same purpose; that seems to be the approach taken in most of the answers to, e.g., How do I create repeating patterns with cycles' procedural textures)?





Also, it occurs to me that the artifacts are probably due to exact cancellation between e.g.
– NeverConvex Sep 12 '21 at 19:42abs(x)andxwhen these have opposite signs, causing there to be 0 variation in the input coordinates. Maybe I'll try to use that to fix the issue.