I'm trying to get rid of repetition on terrain, when viewed from up high. To achieve that, I've chosen Wang tiles. One thing I'm missing, and can't really find is any kind of generator that can take a source image and generate a set of Wang tiles from it.

So is there any kind of generator that implements Wang tiles generation from source image? I've tried to read the research papers, but algorithms descriptions there are quite sketchy and vague to be actually put to code.

  • 1
    \$\begingroup\$ Is there something specific about the research papers that you're having trouble putting into code? (At the moment, an answer would basically need to reconstruct the research paper from basic principles using simpler wording. That's very broad.) \$\endgroup\$ – Anko Sep 3 '15 at 13:54
  • \$\begingroup\$ So far I've read about Diamond shape tiling algorithm by Cohen et. al. and quilting by Efros and Freeman. I've also read some articles like GPU Gems article about tiling and some more random blog entries here and there. Every one of those presume you having the tileset and only describe the tilemap construction algorithm, which compared to the tiling generation algorithm, is quite straighforward and crystal clear. All that led me to search for implementation of tiles generator, rather than trying to implement it myself, thinking this would be a common dame developer tool. \$\endgroup\$ – user1617735 Sep 3 '15 at 14:00
  • 1
    \$\begingroup\$ The automatic generation of Wang tiles is done by a company called Artomatix - they call it infinity tiles. \$\endgroup\$ – user89636 Aug 10 '16 at 15:11
  • \$\begingroup\$ Is PerlinNoise of any use in this case? docs.unity3d.com/ScriptReference/Mathf.PerlinNoise.html \$\endgroup\$ – Peter Morris Aug 10 '16 at 15:47

My understanding is that generating the Wang tile content is the most difficult part of using Wang tiles. All of the papers I've read use some manner of texture synthesis to build the tiles. It is possible to generate synthetic textures based on a source image using things like stochastic sampling, image quilting, & other techniques, but the quality of the output varies greatly depending on the combination of source image properties & the generation methodology. To the best of my knowledge, texture synthesis works best on abstract source images &/or highly repetitive source images. My academic experience with texture synthesis is that it can take a fair bit of tuning & tweaking to get desirable output.

@user1617735 mentioned the GPU Gems 2, Chapter 12, Tile-Based Texture Mapping, which in turn has this to say:

There are several methods to construct the Wang tile set. One possibility is to draw the tiles manually; all we need to do is to ensure that the drawings are continuous across tile boundaries while producing sufficiently interesting tiling results... This manual approach works only for line art.

For natural texture patterns such as those from photographs, there are algorithmic ways to build the tile set, as described in Cohen et al. 2003, Section 3.2. We have found that this approach works well for many natural texture patterns, and we provide the source code on the accompanying CD.


From what I know, no one's ever heard about Wang tiles, and those few who have are making wang tiles in photoshop. Like this. However, there is a tool from Robert Burke, it is old and not very good, but it does what you ask.

  • 3
    \$\begingroup\$ I'm not sure where you get the impression that "no one's ever heard about Wang tiles," but there's plenty of literature on them. I recommend checking out the SIGGRAPH proceedings for years past, for example. A quick google search for "Wang Tiles" turns up several game-related posts. \$\endgroup\$ – user1118321 Dec 13 '15 at 18:18

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.