A man who dares to waste one hour of time has not discovered the value of life.

Gimp Tutorial - Reflections of Non-Flat Objects

Tue Apr 27 20:12:30 2010

Instructions on how to create reflections for objects that aren't completely flat.

Creating reflections for text or web buttons is a fairly trivial task and there are a lot of various tutorials describing the process. However, the process changes and might not be exactly obvious for objects that are shown as being three-dimensional.

In this tutorial, I'll show you how to make a reflection of something simple: a product that is pretty much a box:

Touching Edges

The first step is to find the edges of the object that are touching our virtual plane. This would vary from object to object, but for our box-like object it's the bottom two edges that I've highlighted with red here:

Note: keep in mind that anything below the edge must be transparent, or it will interfere with our reflection. Also, in futher steps for the "math" to work the side-edges of the object must be the edges of the layer. It's up to you whether to cut out the sides, or to use the shear manually... more on that in just a bit.

Starting Point

Let's start with our reflection. In the beginning, the process is the same as for flat objects:

  • Duplicate the layer with your object. (Layer -> Duplicate Layer)
  • Flip the duplicate layer vertically. (Layer -> Transform -> Flip Vertically)
  • Use arrow keys to move flipped layer straight down until the lowest point of our object on the original layer is about 1 pixel apart from the highest point of the object on the flipped layer (see image below).

The 1 pixel apart is the distance that defines the thickness of transparent substance, on which the object stands, that covers the reflective substance. I usually use 1 pixel value here, but feel free to play around. Here is what my image looks like after the steps above:

Splitting Sides

Now, our reflection needs to touch all the edges that are touching our imaginary surface. It's the ones I shown in read in the beginning of this article.

To do so, we need to first split all the edges into separate layers. You would do as many splits as many touching edges you have; in our image we only have two.

Use the rectangular selection tool and select the entire side of the object that corresponds to one of the edges. Something like this:

Note: if your edges cannot be prefectly split using the rectangular selection tool - as in my speaker example at the end -, simply use the Path Tool and "Path to selection".

Now, to place that edge on a new layer, simply do Cut, Paste. The pasted layer will be a "Floating Selection", so make sure to go to: Layer -> New Layer.

Finding Slope

Note: If the side edges of the layer with your object do not touch the object, this math won't work. If that's the case, simply skip this step and use the shear tool manually - i.e. just click and drag until the angle looks right.

Next step is to find out the vertical distance between two end of each of the edges. I'm going to use the rectangular selection tool for this purpose and simply drag the selection from one point of the edge to the other and see the distance as the size of the selection box:

Shifting and Sliding

Before we proceed, I want to take all the vertical distance values for each of the edges (the ones you found in the previous step) and multiply them by two. The values you get is what you'll use in this next step. The reason for this multiplier is simply due to the way shear tool works.

Select the Shear Tool (SHIFT+S), select the layer of one of the edges of our reflection and click anywhere on the canvas.

The Shear Tool dialog will pop up. Leave the "X" value at zero, and for the "Y" plug in our vertical distance values that we calculated and multiplied. Depending on how the side is sloped, you might have to make your "Y" value negative. For my left edge, I'll use a positive value, and for my right edge, I'll use a negative one.

Here's my canvas after shearing:

Note: if you have a good eye, you might prefer to avoid the math and simply click-n-drag with the shear tool to attain proper angle for the edge of the original object to tightly match its reflection.

Note: depending on your object you might find it hard to have the ends meet while shearing. If that's the case, give the Perspective Tool a whirl.

Final Touches

The only thing left is to add the fade out our reflection:

  • Merge all the split edges of the reflection into one layer. (e.g.: "Layer -> Merge Down" while one edge layer is selected and another layer is the next down in the list)
  • With the reflection layer selected, go to Layer -> Mask -> Add layer mask
  • In the resulting dialog, select "White (full opacity)" and hit "Add" button.
  • Select Black as foreground color, White as background color and use the Gradient Tool with these settings (should be default):
  • Drag the gradient completely vertical from about the 1/3 from the bottom of the reflection to 1/3 from top of the original object. This is really "to taste", whichever reflection is most likable to you.

Here's my reflecting product:

More Final Products

Here are a few more examples of what the final effect looks like. Enjoy!

Here I used the Path Tool to separate the edges because the speaker is slanted, which makes it impossible to use the Rectangle Selection Tool:

Here the Path Tool came to the rescue again. As you can see, I cut the side edges of the cube out and sheared them... and the top would not be visible in the reflection: