Sign in to follow this  
nullsquared

Smooth Mouse-Look

Recommended Posts

I just can't seem to implement some nice, smooth, frame-rate independent mouse-look. Play any game, HL2/F.E.A.R./Crysis/etc., and you'll see that the mouse-look is very, very smooth. How exactly is that done? Rotating the camera based on raw relative mouse movement produces jerky per-mouse-pixel rotation. Accumulating the mouse input in a buffer produces frame-rate dependent smoothing (as in one of the flipcode articles).

Share this post


Link to post
Share on other sites
Quote:
Original post by Oluseyi
Sample the mouse on a consistent time basis, and use the delta to update the camera position. Separating model/simulation update from render is key. You can then use buffer accumulation to account for the discrepancy between render interval and sample interval.


Already tried, from my results that only made the mouse look choppy as it was tied to the gameplay framerate (60 FPS). I'd have to have the mouse input done at something like 120 FPS to have it smooth (which doesn't make sense if the game was running at less than 120 FPS, since the second delta would equal 0). Do all games seriously do constant time steps like this? Or maybe I'm understanding you wrong?

Share this post


Link to post
Share on other sites
Quote:
Original post by agi_shi
Already tried, from my results that only made the mouse look choppy as it was tied to the gameplay framerate (60 FPS).

Did you use the gameplay framerate and accumulation?

Think about it. The game updates its simulation 60 times each second. In a given update interval, the user has moved the mouse from position A to B. Render, however, is only 30 times per second, meaning that the user has moved from A to B, then from B to C (assuming perfect overlap).

Sample at regular intervals and add the sample differential onto an accumulation which gets cleared every render.

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