• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Medo Mex

Camera Zooming In and Out

12 posts in this topic

I thought zooming in can be accomplished by moving the camera forward but unfortunately it doesn't work like that.
 
Lets say I want to zoom in for a sniper sight, moving the camera forward will cause a problem if there is something close, for example: A close wall.
 
How do I create a method like: Camera::Zoom(float amount); ?
0

Share this post


Link to post
Share on other sites

I have the field of view set to "D3DX_PI / 4" by default, how do I change it to add zoom in/out amount so when I call the method Zoom(float amount); I can change the field of view accordingly?

 

I tried:

 

camera->fov = (D3DX_PI / 4) + amount;

Not sure if the above is correct, however it cause a problem when amount reach certain number, the camera get up side down.

0

Share this post


Link to post
Share on other sites

Your FOV is exceeding pi radians and that's why you see inverted images after some amount. It's based on the principles of focal point in optical physics.

Edited by NewDisplayName
0

Share this post


Link to post
Share on other sites
You want to multiply the field of view by a float between 0 and 1 to zoom in. Use 1 for normal zoom, experiment for the zoomed in value. You can interpolate the zoom amount to zoom in smoothly. Try 0.5 to start with (should make everything twice the size) and tweak from there.

camera->fov = (D3DX_PI / 4) * amount; // amount = 1.0f -> no zoom
1

Share this post


Link to post
Share on other sites

@Paradigm Shifter: What If I want to zoom in more?

 

Also, I notice two problems when I zoom in till the maximum value:

1. The textures get weird effect

2. The camera can see what is the behind the mesh (like it's penetrating the mesh) which is not realistic.

0

Share this post


Link to post
Share on other sites

@Hodgman: When zooming, the value shouldn't change suddenly, instead, the zoom should be changing smoothly.

 

I have the same problems that I mentioned when earlier when I zoom in to the maximum value, I also want to zoom MORE than the maximum value.

0

Share this post


Link to post
Share on other sites

It was just an example of using intuitive values in degrees, you can animate them however you like, e.g.

 

inline float lerp( float a, float b, float f ) { return b*f + a*(1-f); }
float fovDegrees = lerp( regularFov, sniperFov, zoomFraction )

 

 

What is your maximum zoom value -- what fov value are you using as the 'maximum'? If you use an fov of 0, then you'd end up with an infinitely thin frustum with no area... but any value greater than 0 should work (and smaller than 180º...)

Can you post a picture of your "weird" textures?

Edited by Hodgman
1

Share this post


Link to post
Share on other sites

[quote name='Medo3337' timestamp='1357541721' post='5018480']
when I zoom in to the maximum value, I also want to zoom MORE than the maximum value
[/quote]

Only way you can achieve this is to set your "maximum" value as some value, which is slightly short of the absolute maximum value (pi radian).

0

Share this post


Link to post
Share on other sites

As Steve curiously asked, a small FOV should result in more zoom(And by asking, I'm sure it was more a question you should ask yourself). As Hodgman noted, a FOV of 0 results in just that. 0 field of view, your frustum essentially becomes a 2d slice(whose angle would depend on the aspect ratio), rather than a volume. A FOV = epsilon is the maximum zoom you could possibly get.

 

Sidenote: Hodgman, you asked if we could see the "weird textures" I'm guessing here, but are you expecting a moiré pattern?

Edited by Burnt_Fyr
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0