Okay, so let's say I have a point in 3d. And I have a camera state. That is, I know the camera position, the camera target and the camera up vector.
I am using the perspective projection to get the screen coordinates of that point, given viewport size.
Now, for two different viewport sizes: V1: (w1, h1) and V2: (w2, h2). If I know the screen coordinates of a point in V1, how would I compute the screen coordinates of the same point in V2?
So we are keeping the camera state constant, the field of view constant and only changing the size of the viewport.
That is, I want to determine the function F, such that F(x1, y1) = (x2, y2) which would depend on w1, h1, w2 and h2. I'm having a hard time working this out since it's been a long while since I touched any 3d graphics math.
I'm guessing it would be linear in x1, y1. Since, if we keep the same aspect ratio in both the viewports, (x2, y2) would simply be w2*(x1, y1)/w1.
But happens when the aspect ratio changes?
Also, as a separate question, by what factor would an object be scaled as we go from viewport V1 to V2? Here, again the answer seems simple when the aspect ratio is maintained but I can't figure out what happens if it isn't.