Various of artifacts while moving camera vertically

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

When I move vertically, the border of my health bar dissapers sometimes, then it appears again. Also the sprite of crab “flashes”. I would also make him smaller but flashing is getting worse. I have loaded texture as 2D pixel preset.

On web I found that maybe camera smoothing causes it but there is no difference if I have turned it on or off.

I tried to play with different rendering settings like FXAA, vsync etc. but I didn’t noticed significant change.

When I make things very big then it is okay but that is not a solution. I guess it has something with scaling down?

:bust_in_silhouette: Reply From: Calinou

The crab sprite likely flickers because it was severely downscaled, and does not have mipmaps available. There are 3 ways to fix this:

  • Resize the crab image in an image editor to a lower resolution. This is the recommended approach.
  • Select the crab image in the FileSystem dock, go to the Import dock, set Max Size option to a value greater than 0 (but lower than the sprite’s resolution) then click Reimport. This will make Godot downscale the image on import, without affecting the original copy on disk.
  • Select the crab image in the FileSystem dock, go to the Import dock, enable Mipmaps then click Reimport. This is useful for games where the camera zoom changes significantly during gameplay, but it uses more memory.

I tried to play with different rendering settings like FXAA, vsync etc. but I didn’t noticed significant change.

FXAA only has an effect on 3D rendering, not 2D. If it worked on 2D, then 2D graphics would become very blurry as FXAA is not designed to provide 2D antialiasing.

Thank you, I downscaled my spritesheet in TexturePacker and works like charm! But do you know what to do with disappearing border of health bar? When it is small it even disappears in editor but it has to be this size…

lysy3875 | 2022-08-18 15:45

That may be because your health bar is a child of the graphic so it shrinks in correspondence to its parent. Try rearranging the scene tree?

SnapCracklins | 2022-08-18 18:10

Sorry Sir, but I don’t really understand.

My health bar is composed of base Control and ProgressBar itself:

Then I attach entire node to Crab:

Crab just sits in World which is just Node2D:

I don’t use scaling anywhere.

lysy3875 | 2022-08-18 18:40