Rotation after scale distorts


I am doing the following transformation to some images which are being displayed as textures in a Quad node:

  1. scale
  2. translate
  3. rotate

Since textures are loaded as squares, I am scaling X and Y with different values in order to get the original proportion of the images.

For some strange reason, when I rotate after scaling the rotation distorts the image, stretching it depending on its proportion. How can this be avoided? How can I rotate a rectangular image maintaining its aspect ratio without distorting it?

This doesn’t happen if I rotate before scaling, but I think I really need to maintain that order.

Why? Well, my problem is that I have some translation, rotation and scaling values already in a file. These are being used in a “Processing” sketch and they work fine with the above order. Unfortunately “Processing” has a memory leak bug related to the use of many images in OpenGL mode so I decided to reimplement the project using vvvv. Now I’m trying to get the same transformations to happen but I still didn’t get it right. I need to get exactly the same layout when I overlap several images but for some reason I keep getting different results.

Thanks in advance,

hmm. clear enough a rotation after a scale behaves different than the other way around.

if you dont want to change the aspect ratio when rotating, you should scale first, then rotate.

this means that the Scale node should be closest to your Quad, and the Rotate node should be connected to the input of the Scale node.

I always forget in what order the transformations in the Transform nodes are implemented… anyone?

there must be a way ;) if you are using processing/openGL i am quite sure that it uses matrix transforms like they are in vvvv. but, since AB is in most cases not BA its very important to figure out the multiplication order in processing. if you know that, patch the same order in vvvv. you can do this either by chaining them or using * (Transform) .

another thing is the projection matrix, maybe you are using an orthogonal projection in processing…?

and you can post your transform code here…

Hi tonfilm,

Thanks. Here attached are both versions of my project, the Processing version which displays it correctly but crashes after 20 minutes and my attempt at porting it to vvvv.

As you can see from the Processing version my goal is to overlay several pictures of this girl in a way that her eyes are in sync.

If you have the time and patience please have a look.

Note: pictures contain some nudity.

Please understand that the vvvv version is a little messy. Particularly the “barbara_texture” patch in which I was trying to apply some silly calculations to x and y in an attempt to get it right. Didn’t work. I believe x and y and image size are corelated but I still didn’t get how. You see, in Processing when I use “texture(bitmap)” to print a texture it is already scaled to its original size and proportion while in vvvv it is square by default and I still have to scale it.

Meanwhile I’ll try to use the *(Transform) as you suggested.

Thanks again!


file not attached… pls try again…

Yes, something didn’t work. I tried twice. I sent you a private message saying that somehow it didn’t work. I’ll try again in this post. Let’s see…

Ok, again, it didn’t work. Is it because of the size? Now I replaced BMP with JPG. Let’s see.

barbara.rar (269.0 kB)

Ok! It was because of its size. So… since I replaced BMP with JPG, two changes:

  1. Please copy the 3 jpg images from Processing “data” folder to vvvv “data” folder

  2. I updated the Processing patch changin extensions from BMP to JPG but you still have make this change in vvvv.

Sorry for the mess…

Let me know if you have any problem.

I did some experiments with this and I can’t see any bug in VVVV myself.

If I create two quads (one with rotation and one without) overlayed then the proportions on the two figures look exactly the same on my machine. In the zip is a screen shot showing the overlay for one image.

There are a couple of odd things about your patches though:

  1. Really best to avoid hitting FileTexture again and again. I changed to spread the inputs and then select from output spreads.
  2. For some reason it is impossible to edit/view barbara_transformation. I had to rewrite it. Don’t know why this is.

Your processing patch didn’t work on my machine :-( don’t know why.

Here is the zip with my mods and the screenshot. My best guess is that either your raw data is wrong or the VVVV version of the algorithm isn’t quite right. (269.3 kB)

  1. For some reason it is impossible to edit/view barbara_transformation. I had to rewrite it. Don’t know why this is.

try ALT+E, locks a patch ;)

besides what alphabetter said, i have seen in the processing source, that you create quads with the exact pixel size of the images. in vvvv the quads have equal size. thats the first thing.

so for your quads, try to scale them by the pixelsize of the images. that would be the transform next to the quad. then try to transform the quads as you do it in processing (same numbers). that will result in very big images, but you can scale everything down with the UniformScale at the Renderer.

and to underline what alphabetter said, loading an image every frame is really, really inefficient ;)