Camera2d smoothing jitter in Godot 3.0

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By behelit

Hello everyone. I’m using Godot 3.0, which seems like a big improvement in some areas, but not others. For example, in Godot 2.1.4 I could get camera2d smoothing to work fairly well, but in Godot 3.0 it is straight up broken. I get the exact same problems in Godot 3.0 as described in these very old questions:

https://forum.godotengine.org/851/camera2d-smoothing-looks-shaky-for-low-resolution-sprites

Scrolling is rock solid and works like you would expect with just camera2d, but as soon as you turn on smoothing, it looks terrible no matter what I do. It’s like it’s dropping frames occasionally, but consistently. It happens even with the simplest possible configurations.

Please tell me there is some kind of fix for this. I can make my game work without it, but this is making the switch from 2.1.4 to 3.0 feel like a downgrade.

On a side note, when I added a parallax background, the jitter seemed to decrease. I have no idea what is going on, but it seems like the engine is expecting a heavier “load” and over compensating for something, causing it to skip frames in certain situations. I’d love to learn more about what’s going on under the hood here.

behelit | 2018-02-24 15:49

:bust_in_silhouette: Reply From: Christoffer

I think this problem occurs when the physics fps and the screen refreshrate is not the same.
if you change the physics fps to whatever your monitors refreshrate are it shuld work.
godot defaults the game fps to whatever refreshrate your monitor is, that means that your physics fps are default 60 and lets say your screen has a 120hz screen, godot set the fps of the main loop to 120.
so in order to temporarly fix this you can add this line in your game.

Engine.set_target_fps(Engine.get_iterations_per_second())

That will set the target fps to whatever you set your physics fps in Project Settings.