Photoshop Question: Distort rectangle without perspective

Started by Snarky, Fri 04/09/2009 17:21:02

Previous topic - Next topic

Snarky

I'm looking for a way in Photoshop or some other image app to distort a rectangle by moving the corners, without applying perspective to it. In other words, I only want to stretch things in the direction that I'm moving the corner, with no change to the other dimension.

Here's an example of the effect I'm trying to achieve:

This                                                      as opposed to this
   
(Notice that in the first example, the vertical scale doesn't change, while in the second the horizontal lines are pushed up by the perspective effect.)

I haven't been able to get Photoshop to do this (I made the example by keeping the horizontal grid on a separate layer). Do any of you know of a way, or of another application that can?

Blue

Try this:
Ctrl + T to toggle transform on the rectangle.
Then right click in the transform area, and choose 'Distort'.
Now you should be able to pull the corners as you like without applying perspective.



Khris

Distort will produce the right picture.
I got it to work using warp, but you have to realign the distortion handles after moving out the corner.

Misj'

Quote from: Snarky on Fri 04/09/2009 17:21:02I'm looking for a way in Photoshop or some other image app to distort a rectangle by moving the corners, without applying perspective to it. In other words, I only want to stretch things in the direction that I'm moving the corner, with no change to the other dimension.
Depending on your requirements you can choose to use vector software (and set the line-thickness independent of scaling). Both Adobe Illustrator and Corel Draw should be able to create this effect...but as said: it depends on your requirements (for the entire project).

Snarky

Like KrishMUC says, "Distort" creates the version on the right, not the one I'm looking for. (It's doing the same type of stretching as Perspective, it just restricts you to stretching in only one direction at a time, and also moves the other corner symmetrically.)

Warp kind of works. Thanks. It's clearly doing the right thing, but it's fiddly to use, and since you have to place the distortion handles by hand it's never going to be perfect (also the handles don't snap to grid lines or guides, and SHIFT to only move vertically or horizontally doesn't work either). I was hoping for something that works like "Distort" but with linear instead of perspective stretching.

Wonkyth

I seem to remember achieving the left-hand effect in GIMP, but it's been a while since I used it...
"But with a ninja on your face, you live longer!"

Snarky

Thanks Misj' and wonkyth. I've tried Illustrator and Gimp.

Illustrator has a version of Warp that is easier to work with than the one in Photoshop, but I still have to eyeball the distortion handles. It works OK if you're only doing one corner along one axis like in the example, but it gets pretty messy if you're trying more complex transformations.

The Gimp tool I could find that seemed most relevant is "Curve Bend". You have to struggle with the Gimp's atrocious interface, but if you set things up correctly it does become possible to displace one corner along one of the axes (but you can only stretch, not squeeze, as far as I can tell). The biggest problem with this is that the quality of the transformation is very poor, with obvious jaggies.

I'm still hoping there's a tool or an app where I can just drag the corners of a transformation area and get a linear interpolation in between, without any perspective effects.

Matti

Have you asked / seached in a Photoshop or Illustrator forum? I got some useful infos on several issues that way (even without asking).

Snarky

Well, I've more or less concluded that there isn't anything like it in Photoshop or any of the Adobe products. I even went back and tried an old version of Photoshop, in case they used a different distort algorithm back then, but no. Paint Shop Pro, Paint.NET and The Gimp don't have it, and I don't see anything about a feature like it in any of the other painting apps listed in the Critics Lounge. I think it's time to give up.

Annoyingly, it's a very simple transformation to calculate. If we have an initial rectangle ABCD, with A at the origin, and we call the top edge (AB) vector t, the left edge (AD) vector l, the right edge (BC) vector g (because of the forums' stupid text-style spelling problem with the letter R), and the bottom edge (DC) vector b, and we then move any or all the corners except for A to give us new vectors t', l', g' and b', the new position of any point within the rectangle given by (x,y) (each scaled to the range [0,1]) is:

x * t' + y * (x*g' + (1-x) * l')

(We don't need to use b' because the new tetrahedon is fully specified by three vectors.)

The inverse of this calculation, which is needed to fully paint the transformed rectangle, is somewhat more tedious to find, but shouldn't be beyond a halfway competent graphics coder.

Icey

hey i just had to enter to no what paint app does you all use photo shop i use paint for now

Wonkyth

If it's that easy to calculate, then why don't you just make a plugin?
"But with a ninja on your face, you live longer!"

Snarky

Well, I'd need to do the whole UI to let you move the vertices and so on, wouldn't I? Preferably with instant preview and all of that. And interpolate between pixels in order to get a smooth transformation. Even if the basic formula isn't hard, creating a fully functional plugin would still be quite a bit of work. Besides, I have no idea how to write Photoshop plugins.

SMF spam blocked by CleanTalk