Jump to content
  • Advertisement
Sign in to follow this  
Farraj

If it was you, how would you do this??(camera question)

This topic is 4501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For example: you have scene. There is 1 3D object in a spacific place. You have a Camera (in some postion) looking dirctly at the object. What would you do to figer out the distanc the camera would move along it's 'look' vector, in a way, such that the object would be filling the whole screen?? (top of the object touches the top of the screen. bottom of the object touches the bottom of the screen) and sorry for any bad english.

Share this post


Link to post
Share on other sites
Advertisement
To figure that out, you would have to know the object's extent along the vectors that are orthogonal to the view and to each other. In other words, your looking at the object... how far to your left, right, up, and down does that object extend.

Without knowing that, I don't know if there is much you can do. Do you have a bounding volume for the object? Even an AABB could be used to some extent to get you in the right area.

Share this post


Link to post
Share on other sites
I guess I wasn't clear.

Assume that you have all the data you need. You have a 3D object, witch means you have all the data for it like vertexs, faces, face's normals, etc...

???Would you use a bounding box for this sorta problem?? you can get the max and min of the vertexs in space, but how would you get it for the camera?

Share this post


Link to post
Share on other sites
Oh, and also, you have the camera's FOV and aspict ratio. I know they're important somehow, but I haven't figered that out yet.

I was hopping if this method can also help me make sure that 2 or more objects are appearing on the screen.

Share this post


Link to post
Share on other sites
Quote:
Original post by Farraj
For example: you have scene. There is 1 3D object in a spacific place. You have a Camera (in some postion) looking dirctly at the object.

What would you do to figer out the distanc the camera would move along it's 'look' vector, in a way, such that the object would be filling the whole screen?? (top of the object touches the top of the screen. bottom of the object touches the bottom of the screen)


Maybe this thread will give some good tips:
http://www.gamedev.net/community/forums/topic.asp?topic_id=371596

Ciao
Libe

Share this post


Link to post
Share on other sites
That's actually why I asked if you had a bounding volume... I was going to suggest spheres. A bounding volume, though, won't guarantee that the whole screen is filled... it'll only get you close, as I said.

If it must FILL the screen, you will have to iterate through every vertex and project it's position onto the orthogonal vectors I mentioned before (get the x, y, and z extent in camera space) before doing the translation toward the camera.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!