CS 6610 - Final Project

Wang Tiles for Image and Texture Generation

Chelsea Robertson
December 10, 2005


Project Description

For my final project, I decided to implement a method called Wang tiling. This project is based on the SIGGRAPH 2003 paper Wang Tiles for Image and Texture Generation by Michael F. Cohen, Johnathan Shade, Stefan Hiller, and Oliver Deussen.

When the same example texture is used many times in a periodic fashion, the repetition becomes apparent and sometimes distracting. Wang Tiling is a method for non-periodically tiling a plane with a set of Wang Tiles. This method allows for the efficiency of reusing example tiles to create larger, more complex textures or patterns at runtime, while avoiding the obvious visual artifacts of periodicity.

Wang Tiles are a set of squares in which each edge of each tile is assigned a color. The tiles can be filled using textures, patterns, or geometry to create a continuous representation. To tile a plane, matching colored edges are aligned. So a valid tiling requires that the shared edges between tiles have matching colors.

As few as eight tiles are needed to non-periodically cover a plane. Below is an example of a set of tiles and a valid tiling using these tiles.

Tiling Algorithm

The algorithm to tile any plane with a set of Wang Tiles is very straightforward:

  1. select any tile for the NW corner
  2. tile the top row, left to right by choosing tiles for which the W edge of the new tile matches the E edge of the previous tile
  3. select first tile for next row such that the N edge matches the S edge from above
  4. continue this row so that the N and W edges match the S and E edges from above and the left respectively
  5. go to step 3 and repeat until the plane is completely tiled

Process

Images

Below are a few images of my final project.

The first set of images show the Wang Tiling of the field. On the left are the eight tiles used, and on the right are a couple images of the field randomly tiled with this set of tiles.

This next set of images show the distribution of the sunflowers. On the left are the original eight tiles used. The dots represent the future locations of the sunflowers. On the right are two images of the field tiled with these dotted textures.

In the above images it is pretty clear where the seams are between the tiles. As a result, the locations of the dots needed to be adjusted. Some points were moved and 3 points were added to each tile. These images show the new dotted tiles and a couple images of the field tiled with the new textures. As you can see, the seams are not as obvious.

Although you can still tell where the seams are if you look closely, they are not as noticeable with the geometry added in. These last images show the field using the actual sunflower model. The top two images use one tile repeatedly, while the bottom two images use the Wang tiling method. The repetition in the top images is clear, making the bottom images more visually appealing.

User Interface

The user interface is pretty simple. The mouse can be used to perform various transformations on the entire scene. The buttons are listed below with their functionality:

In addition to these controls there are various keys on the keyboard that can be used to control the scene. These keys are listed below with their functionality:

Problems/Future Work

There are a few things that I wasn't able to fix or implement. The first being the leaves of the trees. The associated texture was not working properly, and I ran out of time before figuring out the actual problem. A couple things that would add to the scene are to make the sky an actual skybox by attaching it to the camera. This would make the sky appear infinitely far away, also making the edges of the box more subtle. Another idea would be to add shadows under the trees. Although this would make the scene look nicer, shadows would tremendously slow it down. The shadows would have to be implemented with shadow volumes, and this would get expensive for all of the geometry of the trees. Furthermore, it is already fairly slow when rendering with the 3D geometry due to the high number of sunflowers.

Outside Resources Used

Special thanks to Evan Andersen and Carlos Scheidegger for their help with this project!