Gimptalk - Premier Gimp Community: Easily create a seamlessly tiled texure from a photo - Gimptalk - Premier Gimp Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Easily create a seamlessly tiled texure from a photo

#1 User is offline   Lendrick 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 8
  • Joined: 28-April 09
  • LocationOhio

Posted 30 April 2009 - 04:14 AM

Greets!

I've recently been using a technique to take photographs and turn them into seamless textures (for use in images, games, or whatever). There are various tutorials around that explain parts of this process, but I haven't seen one for Gimp that takes you from start to finish, so here goes:

BEFORE YOU START: Download and install the Gimp High Pass Filter script, here:
http://registry.gimp.org/node/7385

There are instructions for installing it in the comments below the plugin.

Step 1: Take a photo of some repeating surface with your digital camera. Stone, grass, brick, bark, whatever -- it doesn't matter, provided that it's something you can make a repeating pattern out of. High resolution is best. I'm using brick for this tutorial because the perspective warping problem is so obvious.

Posted Image

Step 2: Notice how the center of the image "bulges" outward. We need to correct this before we can do anything else with the image. Go to Filters -> Distorts -> Lens Distortion, and adjust the "Main" slider until the image appears flat.

Posted Image

Posted Image

Don't move it too far or your image will appear to curve inward instead. Note that if your image has no obvious bulge and doesn't have any clear straight lines, you can usually skip the perspective correction steps and go straight to step 6.

Step 3: If you're dealing with an image that has straight lines in it, you may still notice minor problems with the perspective of the image. In this example, the lines along the bottom are slightly crooked compared to the ones along the top. Create some guidelines (make sure View -> Show Guides is checked) by dragging them off the top and side rulers. This should give you a pretty good picture of where your image isn't straight.

Posted Image

Step 4: Select Tools -> Transform Tools -> Perspective.

Posted Image

A dialog box will appear. Move it out of the way or minimize it. Now make small adjustments to the corner until your lines line up with the guides.

Posted Image

When you're satisfied that your lines are no longer crooked (they'll never be perfect, but try to get as close as is reasonably possible), click the Transform button on the dialog that popped up. You may need to sacrifice some of your edges here, but that's okay. Next step, we're going to crop the image.

Step 5: Use the move tool to drag your guidelines off of the image (or hide them from the view menu) because we don't need them anymore. Use the rectangular selection tool to select a *roughly* square area of the image, taking care to make sure that the area you select will tile correctly. It's more important that it tile well than be perfectly square.

Posted Image

Now crop the image to the selection with Image -> Crop to Selection.

Step 6: Now, scale the image into a perfect square using Image -> Scale Image (or, if there are no obvious patterns, simply reduce the canvas size and pick a good section of the image). Make sure the chain icon is deselected, and change the pixels value to the next lower power of two that is smaller than your current image. (1024x1024, 512x512, 256x256, 128x128, etc).

Posted Image

After that, get rid of the layer outside the image by selecting Layer -> Layer to Image Size.

Step 7: I've applied an Offset to the image to show you something (don't do it yet).

Posted Image

Notice how some sections of the image are darker than others. This particular image doesn't have too much of that effect, but you'll find that some images do. We're going to use the high pass filter you installed to fix this issue. Click on Filters -> Generic -> High Pass Filter.

Posted Image

Adjust the filter radius so that it's larger than the small features in your image, but a good bit smaller than the image itself. In this particular case, 150 pixels seems to work well, but you may want to experiment a bit. Change the mode to "Redrobes" and click OK.

Posted Image

This should even out the colors somewhat, making the image far easier to tile.

Posted Image

Step 8: Now, offset the image by clicking Layer -> Transform -> Offset. On the dialogue that appears, click the "Offset by x/2, y/2" button and make sure Edge Behavior is set to "Wrap around", then click "Offset". Notice how the colors match up a lot better than they did in my example in step 7.

Posted Image

Posted Image

Step 9: Now for some fun. Select Gimp's healing tool (it's the two yellow bandaids in a X shape) and use it to smooth out the seams in the image.

Posted Image

Note that while my screenshots are zoomed way out, you may want to zoom in closer so you can see the details. To do this, control click on one area in the image to sample from, and then paint over the seams (if you're working with a high resolution image, you may want to choose a larger brush size). Choose your sampling area carefully! You want to pick something that's similar to the area where the seam is. You also want to make sure you don't sample the same area too many times, or there will be obvious repetitions in your image. When you can't see any more seams. Offset the image again (but this time by some other, unrelated number, like 300 or so) and repeat.

And that's it! You should have a seamlessly tiled image. :)

Posted Image

You can grab a copy of my completed one here:
http://opengameart.o...t/brick-texture

Peace!

Bart

EDIT: Hopefully the images are fixed now. Sorry about that.
http://opengameart.org
Free, legal art for open source game projects
0

#2 User is offline   saulgoode 

  • Retired Staff
  • PipPipPip
  • Group: Retired Staff
  • Posts: 5,324
  • Joined: 22-August 05

Posted 30 April 2009 - 07:25 PM

Nice tutorial.

I like your use of layer offsets to get the edges adjacent. A couple years back I wrote a script which diagonally swapped the quadrants of a layer. If I'd known your technique at the time, it'd have saved me a couple hours.
Everybody makes their own fun. If you don't make it yourself it's not fun, it's entertainment.
0

#3 User is offline   Lendrick 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 8
  • Joined: 28-April 09
  • LocationOhio

Posted 23 June 2009 - 08:24 PM

Whoops!

I inadvertently moved the images directory on my server, which was causing the images not to load. This has been fixed. Sorry about that. :)

Bart
http://opengameart.org
Free, legal art for open source game projects
0

#4 User is offline   inspectra 

  • relentless, invisible, indefatigable, indisputable, undeniable.
  • PipPipPip
  • Group: Members
  • Posts: 5,044
  • Joined: 02-December 08

Posted 24 June 2009 - 12:36 PM

Great tutorial, I've already made a few simple patterns. They weren't nearly as difficult as a brick texture, just some dirt textures and stuff.
Like saul, I especially like your trick of swapping the quadrants to manually un-seam(?) the texture.
Nice job. =)
0

#5 User is offline   Redrobes 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 10-August 09

Posted 10 August 2009 - 12:36 AM

Hello all, thats a nice tut there. I just wanted to say that there was a similar tut for making seamless textures out of more random stuff where you don't need to do half of those steps. Theres a script to do the work for you too using image magick instead of gimp which I wrote but RobA has gimped that up too and made that into some kind of script fu menu driven plug in thing too. They are both from the cartographers guild and downloadable.

http://forum.cartographersguild.com/sho ... php?t=1373

and

http://forum.cartographersguild.com/sho ... hp?p=35119

Just thought you'd like to know about it.
0

#6 User is offline   GimpKnowHow. 

  • Member
  • PipPip
  • Group: Members
  • Posts: 308
  • Joined: 12-March 09

Posted 10 August 2009 - 01:06 AM

I think I saw this same tutorial on a website where you have to pay for them... Thanks for posting.
0

#7 User is offline   Plasma Snake 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 9
  • Joined: 05-August 09

Posted 15 August 2009 - 07:40 PM

You do know there is a "Make Seamless" thing already in GIMP.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic