Archived

This topic is now archived and is closed to further replies.

Realistic Camera Techniques

This topic is 5669 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

Does anyone have any ideas to offer to provide for a more realistic camera? I just added the spring damping function from Game Programming Gems I to see what effectst it would have on my simple first person camera. It worked fine at fast speeds (fwdS = 100, but would become to jerky (springy) at slower speeds (fwdS = 10. If anyone has a reason/fix for this, please share. Thanks

Share this post


Link to post
Share on other sites
I haven''t got the graphics programming gems here at the moment, so I can''t check the spring damp function. So I''m sort of guessing, but it sounds a lot like common integrator problems.
The problem you are expriencing with the spring behaviour on low framerates is probably because you''re using an euler integrator. If in the calculation for the spring for every frame you do something like a = a+b*t, you''re basically using the euler integrator. The problem with this integrator is that can be very unstable, which would explain the jerky movements of your camera.
Now there are a whole bunch of ways to fix this. You could use another integrator for the calculation, or you could implement the whole realistic camera method differently..
For different integrators and a good explanation about what''s wrong with the euler integrator, have a look at http://www-2.cs.cmu.edu/~baraff/sigcourse/index.html and click on the ''differential equation basics'' papers.

Cheers!
Nick

Share this post


Link to post
Share on other sites
What''s a realistic camera? Cameras are inherently unrealistic. Do you mean a camera that acts like the human eye, or a camera that acts like movie cameras? Movie cameras rarely pan; the usually switch from one viewpoint to another without moving inbetween (by using multiple cameras and switching the active one). And the human eye/head does things that would look very strange and motion sickness-inducing if done with a game camera.

~CGameProgrammer( );

Share this post


Link to post
Share on other sites
I still haven''t had the chance to play with the different Integrator methods.

For the Realistic Camera, good point about the motion sickness. I guess what I am looking for are techniques to make my camera look more like a proffesional game then (as retarded as that may sound).

Thanks

Share this post


Link to post
Share on other sites
Ok, I promise I''ll quit posting.
I realized that not everyone has game programming gems. so I will describe what''s going on.

The eye target is being computed by something similar to this: eyeTrg += deltaTime * fwdSpeed * vector3(fwdX, fwdY, fwdZ);
The spring damping function is as follows:

disp = currPos - trgPos; // 3d vector
velocity = (prevTrgPos - trgPos) * deltaTime;
forceMag = springConst * (springLen - disp.length()) + dampConst * (DotProduct(disp, velocity) / disp.length());
disp.normalize();
disp *= forceMag * deltaTime
return currPos += disp; // returns a 3d vector

This was part of the function taken from GPG1

Share this post


Link to post
Share on other sites