#### Archived

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

# Realistic Camera Techniques

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

## 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 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 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 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 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

1. 1
2. 2
Rutin
20
3. 3
khawk
17
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633759
• Total Posts
3013719
×