godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.1k stars 21.16k forks source link

Pixel offset when resizing or zooming #33949

Open WizzardMaker opened 4 years ago

WizzardMaker commented 4 years ago

Godot version: 3.1.2 RC1 Mono and 3.1.1 Mono

OS/device including version: Windows 10

Issue description: I have two textures aligned next to each other. Both are at integer positions and scale. Problem is that they drift apart, or get inside of each other when zooming or resizing the window, even in the editor.

resizeBug2 [^Zooming in the editor^]

resizeBug [^Resizing the game window (uses "2d" display mode and "keep")^] Minimal reproduction project: Test.zip

Just open the speechbubble scene and scroll in and out to observe the effect

nathanfranke commented 4 years ago

Reproducible in 3.2 Beta 2 Standard

This is a bug with Margin Container. Project below compares with margin container vs without Margin Containers have a zero margin

More Minimal, No Mono Test Project: Test.zip

Calinou commented 4 years ago

Does it improve if you disable Gui > Common > Snap Controls To Pixels in the Project Settings then restart the editor? Note that this may make GUIs blurrier, so it's only a workaround.

WizzardMaker commented 4 years ago

The "Snap Controls To Pixels" option does not make a difference, neither on, nor off. The only thing that seems to help is setting the display stretch mode from "2d" to "viewport", but that is not desired, as that removes the option of "Font Oversampling" and introduces other visual artifacts that are not desirable for my type of game.

akien-mga commented 4 years ago

Still reproducible with the project in https://github.com/godotengine/godot/issues/33949#issuecomment-559256990 in 3.2.3-stable.