Camera moving on sphere/pincushion effect

Started by
3 comments, last by budipro 20 years ago
Hi all, I have a terrain which is spherical, according to earth shape. The center of the earth is (0, 0, 0). I have my camera class, which has vDir, vUp, and vRight perpendicular each other. If I rotate my view up or down, I rotate my camera vDir and vUp using vRight as the rotation axis. If I rotate my view left or right, I rotate my camera vRight and vDir using my current eye coordinate (i.e. vector from (0, 0, 0) to eye point) as the rotation axis. The vUp vector the calculated using cross product of vRight and vDir. I use eye vector so that my view will align properly with the earth spherical shape. My view matrix is made using Direct3D LookAtLH function, with eye point, lookAt point and up vector as the parameters. Using this method, I got a kind of ''pincushion effect'' while rotating my view. The screen looks like being a little convex. Is my camera class method correct for this kind of terrain? Thanks very much.
Advertisement
My guess is that your field of view is too large. Try playing around with it and see if it helps.

Michael K.,
Co-designer and Graphics Programmer of "The Keepers"


We come in peace... surrender or die!
Michael K.
The easy way is to keep your camera still, at some distance away from the planet. Then rotate the planet all you want. You don''t have to re-build your view matrix.
Thanks guys,

I tried to lower my field of view to 30 degrees, from 45 degrees before. The pincushion effect seemed less.
I think it may also be affected by the distance of the near clipping plane. Don''t remember for sure.

Hmm.. Just thought of something: it may be possible to use a custom projection matrix to add some sort of distortion to compensate for the effect without changing the field of view or moving near clip plane... Unforetunately, I''m not fluent with projection matrix math. Perhaps someone else can comment on this?

Michael K.,
Co-designer and Graphics Programmer of "The Keepers"


We come in peace... surrender or die!
Michael K.

This topic is closed to new replies.

Advertisement