Zooming in effects

Started by
12 comments, last by Helicon56 21 years, 2 months ago
In DirectX you can do that this way:
float p_Zoom = 1.0f;D3DXMATRIX ProjectionMatrix;D3DXMatrixPerspectiveFovRH( &ProjectionMatrix, p_Zoom, 640.0f/480.0f, p_MinViewDistance, p_MaxViewDistance ); 

Now you only need to update the ''p_Zoom'' variable

KaMiKaZe
Advertisement
cool sounds good, cheers guys, i''ll give it a go now.

thanks alot,
--helicon56.
Yes! The right way to achieve the zoom effect is altering the Fov of the projection matrix. The human Fov is near to 50 degrees, try reducing it up to 5 degrees to simulate a zoom in effect and backwards to 50 to produce a zoom out. Remember I said degrees not radians
Sometimes it helps to think about how these things work in real life. The sniper scope changes the FOV. Fortunately, it doesn''t move the sniper closer to his target.


Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces"
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials

This topic is closed to new replies.

Advertisement