Zooming
What are some of the methods that people use to do a zooming effect in games? (Terrain, etc.)
I was thinking to change the perspective which would cause everything to become closer(zooming) but then i found out i couldnt messaure the value percisly enough to stop zooming if a object is in the way. i hope that made sense. Well that is the problem i ran into, what are some other methods people use, do they scale all the object in the screen larger? Move the camera forward?
Thanks alot
"What we do in life, echos in eternity" -- Gladiator
"What we do in life, echos in eternity" -- Gladiator
Sorry, don''t really understand what you mean, but i''ll try to answer.
When i zoom, i move the camera. If your "camera" is placed at (x1,y1,z1) and the spot you focus on is (x2,y2,z3), then you may zoom with this function:
zoom = 2; // This is 2x Zoom
newX = (x1-x2)/zoom;
newY = (y1-y2)/zoom;
newZ = (z1-z2)/zoom;
That''s quite much it.
When i zoom, i move the camera. If your "camera" is placed at (x1,y1,z1) and the spot you focus on is (x2,y2,z3), then you may zoom with this function:
zoom = 2; // This is 2x Zoom
newX = (x1-x2)/zoom;
newY = (y1-y2)/zoom;
newZ = (z1-z2)/zoom;
That''s quite much it.
That would cause errors (faces clipping as you move past them) in some cases.
For zooming i would personally multiply all vertex positions from the camera position so this occurs:
Which causes the # to disappear, as it isn't in the viewing frustum.
[edited by - Tree Penguin on January 3, 2004 9:13:31 AM]
For zooming i would personally multiply all vertex positions from the camera position so this occurs:
/ /# / /##c# --> c### \ \## \# \ instead of: / /c# --> #c \ \
Which causes the # to disappear, as it isn't in the viewing frustum.
[edited by - Tree Penguin on January 3, 2004 9:13:31 AM]
Most games just decrese the FOV.
It gives the feeling of zooming with out moving the camera.
It gives the feeling of zooming with out moving the camera.
Adjusting the FOV is more realistic, because when you zoom a camera, you don''t actually move closer to your target.
*News tagenigma.com is my new domain.
January 06, 2004 01:34 AM
Yep skow, and tgraupman are right. The right and easy way to do zoom in is to change ur viewport with a different FOV (Field of View) Angle.
For regular view u set up a 45 degree FOV (thats about how much a person can see)
If u want to zoom in, u set up a smaller FOV This way u view a smaller area, but since ur screen size doesn''t change, when OpenGL renders the smaller scene, it gets spread out to fill the screen size ( thus creating zoom effect)
Same if u want to zoom out, yo increase FOV.
For regular view u set up a 45 degree FOV (thats about how much a person can see)
If u want to zoom in, u set up a smaller FOV This way u view a smaller area, but since ur screen size doesn''t change, when OpenGL renders the smaller scene, it gets spread out to fill the screen size ( thus creating zoom effect)
Same if u want to zoom out, yo increase FOV.
I''ve never really done much with zooming... is the only way to change the FOV by using gluPerspective()?
It would be nice if you could just change the fov without having to give the resolution and ratio.
It would be nice if you could just change the fov without having to give the resolution and ratio.
January 06, 2004 04:29 PM
In my game I did zooming using
// Rotate and Translate every thing first
glScalef( 100.0f, 100.0f, 1.0f);
This makes the model bigger x, y direction wile keeping z the same causing just plane zoom along the z axis. (Use different zooms when your world is smaller my world is 1000x1000x1000 cube)
Simple and cheap!
// Rotate and Translate every thing first
glScalef( 100.0f, 100.0f, 1.0f);
This makes the model bigger x, y direction wile keeping z the same causing just plane zoom along the z axis. (Use different zooms when your world is smaller my world is 1000x1000x1000 cube)
Simple and cheap!
Unless you draw everything centered around the origin, doesn''t that just move your camera closer to the origin? It''s like taking your position and dividing by a 1000 scalar.
*News tagenigma.com is my new domain.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement