Making Convincing Seamless Textures From Photographs

download Making Convincing Seamless Textures From Photographs

of 14

Transcript of Making Convincing Seamless Textures From Photographs

  • 8/4/2019 Making Convincing Seamless Textures From Photographs

    1/14

    Making Convincing Seamless Textures from Photographs

    Textures can be extracted from most any picture but anyone who has snapped a picture of

    some grass and tried to use it in a 3D rendering has discovered that converting a picture to a

    texture can have its challenges. One of the first things you should consider when making a

    texture from a photograph is whether or not to make the texture seamless. Why make atexture seamless? The image may be smaller than the modeled object and will have to be

    repeated over its surface. This is obvious if you want to create a large field from a picture of

    some grass but this scenario can come up with most any object. If the image matches the size

    of the object, but the texture is rapped completely around it so that the edges meet, they

    should meet without a seam (unless the seam can be hidden). PhotoShop has made digital

    editing of photographs very easy. However, making a convincing seamless texture requires

    more than just a few swipes with the clone tool. This tutorial assumes the reader to have at

    least some experience with Photoshop.

    Part 1. Shading

    A good seamless texture should not only tile without a visible edge, but it should also not

    show the evidence of a manipulated edge. For example, as is the case with many raw photos,

    there is a subtle difference in the shading from the top to the bottom of the photo shown

    below. This shading becomes quite apparent when an offset (with wraparound) is applied.

  • 8/4/2019 Making Convincing Seamless Textures From Photographs

    2/14

    As shown below, using the clone tool will remove the seem but leave a sharp transition inshading. Such a transition is often just as bad as the seem.

    Fortunately, if the shading is not too severe, it can usually be corrected with an adjustment

    layer. The worst of the shading discrepancies will be at the edges of the image. You may

    want to crop off a small amount to start. Go to Filters and apply an offset with wraparound.

    Place the seam about two thirds down the image as shown above. Select two thirds of theimage being careful to place the marquee right at the seam. Insert an adjustment layer and

    choose curves (or levels if you prefer). Don't worry about the adjustment yet. With the

    selection still active, Click on the layer mask while holding the option key to make it visible.

    Select the gradient tool with the foreground 100% white and the background 100% black.

    Starting near the seam, drag a large gradient that fills most (but not all) of the selection. Be

    careful not to apply any angle to the gradient. Inverse the selection and fill it with black. The

    layer mask should now look similar to the image below.

  • 8/4/2019 Making Convincing Seamless Textures From Photographs

    3/14

    Click to make the image visible again and deselect. Now, apply the curves until the shadingmatches at the seam. Merge the adjustment layer down to finish the correction.

    The seams can now be removed with the clone tool without obvious artifacts from the

    original image.

  • 8/4/2019 Making Convincing Seamless Textures From Photographs

    4/14

    Part 2. Perspective

    Unless you take your picture with a telephoto lens, your pictures will likely have some

    perspective. Even if you snap a picture of a wall facing it squarely, the center of the wall will

    have a different perspective than the edges. The edges may meet when you apply the offset

    but the center of the image will be larger than the edges and there may be a visible wave as

    you tile your texture several times. Likewise, some objects, like a tree trunk, naturally

    telescope. You want this in your model but it can be a pain when trying to make your texture.

    Perspective must usually be corrected when you have multiple lines crossing your image. The

    example shown is that of a stone wall. We want to preserve the top of the wall in this case

    and just tile in one direction (using a transparency map to remove the unwanted top sky

    portion of the image).

    The problem is that one edge of the image is slightly smaller than the other. A rotation will

    not fix this and trying to use the clone stamp to build up one side of the wall is inefficient and

    would most likely degrade the realism of the image.

  • 8/4/2019 Making Convincing Seamless Textures From Photographs

    5/14

    A much simpler solution is to use distortion. In this case, the bottom of the wall seems tomatch up well so we need only manipulate the top. Duplicate the background layer and

    highlight the new layer. Select half of the image at the seam and go to edit->transform-

    >distort. Now, carefully drag the corner down so that the top of the wall moves down half of

    the distance to the top of the wall of the other edge. Avoid the temptation to move the image

    all the way down and call it finished. This will not only create a wave in your final image but

    you have also needlessly over-compressed one half of your image.

    Now, select the other half of the image and, using distort, expand the image up until the top

    edges of the wall meet. You are now ready to remove the seam.

  • 8/4/2019 Making Convincing Seamless Textures From Photographs

    6/14

    Part 3. Attention to Detail

    Here is another texture we want to tile in only one direction. It can be used as trees in the

    background of your renderings where not too much curve to the tree needs to be modeled

    (this way we can easily preserve the peeling bark of the tree. The image can also be made to

    tile in both directions if you need a full tree model. First, the image is rotated so that one edge

    of the tree trunk is vertical and then cropped to an appropriate height (try to get as much of

    the tree as you can before the tops and bottom of the image starts to show too much

    perspective. Even though the very base of the tree usually shows plenty of character, we will

    need to crop off the base since we are tileing this image rather than just creating a cutout.

  • 8/4/2019 Making Convincing Seamless Textures From Photographs

    7/14

    First, we apply the offset (A), then correct for perspective (B) and shading (C) as described

    earlier.

    Now, if we try to remove the seam with just a few swipes of the clone tool, we get something

    very unsatisfying.

    The problem is that the elements of the top and bottom half of the image do not match. There

    are long lines that abruptly terminate at the seam. Even if the lines were short, your eye

    would still pick up a horizontal line where all the vertical lines terminate. What we need to do

  • 8/4/2019 Making Convincing Seamless Textures From Photographs

    8/14

    is extend some the elements from the top half down to the bottom half and vise versa. So,

    being a little more careful with the clone tool, we can achieve the following image.

    This looks much better. However, it can be improved. One weakness of the clone tool is that

    it can only duplicate. This can be quite limiting if you are trying to manipulate large areas of

    your image. It may also be difficult to find a needed element to copy. The above image, for

    example, has a large reddish feature at its center that dose not terminate at the bottom

    realistically. There are not many choices of elements in the image to clone and create a good

    termination. However, If you look to the upper left, there is a reddish element that can be

    used for a termination, only it is pointing up instead of down. Not a problem with Photoshop.

    Select the element and copy. Make sure you copy plenty of area around the element rather

    than trying to be careful at this point. Now, paste the selection into an empty layer and flip

    the layer (edit -transform-flip vertical). Mover the layer to where you want it and start erasing

    the unwanted portions. Adjust the hardness of your brush so that you have a soft edge but are

    not blurring the important portions of the layer. When everything looks right, merge the layer

    down.

  • 8/4/2019 Making Convincing Seamless Textures From Photographs

    9/14

    "

  • 8/4/2019 Making Convincing Seamless Textures From Photographs

    10/14

    When looking at a picture you are about to convert to a texture, one should consider what the

    image will be used for in order to develop a strategy. Take a look at the image below. There

    are several things to consider.

    There is noticeable perspective. There is a white electrical line that runs along the bottom. The plank at the top is a noticeably different color than the other planks. The planks on the bottom have noticeable knots that are absent in the top planks. Most of the planks terminate within the image but two of them do not.

    Some of these items may help or hinder the texture depending on the intended use. The

    perspective is obviously a problem so we will use edit->transform->distort to remove theperspective. But before we do that, we should determine how much of the image we want to

    keep. If we don't plan on tileing, we should keep as much of the image as we can. Chances

    are, we will want to clip off the electrical line anyway. And the top plank? If you are not

    going to tile, this plank adds realism to the often too-perfect world of computer graphics and

    should be kept. But what if you are going to tile? This plank now becomes a bulls-eye mark

    for the brain to see a repeating pattern in what should be random planks. However, there are

    enough planks here that you may not need to repeat the entire tile to cover the object surface

    (say the wall or deck is relatively small). If this were the case, you could keep the plank for

    the detail it brings to your image and adjust the position of the texture so that this plank does

    not appear twice on the surface. If you do want multiple tileing and crop off this plank, you

    are still not home free. The bottom two planks have a distinctive set of knots that could bejust as eye-catching as the odd-colored plank. If we crop off all three, you are left with a

    small number of planks which will require more tileing and may, again, look artificial at the

    final rendering. So, let's keep all of them and deal with it later. We correct for perspective and

    crop.

  • 8/4/2019 Making Convincing Seamless Textures From Photographs

    11/14

    In attempting to correct for perspective, make sure all of the lines match up the best they can.I found it easier to correct the top portion, crop the image (cropping between the planks being

    careful to grab all of the "between plank" area at the top and none of it at the bottom-left

    corner. I then corrected the perspective at the bottom by pulling the bottom-right corner of the

    image down so that the edge of the plank just touched the edge of the image. Now, Filter-

    >other->offset in both x and y.

    This looks pretty good. However, some of the planks don't line up exactly.

  • 8/4/2019 Making Convincing Seamless Textures From Photographs

    12/14

    We can fix this using Edit->distort to make some fine adjustments. We make two selectionsand distort one side to make the plank lines meet. This does leave artifacts that will have to

    be removed.

  • 8/4/2019 Making Convincing Seamless Textures From Photographs

    13/14

    Before we turn to the clone tool, a couple of the planks butt together with a noticeable color

    change.

    There are a few ways to address this but one quick way to blend the color without loosing the

    detail is as follows. Using the eyedropper (set to 5x5 average), select two representative

    colors on one side of the seam. Select a square marquee covering a portion of the plank on

    the other side of the seam. Create a new layer and use Filters->Render->Clouds and fill the

    selection. Use the eraser to smooth out the edges and the transition (don't touch the seem).

    You now have something like the image below.

    Change the layer blanding from "normal" to "color", make the transparency about 50% and

    merge down. Now, with a few swipes of the clone tool we have a seamless texture. Don'tforget to clone in terminations for those planks that don't have any.

  • 8/4/2019 Making Convincing Seamless Textures From Photographs

    14/14