Avoiding repetition artifacts with chaos mosaic

Chaos mosaic or chaos mapping is a method to extend limited size textures to huge uv-mapped surfaces while avoiding repetition artifacts.
You might have for example a grass covered ground texture that is detailed and would map to a 2 x 2 meter square quite well. If you would apply this to a 10 x 10 meter field and scale to its proper size, obvious repetition artifacts would be visible:

A chaos mosaic on the other hand would take randomly selected squares from a texture giving the appearance of an endless texture without repetition:

At close range you would still be able to make out the seams but for large objects seen from a distance this probably wouldn't be noticeable.
This technique only gives good results for non-patterned textures like groundcover, asphalt, plaster etc. but in those cases it might be just what you are looking for and it is quite fast.
In an older article I showed a chaos mosaic implementation in Open Shading Language but I like to work with the GPU as much as possible so I implemented the same technique in just nodes.

Node group


The noodle takes the uv-coordinates and then you can plug in the transformed coordinates into you texture. The scale can then be adjusted as needed. The rotation gives an additional amount of randomness to the final material but depending on the texture this might not always improve the visual quality.
The .blend file with the node group is available from my GitGub repository. Just download the chaosmap.blend and then in your own .blend use File → Append to select the nodegroup Chaosmap. It will then become available in the Add → Group menu of the node editor.

Improvements

To reduce the visibility of the seams between the tiles you can mix two chaos mosaics: the second one should use slightly offset and rotated uv-coordinates and then you can use for example a noise texture with a scale comparable to the actual textures to mix the two:

The result has less visible seams but is also somewhat blurred:

The highlighted area shows a visible seam:



Especially at close range:



Some details

You can examine the details of the nodegroup if you like but the basic principle is that it takes the original uv-coordinate, determines in which grid section this falls and then maps the relative position of the point inside this grid to a relative position inside randomly selected square in the unit uv-map. (This square is randomly selected but always the same square for the same grid section)

5 comments:

  1. Very useful tips!! Thank you for this, and also for the .blend file!

    ReplyDelete
  2. YYYYES Michel, good lesson! Thanks you so much ;-)))
    Patrick Depoix
    Aka Spirou4D

    ReplyDelete
  3. Solves a common problem for me. My own attempts to break up the pattern usually resulted in a blurry mess. Thanks.

    ReplyDelete
  4. Nice, I've done this manually (selecting random faces and rotating the UV map itself) but this seems way faster.

    ReplyDelete