In the book – Getting Started in 3D with Maya – I continually laud the great online resource cgtextures.com. In a pinch it’s a great place to go to grab textures to place in your scene. Generally though, textures that are easily available online are great because they are quickly available online – and also not great because they are quickly available online. It means that not only you, but every other 3D artist with an Internet connection can grab and use these texture resources. I’ve personally seen multiple demo-reels where I’ve recognized a texture from cgtextures on a wall.
In some of our tutorials we’ve looked at one way to mitigate this problem through heavy manipulation and layering of texture assets. Using multiple layers with various Blending Modes can quickly customize a texture into a look that is unique to your project. However, of further customization is the ability to use your own photography assets to be the basis of the textures.
This will ensure a completely unique look; and since you took the photos, this always ensures you have the rights to the texture files.
This does require a little bit of extra work – but the original results are generally worth it. There are a few problems that emerge from your own photographs (which, by the way, can be a problem with some online resources too). The biggest problem is the problem of seams.
Figure B.1 shows a photo of a chunk of a wall that I need to extract a stucco texture off of. The selected area is the chunk of that texture I copied and pasted into a new file.
The problem is that this chunk of the wall, when applied to geometry, ends up looking like Figure B.2.
Suddenly, our stucco looks more like bricks. The problem is that when the texture repeats, we can see the seams of where each tile of the texture stops and ends. Part of this has to do with color, and part of it has to do with the breakdown of texture.
In this appendix’s tutorial we will look at removing seams from source photography. To yield a texture that tiles well across a form. But before that, let’s look briefly at a few tips on taking your own photography for use in textures.
Texture Photography Tips
1. Take the photo as straight on to the surface as possible. The lens of the camera and the surface of interest should be parallel. Getting a flat image will save loads of time and avoid all sorts of muddying of the image from over adjustment in Photoshop.
2. Don’t use a flash. Ever. Flashes create strange hotspots across the surface that are very difficult to work out.
3. Either take the photograph in the shade, or with the sun straight onto the surface. The key idea here is to avoid cast shadows from raised parts of the texture onto the surface itself. We want to make sure that a stucco wall isn’t locked into looking like the sun is at 3:00 PM in the afternoon (we’ll want to define that in our scene).
4. If available, use a telephoto lens and be as far from the surface as possible. Wide angle lenses will provide fish-eyed photographs where parallel lines (like mortar between bricks) are suddenly not parallel. A telephoto lens tends to collapse perspective and will keep your texture as flat as needed.
5. Take the photos to cover a big chunk of texture, but make sure you are capturing at a high resolution. A big 8000×8000 pixel image that covers a whole wall (that you’ll extract a small 512×512 image from) provides many more options than a tightly shot 512×512 one. In the end you’ll have the same sized texture, but the flexibility to pick the part of the texture that works best.
So, assuming that you have some good photography, or even mediocre images (my shot for this tutorial is included in the support files on the supporting website: www.GettingStartedin3D.com), we can start working through how to work the seams out.
Tips and Tricks
Try to avoid picking a chunk of texture that may include a very noticeable element that would stick out if repeated. For instance, don’t select a chunk that includes a bug on the wall, as that bug regularly repeated will certainly destroy the look of the material later. Similarly, look for a chunk that is as evenly lit as possible.
Tutorial B Creating Seamless Textures
Step 1: Open the original photograph (you can use mine or your own), and using the Rectangular Marquee Tool, select a chunk of texture that might work well for the texture base (Figure B.1).
Step 2: Copy and paste this selection into a new file. Save it as ColorResource.jpg (the file type here doesn’t really matter).
Step 3: Create another new file and paste the image into this one again. Save this as Stucco_Color.jpg (Figure B.3).
In a minute we are going to be stripping all the color from our Stucco_Color.jpg image. Seems strange now, but what this will do is set the stage to allow us to unify the color across the surface.
Step 4: Work in Stucco_Color.jpg and select Filter>Other>Offset. Change the Horizontal and Vertical sliders to values that allow you to see the seams somewhere in the middle of the image (Figure B.4). Hit OK.
The Offset Filter is of incredible use in texture modification and creation. What it does is offset all the pixels in one direction and then wraps those pixels that it pushes off the image around so that they come in on the other side of the image. What this means is that the right edge of the image matches perfectly the left (when using the Horizontal slider) and that the top and bottom edges match (when using the Vertical slider). It means that the seams are in the middle of the image – right where we can see them, and work with them.
In this case, a few things become instantly clear. First, the color of that stucco isn’t the same as it moves across the surface. Secondly, the texture has a crisp line break where one copy stops and the next begins. Here’s where our work begins.
Step 5: Remove the color by selecting Image>Adjustments>Desaturate (Figure B.5).
Notice that as soon as this is done, some of the seams become much less apparent – in this case the vertical seam practically vanishes. Getting a constant color balance across the image is a huge part of eliminating visible tiles. Not to worry however, we’ll get the color back into this in coming steps.
Step 6: Use the High Pass Filter to further unify the surface. To get to the High Pass Filter, go to Filter>Other>High Pass. Tweak Radius slider so that you are left with a further flattened image (Figure B.6).
Step 7: Use the Clone Stamp Tool to work out the still visible seams. To use the Clone Stamp Tool, Alt (or Option)-click on a spot to define a source. Then release the Alt/Option key, and where you then click and drag will clone the part of the image you defined the source as (Figure B.7).
The Clone Stamp Tool can be tremendously useful, but it’s usefulness is very situational. Sometimes, like for this stucco, a wide brush with a soft edge (defined up at the top of the Photoshop interface), provides a great way to work out the seam. But in other situations – say a collection of pebbles or bricks, using a much harder edged brush will allow you to work the seams out by cloning the exact edges of stones or bricks into place. Similarly, using a low Flow setting for the tool can sometimes allow for a very subtle layering of cloned pixels; but at other times it can just create a muddied mess across the seam that doesn’t work at all. It sometimes takes a bit of experimentation in each situation to find what works best with the asset at hand.
Step 8: Reintroduce color to the texture. To do this, first make sure that both Stucco_Color.jpg (which you’re working on) and ColorResource.jpg are both open in Photoshop. Then, select Image>Adjustments>Match Color. In the Match Color dialog box go down to the Source section and choose ColorResource.jpg. Click OK (Figure B.8).
What’s happening here is Photoshop is looking at the colors from our original ColorResource image and applying it to the gray-scaled version we have been working with. Photoshop looks at the luminance value of the pixels to try and match up what colors should be where – and it usually does quite a good job.
Step 9: Adjust Levels/Color saturation to taste (Figure B.9). I like using the Image>Adjustments>Curves mechanism.
Through the course of desaturating the image and then using the High Pass Filter, sometimes the image can end up a little dark and lose a lot of its contrast. After you’ve got a seamless image, taking some time to adjust the results can get you back to the initial look of the original photography.
Step 10: Save. Test (Figure B.10).
Seamless textures are important; and with the steps listed above are not too difficult to create. Keep in mind that much of the efficacy of this technique relies on the quality of the source photography. If it just isn’t working, go take the photo again to get the raw stuff you need.
At the end, there’s little excuse for not getting any surface to be just right. All you need to do is find its real world equivalency, and the texture can be reworked into a good seamless repeating texture to make your work unique.