# Zoom at a specific point using Orthographic camera

Currently I can perform Zoom which seems to be working fine but essentially what I'm really trying to do is zoom on a position offset from center as currently when I zoom then zoom is performed at the center.

Not sure how to achieve this ?

One way i'v though is either not use the orthographic camera and rather clip the texture, so that the my clipped texture will be drawn onto my directx surface covering the entire view. I could possibly perform the clipping using a constant buffer but then that would stretch the entire clipped texture over my viewport area.

Any suggestions on the above ?

I'm using Directx11, SharpDx with D3DImage & C#.

Do note: I'v created my vertexes directly screen co-ordinates.

Edit:

    this.eye = new Vector3(0.0f, 0.0f, 0.0f);
this.lookAt = new Vector3(0.0f, 0.0f, 1.0f);
this.up = new Vector3(0.0f, 1.0f, 0.0f);
viewMatrix = Matrix.LookAtLH(eye, lookAt, up);


NOTE: My application isn't a game but rather a video player

## 1 Answer

Zooming in/out to a particular point on the screen isn't an independent action for the camera to perform, but a combination of two simpler transformations: zooming in and moving the camera for a proper distance.

Let's suppose we zoom in with the camera, and we reduce the Field of View angle so that the final view focuses on the objects in the center. Then, we move the camera to center a particular object on the left. We can perform the two actions in whatever order we want ("Zoom, then move" or "Move, then zoom"), the final result will be the same.

But now, we can imagine to zoom in 1/10th than before, and then to move the camera 1/10th toward the position we found out in the previous example. So, zoom again and move again. After ten steps, we get the same previous results, but now we created the illusion of zooming and moving at the same time, which results in zooming in to a particular point in the space.

If you want to zoom on a particular position on the screen instantaneously, you can just try the first example, when the latter works better on a zooming animation.

• I've added code which I use to set my view and I believe I would have to update my view matrix in order to move the camera. Now I'm not sure what I would I need to update to move the camera ? Would it be the eye or lookalike vector ? – Dave23Rave Mar 30 '16 at 22:07
• Being your game in orthographic projection, you shouldn't change the direction of your lookAt and up vectors. Try zooming in/out and use instead the transformation matrix for the eye position – liggiorgio Apr 1 '16 at 17:41
• Thanks for the explanation. I would also like to highlight that my application isn't a game but rather a video player. Is there a example or link to resource to learn as to how I can use transformation matrix for eye position as I'm quite new to directx and still learning. Any information would really helpful and much appreciated. – Dave23Rave Apr 3 '16 at 17:05
• I think you can read something online, but I can't properly help about DirectX precisely – liggiorgio Apr 3 '16 at 18:12