Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
141 stars 2 forks source link

Text is lighter/blurrier than expected #1521

Open sctanf opened 8 months ago

sctanf commented 8 months ago

Describe the bug?

Text in both desktop and VR modes looks and feels extremely blurry, especially on dark text on light backgrounds. This issue can be mitigated by using a mod to disable FXAA, but it does not solve the issue enough, and text would still appear lower contrast than it should, by a significant value.

To Reproduce

Create three canvases with a background of srgb 0.8,0.8,0.8 and text elements sized at 8, 16, and 64, and type in "The quick brown fox jumps over the lazy dog"

Expected behavior

I expect text to be sharp and readable even if it is rendered at a reduced size.

Screenshots

image image image image

Resonite Version Number

2024.3.12.1169

What Platforms does this occur on?

Windows

What headset if any do you use?

Bigscreen Beyond

Log Files

SCTANFWKSTN - 2024.3.12.1169 - 2024-03-20 22_13_51.log

Additional Context

It was mentioned that the new alpha rendering could be affecting the text significantly

Reporters

No response

shiftyscales commented 8 months ago

Try setting the BlendMode on the TextUnlitMaterial from Alpha to Opaque and see if it produces a result closer to what you are expecting, @sctanf.

I don't think this is necessarily a bug though- while the output is a lot sharper- it is also a lot more aliased/shimmery- especially when viewed in VR. You can see text handled similarly in other places like the SteamVR overlay- if you set the quality of the dash to 'low' the text will be significantly sharper/but aliased/shimmery, and if you use a higher-quality mode it is blended/smoother

sctanf commented 8 months ago

@shiftyscales Setting the material to 'Opaque' or 'Cutout' makes the text far sharper but introduces rendering errors and makes the text far too bold or thick, and this also does not match the expected text rendering I showed above. It is a worse workaround than trying to disable FXAA so I did not mention this.

SteamVR also does not render the text in a way that makes it unreadable at the scales shown in the example either, when set to any quality.

Regardless this does not resolve the difference in color of the text, even at large scale the contrast is lower than expected. By default the text color is (0,0,0) but instead it renders lighter by a significant amount.

shiftyscales commented 8 months ago

Could you try taking a screenshot with a camera that has post-processing disabled and see if that produces the expected output, @sctanf? I suspect it is a likely candidate.

sctanf commented 8 months ago

@shiftyscales This did produce a much better output:

Client screenshot: text_screenshot Camera with processing off: text_camera_noprocessing text_cameravsgimp image

Through the camera, the text is sharper and contrast is correct again, I'm guessing bloom processing is having an adverse effect on text. If I disable FXAA and disable bloom using mods, the result is comparable.

Small text still does not look perfect (seems inconsistent in contrast) but it is much better

shiftyscales commented 8 months ago

Seeking input from @Frooxius or @Geenz.

Frooxius commented 8 months ago

That's a good finding. Though I'm not sure why exactly FXAA blurs this text so much and what would be the best approach to handle this.

Different AA algorithms could potentially help here. But also there might be something else as part of this that's causing different behavior.

We'd have to investigate some more.

shiftyscales commented 8 months ago

It isn't even just a matter of blurring @Frooxius - I had tried taking screenshots of pure black text. With post-processing on, the result was text with color #252525. Doing so without post-processing rendered the text properly with #000000.

This results in a lowered contrast since the text can't render as dark as it is supposed to. Post-processing On: image

Post-processing Off: image

It seems like something in the post-processing stack is brightening the scene.

These sample images show a pretty stark contrast difference with post-processing off vs on.

The "off" results are much more accurate in this case. I suspect this might also be the same issue that makes the desktop view overly bright. blacktest whitetest

Post-processing On: image

Post-processing Off: image

Geenz commented 8 months ago

That's a good finding. Though I'm not sure why exactly FXAA blurs this text so much and what would be the best approach to handle this.

Different AA algorithms could potentially help here. But also there might be something else as part of this that's causing different behavior.

We'd have to investigate some more.

FXAA hasn't really aged well, especially as we've marched on into the era of linear space rendering as a whole. I suspect that's what's really biting us - we could move to the tweaked and tuned version of TAA I was playing with. I'd want to ship a few test builds first though and collect feedback on motion sickness and "swimming" though - TAA needs a ton of tuning for VR.

Another thing that is likely messing with this is the bloom shader. It may need some additional tweaking. I can put together a few builds to mess with this to find some good defaults.

sctanf commented 8 months ago

The text appears already anti-aliased from rendering, since the test images without FXAA enabled are much closer to the expected result. I think any more anti-aliasing on top of the text, which already seems anti-aliased, will affect the text making it too blurry. I also looked at one of the test images from within the client, and FXAA also processes on this image, giving the text in the image the same blurry effect..

Geenz commented 8 months ago

@sctanf Unfortunately, with image based AA (and no, we can't use MSAA here) it's always gonna be more AA. We can tweak and tune things to make it less impactful on already soft things, but this needs some tuning.

Geenz commented 8 months ago

I've spoken to Froox, and I'll work on a special build to help diagnose this. The hope is we'll have this through Steam in a special branch. More info coming soon.