Texture mapping is the process of colouring the surface of a 3D graphic with an image. Typically, this picture might be a repeating or "tiled" texture to make the object look like wood, or stone, or anything else that takes your fancy. It could also be a self-contained picture, such as the spots on the side of a cube that turn it into a gaming die, or the label on a cylinder that turns it into a soup tin. Either way, this is obviously the kind of feature that you'd expect in a 3D graphics package. Not so obviously, it also exists in Adobe Photoshop, and even in the less expensive Photoshop Elements.
My interest in the 3D Transform filter effect, which was built into these programs, was piqued by the 3D extrusion and lathing features found in Adobe's latest vector graphics package, Illustrator CS. The problem with vector art, however, is that it never looks real unless you're prepared to spend days on the detail. Why not start with real photographic images and apply texture maps to them, instead?
The problem with photo images is that they're strictly 2D, meaning there are no surfaces to wrap. But bear in mind that 3D graphics are merely computer-generated optical illusions - your screen, printouts and final rendered graphics are merely 2D. So all that matters is preserving the illusion of 3D, which is something that you can still do in Photoshop Elements.
As an example, I've picked out a photo of a dirty coffee mug and quickly prepared a 2D graphic - assembled from some clip art - which I'll be using as a texture map, and you can see both images in this screenshot. The plan is to apply the graphic to the mug surface so that it looks as though it has been glazed - a classic texture mapping task.
Shearing or rotating the graphic won't work, because the mug is cylindrical. Worse, the mug tapers outwards towards the top. Worse still, the photo was taken close-up and slight from above, causing perspective distortion. To finish off this challenge, the lipstick and coffee stains already on the mug must appear over the top of the graphic, not obscured underneath it.
Begin by opening the two images side by side as shown above. Switch to the Move tool in the main Tools palette, then drag and drop the 2D graphic on to the mug. This copies it over and puts it into a new layer over the original image, as shown in this screen shot . Note that the graphic needs to have a transparent background, otherwise you'll blot out the mug completely. If necessary, resize the selected graphic using the Move tool, but don't worry about its position just yet.
What a transformation
Go to the Filter menu, choose Render and pick 3D Transform from the submenu. A 3D Transform window appears in which the current layer (the clip art graphic) is represented as a greyscale image preview. Set the Camera Field of View value to 50.
You can map the graphic to a virtual cube, sphere or cylinder. Since the mug is closest to a cylinder, click on this tool and drag a rectangle shape over the graphic preview. You will see a basic cylinder shape appear as a graphic wire frame. To reposition and resize the cylinder so that it sits directly behind the graphic, use the Selection tool (black arrow).
Next, you must adjust the cylinder to match the initial appearance of the 2D graphic. Switch to the Direct Selection Tool (white arrow), then click and drag upwards from the centre bottom point of the cylinder until the curve becomes a flat horizontal line.
Click on the arrow next to Camera Field of View to make its slider appear, then drag towards the left in order to flatten the top of the cylinder as well. Depending upon the size and shape, you'll normally end up dragging the slider to a value somewhere between one and 10. To complete the shape, use the Direct Selection tool to widen its mouth slightly, mimicking the general shape of the mug - see screen shot
Now switch to the Trackball tool (a black ball with a single rotation arrow around it) and drag downwards over your graphic preview. Spend a few minutes adjusting the Dolly Slider, the 3D rotation and the taper of the cylinder as necessary. You are trying to match the shape and perspective angle of the mug image.
Click OK to accept the changes, and return to your main image window. If you have been reasonably accurate in mimicking the 3D aspect of the mug, it should now be a simple task to reposition the graphic layer with the Move tool so that it appears to be part of the mug itself. You can get away with minor discrepancies, though I'd suggest that it's better to over-emphasise the rotation angle in the 3D Transform filter window to get a strong, curvy perspective, even if it's too extreme to be wholly realistic.
Depending on how closely you followed the instructions for the 3D Transform window, you may also end up with a large grey ellipse where the cylinder mouth should be. Simply drag a marquee over this using any selection tool and tap the Backspace key to delete it.
But the graphic still obscures the lipstick and coffee stains. Open the Layers palette and change the Transparency blending mode for the graphic layer from Normal to Multiply. This causes the colours in the two layers to mix and darken as though you were overprinting inks.
Although the graphic layer is still sitting on top of the mug, logic tells the human eye that the stains must be running down over both. The end result can be seen in this screen shot.
Now that you've got the hang of this particular technique, experiment further by wrapping graphics around cuboids and spheres. n
Where's my 3D Transform filter?
If you're attempting this tutorial with Photoshop CS (Creative Suite), you may find that it doesn't appear to a part of this application's toolset. This is because it's no longer installed by default, but you will find it if you look on the installation CD.
Look in the "Resources and Extras" CD, browse to Goodies\Photoshop CS\Optional Plug Ins\Filters, and copy the file 3Dtransform.8BF into the Program Files\Adobe\Adobe Photoshop CS\Plug Ins\Filters on your hard disk.
The next time you open Photoshop CS, you'll find the 3D Transform filter under Filter-Render-3D Transform.
The 3D Transform filter isn't included in the default installation for Photoshop CS, but you'll find it in the Goodies folder on your installlation CD-ROM.