Limiting FPS causes stuttering + 'Smooth Frame Rate' problem

‘Smooth Frame Rate’ (under ‘General Settings’) causes single stutter every ~0.5s.
It can be fixed by limiting FPS (to e.g. 60) by ‘Fixed Frame Rate’ parameter or via ‘t.maxfps 60’ console command - but this, on the other hand, causes stuttering every ~20 seconds for around ~3 seconds!

I’m testing it on Epic Top Down Template project, running around and seeing single stutter every ~0.5s (when ‘Smooth Frame Rate’ is on) OR seeing ~3 second long stuttering every ~20 seconds (when FPS is limited to 60)

Is this a bug or maybe it’s happening only on my end? I can’t test it on other PCs…
Here is my DXDIAG:
DXDIAG

How can I fix this? Any ideas?

Update: I’ve tested it on 4.11 and it also happens there…

1 Like

Hey Slavq,

This posted answer here by Eric can help you understand how VSync and Smooth Frame Rate work together.

-Tim

Thanks, I’ve read this before and now again, but I still don’t understand why it stutters like this (~3s-long stuttering every ~20 seconds when FPS is locked at 60 FPS seems… Weird) and what I can do to fix it?

‘V-Sync Stutters When Frame Rates Drop’ - but my FPS is consistent and never drops (at least that’s what ‘stat FPS’ command tells me) - I’ve tested it on a simple Top Down Template project and Rolling Ball template - so there it even doesn’t have any reason to suddenly drop FPS.

So this is something wrong on my end, maybe with graphics card? But I don’t have any stuttering problems e.g. when playing different games locked at 60 FPS, so this confuses me…

I’ve also tried setting these propetries to different FPS values, but it only changes stutter frequency.

It’s not something that I can reproduce on my machine here. I’ll try this tonight when I get home and see if I see what you’re seeing on my home machine. It’s a closer match to your specs than my machine here at the office. Shouldn’t take me but a few minutes to see and if I see the same results maybe I can offer some tips to improve on your end, but not sure yet.

In the the meantime make sure that you’re on the latest drivers for your graphics card. I see you’re on the 364 drivers. The latest is currently up to 368.22.

Thank you, I’ve just installed new 368 drivers, but sadly it didn’t change anything.

Additional interesting behavior:

  • When I set ‘Smoothed Frame Rate Range’ min to 59.5 and max to 60.5, the stutter occurs every ~1s.
  • With min == 59.75 and max == 60.25, it stutters every ~2s.
  • With min == 59.875 and max == 60.125, it stutters every ~3s…

The stutter is best visible when smoothly moving (e.g. running through Top Down Level) and observing other objects passing by, e.g. the cubes or other level geometry.

Update: I’ve suddenly fixed it by typing ‘r.VSync 1’ in console! It fixed both stutter cases (stuter every ~20s. when locked at 60 FPS and every ~0.5s. when frame smoothing on)

… Is it normal that V-Sync is turned off in UE by default? How can I set it ON by default, without need to type ‘r.vsync 1’ every time to fix the stuttering?

1 Like

Something came up and I couldn’t test at home last night, but regardless of that, thanks for posting your update.

Vsync is always off by default. I must have misread up above because I mistakenly had thought you had enabled it already.

You don’t have to enter it every time. You can add r.Vsync=1 to the DefaultEngine.ini under the System Settings section and relaunch the editor.

You can check it by going to the Output Log window and typing in “r.vsync ?” (without the quotation marks) to see what the default value is now set to.

1 Like

Thanks @Tim_Hobson for your helpful tips. When locking framerate with t.MaxFPS 60 there’s still an unfortunate trade-off between either super silky smooth with occasional ugly stutter (framerate locked to 60) or less smoothness with no stutter (with framerate unlocked t.MaxFPS 0 ). Based on my testing, r.VSync 1 has no effect on the probability of stutter (in fact, based on the documentation, it seems vertical sync can actually cause stutter). I’m also not sure if UE4 communicates this v-sync info to the gpu when running the game in a new window, or if vertical sync only works properly in a full-screen packaged build.

However, for my 1440p monitor which reports a TV-compatible timing of 59.94 Hz, I was able to get the most consistently smooth results (although not 100% perfect) by leaving VSync off and setting t.MaxFPS 59.94 on BeginPlay in the GameMode, and then under Project Settings > Engine > General Settings > Smoothed Frame Rate Range, I set a Max of 60.0 as “Inclusive” (selected with the down arrow beside the number), and then set the Min as “Open” which disables the lower bound. It seems to work well for the time being… :smiley:

Unfortunately, my theory was incorrect. Hitching still randomly occurs in a virtually empty project with nothing more than the UE4 sky sphere, the default ground plane, a few cubes without materials, and my character. I tried limiting texture sizes to 2048, removing a separate modular weapon skeletal mesh (which used a Master Pose Component), and also tried removing everything but basic locomotion from the Character’s AnimBP, but nothing made any difference, and hitching still occurs.

Success! After further testing, it appears the solution provided by @Slavq (to enable vertical sync) was indeed the fix-- however it only worked for me after using the “Play Standalone Game” feature. If testing the game using the “New Editor Window”, random hitching would still occur, even with V.Sync enabled. So from now on, I’ll be testing by running the game in its own standalone process with the following console commands: t.MaxFPS 59.94 and r.VSync 1 . It’s so refreshing to finally see smooth gameplay! :smiley: