Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A strange bar appears when using a viewport with pixel art #70962

Open
lorenzo-arena opened this issue Jan 5, 2023 · 5 comments
Open

A strange bar appears when using a viewport with pixel art #70962

lorenzo-arena opened this issue Jan 5, 2023 · 5 comments

Comments

@lorenzo-arena
Copy link

lorenzo-arena commented Jan 5, 2023

Godot version

4.0-beta10.mono

System information

Windows 11, Ryzen 3700U Vega 10 iGPU

Issue description

When using a viewport container for pixel art, a strange black band appears at the bottom of the game if borderless mode is used.

Steps to reproduce

  • Open the attached project
  • Build it with a mono version of Godot
  • Run it

Minimal reproduction project

flappy-bird.zip

@Calinou
Copy link
Member

Calinou commented Jan 6, 2023

Related to #62869 and #63500.

Can you take screenshots of the full screen when the project is running? Which screen resolution are you using on your machine?

@lorenzo-arena
Copy link
Author

I have a laptop with a 1920x1080 monitor + a second monitor which is 1920x1080 as well. Both are set to the correct resolution in Windows settings.

Here's a screenshot of the issue:

image

When disabling borderless in Project Settings:

image

@Calinou
Copy link
Member

Calinou commented Jan 7, 2023

Can you reproduce this after enabling Resizable in the project settings? This likely occurs because the window is 10 pixels shorter when Resizable is disabled, causing its aspect ratio to be different. As a result, to avoid distortion, the image will not be able to span the whole window.

@lorenzo-arena
Copy link
Author

Unfortunately it doesn't seem to make any difference

image

@programnoir
Copy link

programnoir commented Sep 13, 2023

Oh, oops, haha, I guess that updates here, too. I have the same problem, and it isn't impacted by enabling resizable, either. I have clarifying information about this issue!

From my own experiences with this issue, we are seeing a black bar at the top and bottom of the viewport, and the window itself gets a little larger, too. What it kind of looks like, to me, is that enabling borderless mode results in the window attempting to resize itself to approximate what the "whole window size" was, before. So like, rather than resize itself to be the viewport size, it tries to resize itself to be (near) the size of the window, including the borders and window title bar.

This resizing seems to increase the window size by about Vector2i( 6, 29 ), and the fix that I implemented that works for my project is confirmed to work consistently across multiple machines. This seems to be true of the game in the screenshot by @lorenzo-arena - 586x650 seems to be the correct viewport size. So at least in Windows 10, borderless mode adds a specific amount to the window size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants