I have a quad in 3D space (a billboard in the real-world sense) that I want to move close to the camera so the user can inspect it. The quad is defined by the 3D coordinates of its four corners.
To accomplish this I compute target points very close to the camera for each of the corners.
(I use XNA's Viewport.Unproject() method which does something similar to this)
// Top left corner of the screen, // Z=0.1f means very close to the camera's near plane var screenPoint = new Vector4(0,0,0.1f,1); var worldPoint = Vector4.Transform(screenPoint, Matrix.Inverse(ViewMatrix * ProjectionMatrix)); var worldPoint /= worldPoint.W;
These world points that are close to the camera produce a very small quad: which is understandable if we look at this picture:
Here the initial position of the quad is depicted in red and the end position of the quad is depicted in blue.
For each of the corners of the quad I linearly interpolate between the original position and the position near the camera.
this.timer += deltaTime; var progress = this.timer / 10.0f; var currentTopLeft = Vector3.Lerp(initialTopLeft, nearTopLeft, progress);
Since I linearly interpolate the quad moves to its new position at a constant speed. I've verified this by ouputting the speed and distance to the console. However, the visual effect is that the quad first hardly moves and then all of a sudden moves very fast to its destination.
I think this is because the quad is being scaled down while moving closer (to fit the near plane) so it will stay relatively the same size on screen for a long time. Only once it comes very close it seems to move. (For example see this answer).
The question I have is: what can I do to make it look like the quad is moving closer at a constant speed?
I was thinking about not interpolating linearly but first move progress very fast and then very slow (Ive tried
progress = sqrt(progress) which helped a little). But I'm not sure how I can compute the exact (or near enough) formulate to make this work.
Another idea I had was to bring the quad not so extremely close, but then there is the danger of it clipping with objects in the world.