
If you work with pixel addresses instead of the pixels themselves, you can smear (or ray trace) now, and decide which image it was you were smearing (or refracting) later.

Take a linear horizontal red grad and add it to a linear vertical green grad. This will give you an image of absolute pixel addresses - or what some might call an image of UV values.

In such an image, you can calculate any pixel's position if you know its color, and you can determine its color if you know its position. That's what makes it an image of absolute pixel addresses.

Grab a hunk of these absolute pixel address from anywhere you like and move them to any other place on the image that you like.

Next subtract the modified image of absolute pixel addresses from the original image of absolute pixel addresses. This will give you an image of relative pixel displacement offsets.

Here are the relative pixel offsets. Notice that any chunk of addresses that was moved horizontally became a shade of red with an intensity proportional to the distance it was moved. Any chunk of addresses that was moved vertically is green. Those that were move diagonally are yellow.

You can move the pixel addresses using any technique you like. Put a refractive object in front of the original UV image and raytrace into it. Or smear it using a Photoshop tool, if you like, which is what I did in the example above.

After you subtract the smeared UV image from the original UV image, you'll end up with a displacement map of pure relative smears.

Here's another example.

After the subtraction, it looks as above.

Using this technique, you can smear in "address space" and then later apply the smears (or refractions or what have you) to an image after the fact.

What's more, you can change your mind later, and swap one image for another.
One last thing: there are some issues with using the difference blend mode in Photoshop. That blend mode returns absolute values, even in cases when a true subtraction would return negative numbers. There are some issues with Photoshop displacement as well. Instead of using negative numbers, zero, and positive numbers to control displacement, Photoshop uses dark colors, middle gray, and bright colors to control it.
If you want to explore this yourself, you might be better off using Shake, which can handle the negative numbers during internal calculations in a way that Photoshop can't. To see the Shake version in action, check out UV Map Now or UV Map Later.
If you want a better idea of the "gotchas" in Photoshop displacement, the gory details are here
UPDATE 5/10/2009
In Distort Photoshop Filter Without Distorting Image I clued in to the idea of using channel calculations to compute the correct vectors.

Leave a comment