cokane.com
Games
Articles
Links
:: Creating seamless textures from photographs ::


This tutorial demonstrates how to make seamless textures suitable for applying to 3d models. It requires Photoshop 7. Firstly choose a picture to make your texture from. It helps if the subject is photographed perpendicularly but if it's not just use the free transform (CTRL-T) tool to remove any perspective distortion. In this tutorial I'm going to create a tiling rock pattern from this photograph.

:: Step 1 ::
 

Pick a square section of the source photo to work with. I've resized it to 256x256 for this tutorial, but the originals were 512x512.

:: Step 2 ::
 

Apply an offset filter (filter/other/offset) to the image with half the resolution in the width and height boxes. This brings the edges of the image to the centre. These seams need to be removed to make the image tile properly. Notice the top of the image is much brighter than the bottom. We need to fix this contrast before trying to clean up the seams.

:: Step 3 ::
 

Undo the offset filter. Before working on the seams this brightness difference has to be removed. To do this you use a high pass filter (filter/other/high pass). Drag the slider left and right in the high pass filter dialog until you reach a setting that removes the large brightness variation over the entire image without removing too much of the smaller detail. This setting varies depending on the size of the image and the amount of detail you need to keep so just experiment. A side effect of the high pass filter is that you lose a lot of color information in the image. To get around this duplicate the background layer and run the highpass filter on the copy. Now set the copy on luminosity mode. This way it only changes the luminosity of the underlying layer and leaves most of the colors intact. Flatten the image when it looks right.

:: Step 4 ::
 

Here's the filtered image with the offset reapplied. Notice the contrast is almost completely gone.

:: Step 5 ::
 

Next we need to remove the seams. This is where Photoshop 7's healing brush comes in handy. The healing brush tool is designed for removing scratches and blemishes from scanned photographs. It works like the clone brush in that you pick an area to sample from by alt-clicking and then paint over the target, however rather than simply cloning the healing brush takes the contrast information from the sample but attempts to leave the colors intact at the target. It's the perfect tool for making tiled textures. In the image above you can see a rock which passes over the seam at point B. In order to remove this seam we need to extend the rock over the seam line. There's a bottom-left corner of a rock at point A which would fit onto the rock at point B pretty well, so using the healing brush you alt-click at point A and paint around point B, trying to join the lines up as best as possible. Once you stop painting Photoshop will automatically re-color the cloned area to match the surrounding colors.

Here's the result.

The rock at area B now extends smoothly over the seam.

:: Step 6 ::
 

Here's another example. Again I'm cloning the piece of rock at point A to extend the rock at point B over the seam.

Here's the result.

:: Step 7 ::
 

Continue this process of extending details over the seam by cloning from suitable areas in the image. The seams are now hidden, but there is an obvious color saturation difference between the top and bottom of the image. This would show up as banding if this texture was tiled over a large area so it has to be removed.

:: Step 8 - The finished texture ::
 

To remove this color banding I duplicated the background layer, flipped it vertically, set it to 'hue' mode and 50% transparency. This way some of the color from each half is mixed in with the other half, removing the banding but retaining most of the subtle color variation in the rocks.

:: Example ::
 

Here's what the finished texture looks like mapped onto a sphere without any bump map or specularity.

If you have any questions or comments please email me at cokane @ cokane.com