6
$\begingroup$

I understand how an artist would make seamless textures by hand, but how can a computer program automate that process? Software like PixPlant is capable of doing this, but I don't understand how it does this.

$\endgroup$
2
  • $\begingroup$ I've no idea what that tool uses, but one approach might be to use seam carving. A quick internet search, for example, turned up this project report: inst.eecs.berkeley.edu/~cs194-26/fa15/upload/files/… Another possibility is to build textures via texture synthesis. $\endgroup$
    – Simon F
    Commented Jul 3, 2017 at 7:38
  • $\begingroup$ That looks like a very interesting report. I'll make sure to check that out. $\endgroup$ Commented Jul 3, 2017 at 16:01

1 Answer 1

10
$\begingroup$

For these types of algorithms, you usually have to rely on multiple forms of texture synthesis. That doesn't mean you have to generate the whole texture from scratch. For example, you could regenerate the sides of the texture to achieve a seamless effect. This answer may not be complete because it's a large field, and different approaches will have various effectiveness depending on the input image.

Naive blur along edges

As an artist, one way to make seamless textures is to offset the image in two directions. Then, you can blur the edges.

enter image description here

This example isn't the best, but you can get decent results with results with certain texture types.

Alternatively, you could do a minimum cut on the edge here by overlapping the image with itself, and then taking the difference between the two images.

Min-cut algorithms

One of the most popular algorithms is image quilting. The idea behind this is separate the texture into a bunch of patches. You fill in the texture by first randomly picking a subset of patches from your total set of patches and picking the one with the least amount of error when you overlap the patch with it's neighboring patch(es). You then perform minimum cuts along the overlapping regions.

My experience with this algorithm is that it works well for many textures that have round details. If the texture is grass for instance, then it can perform poorly. The amount you overlap each patch also has a large impact on quality. The larger the overlap, the better the match, but the more likely there will be repetition. Also, if the subset of candidate patches is too large, then you'll get repetition. Otherwise, you might not find good matches.

There are extensions of this algorithm including PatchMatch (which was used in Photoshop).

Gradient correction

Another way to handle seamless textures is to remove the gradient. Poisson image editing can help with this if you break up your image and use the various pieces are foreground and background objects.

A simpler approach is to create a low-frequency (e.g., mipmap) of your texture and then remove the gradient of your image. Of course, high frequency data won't be seamless, but you can remove that with other algorithms.

Computer vision approaches

You could use various computer vision approaches as well. The idea here would be that you keep important features intact as you attempt to tile your textures. For instance, if there's a texture of dirt with a rock on the edge of the picture, using various feature detectors such as difference of Gaussians could help you identify this rock and remove it before you do the tiling. You might need to fill in the rest of the texture where the rock was removed, but this could help with making the image more seamless.

Additional References

$\endgroup$
2
  • $\begingroup$ Nice survey. Alexei Efros has some nice slides on image blending as well from his computational photography course. He mentions classical Burt-Adelson laplacian pyramid blending as well as gradient domain methods and graph cuts. $\endgroup$
    – user106
    Commented Jul 10, 2017 at 6:02
  • $\begingroup$ This is a very good answer, and I'm glad you took the time to go over multiple algorithms, rather than just one. I'll make sure to look at those links. $\endgroup$ Commented Jul 10, 2017 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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