Why do textures flicker when camera moves?

2019-06-02 12:07发布

问题:

I implemented a top view camera which moves with the player, only a bit slower using camera.position.lerp. The problem is that the textures are flashing (flickering) a little because i have scaled my textures. If I use normal size of textures the flickering stops. Does anyone have any ideas on how to move the camera with zoom (or textures scaled - same thing) without getting the textures to flicker (or flash)? I use linear filtering and load every asset from an atlas. I saw this problem on multiple forums, but no answer. I wanted to load higher resolution textures and resize them in code, that's why I am asking this question.

回答1:

You need to extrude the borders of your sprites in the atlas. The Extrude option tends to be close to the Padding ones.

Most texture packers support that feature and Libgdx will pick that information up from the atlas file straight away.

This way you get to use the filter you want.