0

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:

enter image description here

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:

enter image description here

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):

enter image description here

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:

enter image description here

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:

enter image description here

(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:

  1. Why did my original strategy not work, and what causes the stretching artifacts when mixing the input vectors like that?
  2. Why does "post-"mixing the noise rather than the input vectors avoid these problems?
  3. 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 sin or cos for 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)?
NeverConvex
  • 1,257
  • 6
  • 16
  • I'm not exactly sure what you're trying to achieve here. The entire point of procedural textures is that they scale infinitely with no seams or repetition. It seems to me you're purposefully introducing seams that then you're trying to get rid of. – Geri Sep 12 '21 at 18:13
  • Yes, that's basically true. I didn't provide the motivation in my question, but what I'm doing is generating modular component objects I can write scripts to combine dynamically, to generate large, complex objects. Seamless textures are an important component for this kind of workflow; I could just use seamless pre-baked images, but doing this procedurally lets me create more unpredictable variety (and with a bit more control), while doing so in a seamless way makes them compatible with combining modular building-block objects together. – NeverConvex Sep 12 '21 at 18:21
  • Oh, I forgot to emphasize: they need to modular/tile-able even after rendering. I could just use the procedural textures themselves if only wanted was a single static image generated inside of Blender, but I'd like to be able to re-use them in a modular fashion after, e.g., moving them to a game engine. Seamless-ness is valuable there.

    Also, it occurs to me that the artifacts are probably due to exact cancellation between e.g. abs(x) and x when 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.

    – NeverConvex Sep 12 '21 at 19:42
  • That kind of cancellation also explains why (in the 3rd image) there are 2 bars of artifacts, one on each axis, in the lower-left quadrant, but only one in the bottom-right and top-left, which I had not noticed before – NeverConvex Sep 12 '21 at 19:53
  • 1
    Check out this tutorial for thoughts on how to solve your problem. – Marty Fouts Sep 13 '21 at 00:40
  • Thanks @MartyFouts -- interesting that he handled each type of noise separately, rather than trying to enforce seamlessness generally in the input coordinates. – NeverConvex Sep 13 '21 at 12:27

0 Answers0