microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95k stars 8.22k forks source link

[MEGATHREAD] AtlasEngine bugs and missing features (`experimental.useAtlasEngine`) #9999

Open zadjii-msft opened 3 years ago

zadjii-msft commented 3 years ago

Bugs

Missing features

New features

Cleanup

Things we think were fixed by this renderer...

...Or at least, this renderer got out of the way so that these can be fixed now.

Not really a bug

DHowett commented 2 years ago
o-sdn-o commented 4 months ago

Alpha blending is broken in grayscale AA mode (dark moire around glyphs with high RGB-contrast between foreground and background). Apparently the transition between linear/sRGB is missing somewhere.

My setup: Current main branch. Windows 10.

pwsh:

"🥵🦚`e[38;2;255;0;0;48;2;0;0;255mtest`e[38;2;0;255;255mtest`e[m"

Grayscale AA mode: image image

Cleartype AA mode: image

Expected grayscale AA mode blending: image image

lhecker commented 4 months ago

Your issue is definitely weird. The blue text background in your two screenshots is #120efd and not #0000ff. Why's that? The red "test" text is also #ff0302 and not a clean #ff0000. Are you sure your screenshot wasn't chroma subsampled (I mean like YUV 4:2:2), or something similar?

In any case, I've tested this with Visual TrueType just now. First I've reset my ClearType settings so that I get a clean 1.8 gamma:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Desktop]
"FontSmoothing"="2"
"FontSmoothingGamma"=dword:00000000
"FontSmoothingOrientation"=dword:00000001
"FontSmoothingType"=dword:00000002

[-HKEY_CURRENT_USER\Software\Microsoft\Avalon.Graphics]

[-HKEY_LOCAL_MACHINE\Software\Microsoft\Avalon.Graphics]

Then I configured VTT like so:

This got me this: image

which is almost identical to what BackendD3D renders for me (if you zoom into the "t"): image

o-sdn-o commented 4 months ago

The blue text background in your two screenshots is #120efd and not #0000ff. Why's that? The red "test" text is also #ff0302 and not a clean #ff0000. Are you sure your screenshot wasn't chroma subsampled (I mean like YUV 4:2:2), or something similar?

The screenshots were taken via RDP, perhaps there is some kind of post-processing.

Here is a screenshot from localhost: image

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Avalon.Graphics]

[HKEY_CURRENT_USER\Software\Microsoft\Avalon.Graphics\DISPLAY1]
"PixelStructure"=dword:00000002
"GammaLevel"=dword:00000898
"ClearTypeLevel"=dword:00000064
"EnhancedContrastLevel"=dword:00000032
"GrayscaleEnhancedContrastLevel"=dword:00000064
"TextContrastLevel"=dword:00000000

[HKEY_CURRENT_USER\Software\Microsoft\Avalon.Graphics\DISPLAY3]
"PixelStructure"=dword:00000002
"GammaLevel"=dword:00000898
"ClearTypeLevel"=dword:00000064
"EnhancedContrastLevel"=dword:00000032
"GrayscaleEnhancedContrastLevel"=dword:00000064
"TextContrastLevel"=dword:00000000

My gamma is 2.2 (GammaLevel=2200), since sRGB-gamma is 2.2 on my local monitors with sRGB mode enabled (PHL234E5, ATI HD 3870).

This got me this...

If you convert your image to shades of gray, you will see overdarkening that, in theory, should not be there:

image

VTT does not take into account gamma correction with grayscale AA blending (or do it wrong): image

Off: VTT has a memory leak: +100 MB of RAM on every (back and forth) window resizing step with "Segoe UI Emoji" open.

Off2: VTT does not allow the gamma correction value to be set to 2250, even though the error message states that the valid range is 1050-2250.

Here is my test image (expected grayscale blending):

image

Off3: Github breaks colors on pasted screenshots. Pay attention to the red "test" - in both screenshots it is the same image. At low resolution, compression changes color.

o-sdn-o commented 4 months ago

image

https://en.wikipedia.org/wiki/SRGB https://en.wikipedia.org/wiki/Alpha_compositing

o-sdn-o commented 4 months ago

I found that the deprecated DxRenderer (if I understand it correctly) GDI-renderer (with UseDx=0) (thanks to @tusharsnx) is not affected by this issue:

image image

Make sure system-wide cleartype is disabled: image

tusharsnx commented 4 months ago

@o-sdn-o Nah, that's the GDI renderer (unless you have used useDX from the registry).

I do see similar result in conhost as you Conhost with system-wide Cleartype off: ![image](https://github.com/microsoft/terminal/assets/55626797/6282d926-ad4f-43ac-9e05-52866a163f26) Windows Terminal with Grayscale AA: ![image](https://github.com/microsoft/terminal/assets/55626797/a53d37c5-20a3-4440-9c6c-842fc928a8b6) Windows Terminal with ClearType AA: ![image](https://github.com/microsoft/terminal/assets/55626797/7f54251d-19b8-484a-84f0-73517896cbfe)