Stock images for this tutorial
- BigStockPhoto: Title
Full Size Screenshots
Light and shadow can be used to simulate surfaces that aren’t as reflective as glass or metal. They can be used to simulate the texture and folds of a cloth curtain, for example. The technique described in this tutorial can be used to create folded napkins, towels, shirts that wave in the wind, or even giant theater curtains. And it’s fairly easy to use GIMP to produce realistic cloth surfaces. The first trick is to find a suitable texture, and the second is to use gradients to add folds.
Suitable textures can be found just about anywhere. In this tutorial we’ll use a stock pattern from GIMP called Gold Cloth. Textures can also come from photographs, stock image archives, or even scans of interesting patterns.
Gradients are then used to produce highlights—areas of light next to areas of shadow—in the cloth texture. Creating your own gradient is always a possibility, but this tutorial uses the GIMP’s Crown Molding gradient, one that has been part of GIMP’s package for many versions and provides ready-made waves of light and shadow that map to the folds we seek.
Cloth effects are more common in print advertising because the wrinkles can be difficult to see at the resolution required for web ads. The process for creating cloth is easily scaled, however. Here we work on an image that is slightly smaller than a real-world print ad would be, to illustrate the process in a way that doesn’t require a lot of memory.
Eventually we’ll make this image twice the size of the default canvas, but let’s start with a canvas set to 640 480 pixels.
- Open a new canvas by choosing File->New from the toolbox.
- Choose the Bucket Fill tool and in the Tool Options dialog set the Fill Type to Pattern Fill. In the text field below this option type Gold Cloth and press enter . Click the canvas to fill it with the pattern.
- Desaturate the layer (Colors->Desaturate) and then add an alpha channel to this layer (Layer->Transparency->Add Alpha Channel).
The Gold Cloth pattern comes in the gimp-data-extras package. If you don’t have these extras packaged for you, you can download them from GIMP’s web site or one of its mirrors: http://www.gimp.org/downloads/
The Gold Cloth pattern is suitable for creating the curtain. For this project need to change the cloth color, however, so we start by desaturating the layer.
Designing the Cloth
- Add a new transparent layer by choosing Layer->New Layer and setting the Layer Fill Type to Transparency. Name the new layer Texture.
- Open the Patterns dialog (Windows->Dockable Dialogs->Patterns) and select Paper.
- With the Bucket Fill tool still active, click the canvas to fill the new layer with this texture.
- Set the layer mode to Grain Merge in the Layers dialog. Merge this layer with the Background layer (Layer->Merge Down).
- Use the Colorize tool to colorize the layer (Colors->Colorize). Set the Hue to 30, set the Saturation to 75, and set the Lightness to -30. You can certainly choose another color, but this one happens to match the freckles of the boy we’ll add in later.
- Scale the image by 200 percent (Image->Scale Image).
- With the canvas selected, press minus to zoom out once.
It’s usually not a good idea to scale up a raster image like this one, but the details lost when we scale up the Gold Cloth pattern won’t be noticeable in the texture of the curtain.
- Add a new transparent layer by choosing Layer->New Layer and setting the Layer Fill Type to Transparency. Name the new layer Curtain.
- Choose the Blend tool from the toolbox. In the Tool Options dialog set the Gradient to Crown Molding, the Shape to Bi-Linear, and the Repeat to Triangular Wave. Drag from just left of center to just right of center horizontally across the middle of the canvas.
- Open the Gaussian Blur filter (Filters->Blur->Gaussian Blur). Set the Blur Radius to 5 pixels and click OK to apply the blur.
- Duplicate the layer (Layer->Duplicate Layer), set the duplicate layer mode to Overlay, and then merge the duplicate layer with the original layer (Layer->Merge Down). This last step just enhances the appearance of the folds in the curtain. In the Layers dialog set the layer mode for the Curtain layer to Overlay.
The Crown Molding gradient adds light and shadow to the Gold Cloth texture, giving us a first glimpse at the hanging curtain.
Creating the Left Curtain
- Duplicate the Curtain layer (Layer->Duplicate Layer). Name this layer Left Curtain.
- Temporarily turn off the visibility for the original Curtain layer in the Layers dialog.
- Scale the layer to 60 percent of its original width (Layer->Scale Layer), but leave the height unchanged.
- Align the left edge of the layers using the Align tool.
In the Scale Layer dialog there is a small chain link icon to the right of the Width and Height fields. If you click this link, it breaks and allows you to set values in one field without affecting the value in the other field. If the link is intact, changing the value in one field will automatically update the value in the other field because the width-to-height aspect ratio is maintained.
Scaling down the width of the Left Curtain layer squeezes it so its right edge is just right of center on the canvas. This allows the top edge of the Left Curtain layer to overlap the left edge of the Right Curtain layer when we drag the bottom of the Left Curtain layer to the left.
- Choose the Perspective tool from the toolbox. Click the canvas to display the tool’s handles, and then drag the duplicate layer’s lower-right handle to the left as shown. Click the Transform button in the Perspective Transform Information dialog to apply the change.
When using the Perspective tool, the canvas displays the layer in raw form so you can see how the changes affect the layer in which you’re working. When you click the Transform button, the raw preview is removed and the canvas is displayed as usual.
Creating the Right Curtain
- Duplicate the Left Curtain layer (Layer->Duplicate Layer) and name the new layer Right Curtain.
- Choose the Flip tool from the toolbox. In the Tool Options dialog set the Flip Type to Horizontal. In the Tool Options, set the Affect to Layer by clicking the first button from the left. Click the canvas to flip the layer horizontally.
- Turn off the visibility of the Left Curtain layer. Use the Alignment tool to align the Right Curtain layers right edge with the image, then turn on the visibility of the Left Curtain layer.
- Set the layer mode for both curtain layers to Normal, and then merge the Right Curtain layer with the Left Curtain layer (Layer->Merge Down). Set the merged layer’s mode to Overlay.
- Delete the original Curtain layer from the Layers dialog (Layer->Delete Layer). Rename the Left Curtain layer Curtain.
Changing the shape of the gradient layers makes it look as though the curtains have been pulled back. The Gold Cloth layer (which provides the texture for this effect) remains unchanged.
Parting the Curtain
- Temporarily turn off the visibility of the Background layer in the Layers dialog.
- Choose the Fuzzy Select tool from the toolbox. Click the Curtain layer in the Layers dialog to make that layer active. Click the transparent region of the canvas to select it.
- Feather the selection by 3 pixels (Select->Feather).
- Click the Background layer to make that layer active. Add a white layer mask to that layer (Layer->Mask->Add Layer Mask).
- With the canvas selected, press D to reset the foreground color to black. Drag the foreground color from the toolbox into the selection to mask out this area.
- Turn on the visibility of the Background layer.
- Deselect all (ctrl-shift-A).
- Apply the layer mask to the Background layer (Layer->Mask->Apply Layer Mask).
The selection created in the Curtain layer is filled with black in a white layer mask that is added to the Background layer. Where we fill with black in the mask, the Background layer becomes transparent (indicated by the checkered pattern).
- Click the Curtain layer to make that layer active. Merge the Curtain layer with the Background layer (Layer->Merge Down). Rename the merged layer Curtain.
- Open the Drop Shadow dialog (Filters->Light and Shadow->Drop Shadow). Click Reset, and then uncheck the box next to the words Allow Resizing. Click OK to add the drop shadow.
A drop shadow that is only slightly offset from the curtain adds depth to the image.
Adding an Image Behind the Curtain
- Open the image you’ve chosen to place behind the curtain—this one is of a freckle-faced boy. Copy the image, click the Curtain layer in the Layers dialog to make sure it’s the active layer, and then paste the image as a new layer by pressing ctrl-V and then choosing Layer->To New Layer.
- Move the new layer below the Drop-Shadow layer in the Layers dialog so the boy looks like he is peeking out from behind the curtain.
- Resize the layer that contains the boy if necessary and then use the Move tool to position the image appropriately.
The pasted layer might need to be moved so its edges overlap the edges of the canvas. Overlapping is fine because any part of the pasted layer outside the bounds of the canvas is unnecessary anyway. When you save the image as a TIFF or JPEG, those areas are simply cropped from the image. If you save the project in GIMP’s native XCF format, however, those overlapping areas are saved in their layer.
A freckle-faced boy peeks out from behind the parted curtain.
As you can see, using a wave-filled gradient in combination with a layer that contains texture is the key to simulating cloth. There are many ways to generate a flowing pattern that can then be used to add even more texture to the image. The Crown Molding gradient is only the most obvious choice. The Pattern dialog’s Contra Swirl pattern can serve as a blend layer as well. In fact, many of GIMP’s stock patterns can be used with this technique. While the pattern’s original form might not be suitable, all that’s required is to desaturate it and then use the Gaussian Blur filter to apply a generous blur, mixing in adjustments with the Levels or Curves tools to achieve a smooth gradient.
As a further step to this project, try using the IWarp filter (Filters->Distorts->IWarp) to add a curved appearance to each side of the curtain. You’ll have to do this before merging the various layers, but the result will be something a little more realistic.