godotengine / godot

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

Pixel Distortion in HiDPI Screens #36825

Closed D-TurboKiller closed 4 years ago

D-TurboKiller commented 4 years ago

Godot version: v3.2 Stable

OS/device including version: Windows 10 Enterprise LTSC, version 1809 CPU: AMD A10-7850k Black Edition GPU: AMD RX 470 4 GB Screen: Hisense H43B7500, plugged in through HDMI port (yes, this is a 43" television)

Issue description: I'm currently creating a project which uses pixel-art assets in an 848x480 screen size and needs to be pixel perfect. During my test runs, I've noticed the art looked... off somehow, but I couldn't quite guess what it was. I then compared the in-game version with my own assets (made in Aseprite) and noticed that a lot of pixels were either thicker, shifted around or distorted! Noticeable distortions: -The background has thicker stars when they should be 1 pixel in size -The balls look dented on the corners -The character's smile is completely different -The large circles on the bottom left and right have their outlines chipped, most noticeably in the diagonal portions (notice the triangle-shaped dents) Initially I searched around for "pixel-perfect scaling" online and figured I was doing something wrong, but it turns out the issue was related to how Godot Engine handles HiDPI scaling at the moment (see Workaround below).

Screenshots I've included a fullscreen version and a zoomed in portion or the larger circles, the first images being without the fix and the latter with the fix. BEFORE: pixel perfect original AFTER: pixel perfect fixed

ZOOMED BEFORE: pixel perfect issue before ZOOMED AFTER: pixel perfect issue after

Steps to reproduce:

  1. Create or open a pixel-art based project. (The lower the resolution, the better)
  2. Import textures with 2D Pixel settings and place them in the scene.
  3. In Project Settings, make sure no filters are applied and the game start off at Fullscreen, Stretch mode is set to "2D" with "Keep" for resizing, and Display -> Window -> Allow HiDPI is enabled (NOTE: It still happens if disabled, but is more noticeable when enabled)
  4. Run the Project in Fullscreen. The pixels should look distorted.

Workaround Turns out Windows' handling of HiDPI is still terrible even with supposedly compatible software, so overriding the scaling applies here: -Right-click on editor/game executable, go to Compatibility tab, click on "Change HiDPI Settings", and make sure "HiDPI Scaling Override" is enabled and set to "Application" -Even the editor benefits from this, as the fonts look MUCH more readable -Only minor downside is when switching to fullscreen, the screen becomes black for a fraction of a second with this fix applied. If there's a way to fix or apply this in-engine somehow, it'd be much appreciated.

Minimal reproduction project: I made a barebones project consisting of a room and several different assets in various positions and rotations. HiDPI Test.zip

Calinou commented 4 years ago

Duplicate of #24922. Still, thanks for confirming the issue is still around.