Tutorial: Textures from photos (photoshop)

Tutorials and discussions about Mapping - Introduce your own ones!
Post Reply
Myth
Inhuman
Posts: 988
Joined: Tue Feb 12, 2008 5:57 pm
Personal rank: Low Poly Freak

Tutorial: Textures from photos (photoshop)

Post by Myth »

I'm not very good at writing tutorials.
I'm using Photoshop for this because over the years it has become the standard in image manipulation. But the tools I'm using are generally available in all image editing software.
This one does require you to know basic things. You should know: layers, selections, brush tool, stamp clone, filters, layer blending and mixing, color correction, layer adjustments. These are the basics of photoshop and most image editing software on which you build your knowledge of filters and ways to make something.
If there are any questions just post em up and if something isn't explained clearly enough I'll patch this up.
So here we go:

I took this photo:
A part of a photo. No modification was done... yet
A part of a photo. No modification was done... yet
I've cropped down the usable part of it. The edges are useless for textures. As you may notice there is a lens distortion. This is because the camera was too close to the wall. However I don't care because the wall doesn't have any structure and the end result will be a base texture that's good for layering with other textures.

Here are some guidelines when you're taking photos for textures. Not that I actually did but these will help you:
• Don't go too close. Get as far as you can from the surface while still getting all the detail. Too close shots will be extremely distorted.
• The surface shouln't get light from an angle. (no sunsets and no sunrises)
• NO FLASH.

However you can correct using software:
• Lens distortion
• Colors and lighting
• Perspective

But these corrections will cost you on your time and if you don't do them properly your textures will look worse.

So now that I've got a photo to work with I crop down the unnecessary parts. You can do this with the rectangle select tool in Photoshop.
Open the *.jpg. Select the desired area. Copy (edit>copy or ctrl+c) Hit new. Press OK. Now you got a new canvas. Paste. (edit>paste or ctrl+v)
As you can see I have a cropped down version of the original photo loaded in Photoshop.
Image

Now it's time to decide what to do with this to get a texture that's suitable for other purposes. I've already said it will be a base texture that can be used as a layer to other textures. So first it must be seamless and mostly matte.
As you can see there are some differences in light. So first I'm going to get rid of these. Generally all photos you take will have differences of light that you have to fix, even if you don't notice it.
This like many other steps can be done in many ways. One of which involves taking out the brush and manually modifying the picture. Slow and boring.
So I decided to do something that works faster. First I duplicated the current layer and massively blurred the new layer using Gaussian blur. You can find this in the filters menu.
Image

Now I apply a gradient map that goes from white to black. This can be found under layer effects.
You can alternatively convert it to gray-scale and invert it.
So now I have something that's like a reverse light-map.
Image

Make sure that this inverse light-map is on top of the original and test around with the blending modes and transparency until you get the most uniform texture as possible.
I think I used vivid light but overlay and screen should be good too. The light differences are quite big in the original photo. Not something you want in you source photos for textures so I also got some discoloration.
Image

I create a new layer on top of everything. Set it's blending mode to saturation. Now all layers below this one will have this top layer's saturation. Not really recommended for photos that have more colors but for something as basic as this it's the perfect tool.
I pick a color from the image (alt + left click) and set the now layer to this color using the brush tool. You can also use the fill tool. Now those vivid spots have disappeared.
Image

Finally some manual color correction. I've created yet another layer and set its blending mode to color. Again I pick a color or use the one I've already picked. Using the brush tool I make some soft strokes around the problem areas and voila.
Image

Now you've got this nice and uniform texture that can be used for skinning and even layering. This is your pure texture material. It contains all the features of the original photo. You can add your own touches to it. You can mix it whit other texture or sharpen it now or color correct, whatever you wish.
Midway after fixing the lights and colors a bit.
Midway after fixing the lights and colors a bit.
Export it or whatever. I've merged all the layers. This is done by right clicking on layer and then you have the option to merge visible layers.

Our goal now is to create a texture that is seamless. This is done by stitching together the texture we've just made in a way that its seamless.
Here we again have lots of possibilities. You can grab lots of small parts of the texture and order them randomly on a new canvas.

A quick and painless method it is to use the offset tool and fix the seams with the clone stamp. You can find tutorials for this all around the web. Like this one: http://www.photoshoptextures.com/textur ... xtures.htm
(website also has textures and 1 more tutorial)

But I'm going to show you a more professional method.

First you grab 2 rectangular areas and place them on a new canvas.
You do this again with the rectangle select tool. You can make sure that it's a perfect rectangle by pressing shift while you select the desired area. Copy. Create a new canvas. Paste it there. Go back to the first image. Move the selection. You can move it by dragging it around. Hit copy again. Go to the new canvas where you pasted the first area and paste that there too.
I've highlighted 2 areas that can be grabbed from photo. They shouldn't overlap much. Grab the parts you're interested in. You can create more textures from a single photo this way. Dirtier ones, cleaner ones.
Image

Okay now you should have 2 layers on top of each other containing the different areas. Now I resize it to 512x512. If you want your textures to be use in UT, they must be power of 2. 128x128, 256x256, 512x512 or even 32x128. You can do this in image menu. Click there on the image size.
Image

Now we'll use the offset tool on the top layer. This is found in the filter menu. (filter>other>offset). Set the amount to half of the image size and make sure to wrap the pixels. This will place the seams that are usually on the edges on the texture to the middle of the screen. You can see a cross in the middle of the image.
Image

Now take the eraser tool and erase the seams. Where you erase you see the bottom layer. The bottom layer has its seams at the edge so keep away from the edge.
Image

Great, now the texture is basically finished. You can check if it's seamless by applying offset again and messing around with the offset values. You can make final adjustments with the paintbrush. Color correction, ect.
For final touches I removed that ridiculously large whole using the stamp clone tool because that would look bad on a tiled texture. Sharpened the bit. You can find sharpening filters in the filters menu. Modified the color a bit. You should try to keep the luminosity of the texture at around the rest of the textures in UT. The textures in UT are rather darkish, middle of the spectrum. Neither too bright, neither too dark.
The final texture stitched together, ready to use.
The final texture stitched together, ready to use.
To import it into UT you have to set the image to use an 8-bit palette. This is done in the image menu. Image>mode>indexed color. A dialog will appear where you can set the parameters. Select a local palette. (adaptive or whatever) and color limit to 256.
Now you save it either as a
8-bit RLE Compressed PCX file or
8-bit Uncompressed BMP
These are the 2 file-types that can easily be imported. I recommend using BMP because it's web-compatible and windows-compatible. You can see their thumbnails and post them on web. ect.

So yeah, here it is loaded in Unrealed:
Image

Ingame:
Image

Finally I've attached a zipped version of it that you can download:
ww.zip
Zipped version of the importable texture file. It's not PCX but Unrealed can import this no problem whatsoever.
(189.02 KiB) Downloaded 148 times
Great, now you can apply your newly acquired knowledge in your future maps or even start building your own texture library for all kinds for projects.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Tutorial: Textures from photos (photoshop)

Post by JackGriffin »

Seamless texture generation should be required reading for all UT mappers but you see few of them. Very well done tutorial :tu:
So long, and thanks for all the fish
User avatar
Creavion
Godlike
Posts: 4497
Joined: Sun Feb 17, 2008 7:23 pm
Personal rank: About to be non-act.
Location: Germany, Lower Saxony

Re: Tutorial: Textures from photos (photoshop)

Post by Creavion »

I only quickly checked it, however it really looks like a good tutorial.
About to be non-active
My very last UT map project: CTF-FacePalm (tropical CTF-Face remake)
Why do I leave? click here
What I want to do next: Joining an UDK team (uncertain however) and improve 3D modelling and texture editing skills
Thanks to those who visibly supported me until/at the end!
My reactivated account on indiedb.com.
Post Reply