Skip to main content
gamedev.net
🔒 Locked

Realistic Camera Techniques

Started by newpers 3 replies 1.4k views
Original Post
newpers
newpers
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
NickWaanders
NickWaanders
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
CGameProgrammer
CGameProgrammer
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( );

~CGameProgrammer( ); Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
newpers
newpers
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
newpers
newpers
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.