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

2D Viewport Blend Function darkens pixels (3D Blend is OK) #84787

Open
thygrrr opened this issue Nov 12, 2023 · 2 comments
Open

2D Viewport Blend Function darkens pixels (3D Blend is OK) #84787

thygrrr opened this issue Nov 12, 2023 · 2 comments

Comments

@thygrrr
Copy link
Contributor

thygrrr commented Nov 12, 2023

Godot version

4.2.beta 4.1.3.stable

System information

Windows 11

Issue description

2D portions of Viewports are blended in a way that causes pixels to darken
(maybe it's SRC_COLOR = 1-SRC_ALPHA or something along these lines)

(Edit: May also be some sort of render target downsizing artifact, blending dark surrounding pixels into it - the viewport has a different size from the window here; but even if I set them to the same, there is visible darkening/thinning of the font)

image

image

Notably, the 3D labels don't seem to show these darker pixels after blending, hinting at a different (better!) blend function being used there. It is not possible to directly compare the fonts as the 3D system seems to use a different font resource by default.

image

Steps to reproduce

  1. start project's reproduction scene
  2. observe font problems :)

Minimal reproduction project

dark-blend-repro.zip

@thygrrr
Copy link
Contributor Author

thygrrr commented Nov 12, 2023

It's exacerbated by downsampling, but does not fully go away when viewport is the exact resolution of the window:

image

@Calinou
Copy link
Member

Calinou commented Nov 12, 2023

For correct appearance, you need to use the premultiplied alpha blend mode using a CanvasItemMaterial when displaying a transparent viewport.

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

2 participants