Sign in to follow this  
wajr

Newbie camera perspective question

Recommended Posts

All, I am working on a near-time software renderer. In games with 6dof cameras, when moving the camera in z, does the camera.pos.z translate or does its world.pos.z? Seems like it could be both but for projection some of the 50 or so articles I've read seem to say the camera eye is always at origin. Thank you in advance for any feedback.

Share this post


Link to post
Share on other sites
Moving your camera about in a world is no different from any other object; it has an x, y, and z position, and these change as the camera moves.

The view (or world-to-camera) transform is responsible for transforming objects into a local coordinate frame in which the camera is at the origin.

Share this post


Link to post
Share on other sites
Driv3MeFar,
Thank you for the clarification. It appears that I'm not correctly getting znear/far to work with D3DXMatrixPerspectiveFovLH perspective transform to compress zbuffer values to minimize zfighting. Should znear/far be world transformed before use so they move with the camera? Are they deltas between camera.pos and lookat or can they be arbitrary? I want to dynamically calc them from the scene rather than use camera.lookat as near and infinity as far.

Thanks again for your help.

[Edited by - wajr on December 12, 2006 4:40:44 AM]

Share this post


Link to post
Share on other sites
Your near and far plane values have nothing to do with your camera position, they define the extent of your view frustrum. I don't know the D3D call semantics, but they should just be floating point values (for example, I think the last 3D project I worked on used 100.f for the near plane and 1000.f for the far plane), and transforming them doesn't really make sense. You say you're having problems getting it to work right, whats your problem exactly? You also mentioned z-fighting, and if thats the problem then one way to help is to push your near plane back as far as possible with it still looking reasonable (sounds kind of counter intuitive, but it works).

Share this post


Link to post
Share on other sites
Thank you so much for the help!! The only problem I am having is coplanar polys (fairly close) tearing at any camera depth other than extremely close to objects (looks perfect at very near distances). The coplanar polys cannot be modeled further apart. Zbuffer magnitude (when I render as the zcolor) shows near (white) always right in front of lens and black at infinity regardless of camera.z. I am hoping to compress the zbuffer magnitude to my scene's dimensions instead of origin-infinity (my scene is extremely small).

Thanks again for your help.

[Edited by - wajr on December 13, 2006 11:47:50 PM]

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