Open Adar-Dagan opened 9 months ago
Have you tried using the git version of bevy? I think this is fixed in #10537
I just tried running the same code with the git version and I get the same issue:
This is a separate problem with Text2d, the text can be transformed arbitrarily so you can't just snap it to a pixel aligned position like with UI text, particularly with rotated text it needs some sort of filtering like the sort of thing that is used for 2.5d pixel art games. The simplest workaround atm is to use the UI to draw the text. There are lots of examples online of how to transform world coordinates to screen coordinates, I think Bevy cookbook has one.
This is a separate problem with Text2d, the text can be transformed arbitrarily so you can't just snap it to a pixel aligned position like with UI text
Presumably we could pixel align Text2d, we'd just need to do so after all transforms have been applied (an approach which I think would also solve some of the residual rounding issues we've had with UI). And I suspect that at the moment, the rendering system doesn't even know it's text at that point.
Also running into this issue, has anyone else found a workaround? At the moment considering just making my own text component that simply uses an atlas/sprite since I don't need other types of scaling, but I'd rather this get fixed :laughing:
The simplest workaround atm is to use the UI to draw the text. There are lots of examples online of how to transform world coordinates to screen coordinates, I think Bevy cookbook has one.
Unfortunately this doesn't work for a lot of use-cases, depending how dynamic your ui/text is.
I'm making a pixel art game and zooming on a small area. I want to just draw everything to that area, including UI. Text2d is working but as others have pointed out, it becomes blurry. Working in the window level is a bit painful in my case. Edit: Font I was using said it was 8px but it was blurry except when I set font size 11 and it's multiples. So this wasn't a issue on bevy side.
I'm also having this issue with some pixel art fonts. Most fonts work just fine when you specify the size as indicated by the font maker, but some require using a different size and some just doesn't work at all (it stays blurry).
For example: https://github.com/itouhiro/PixelMplus/releases
The PixelMplus10
variant is only sharp when you set font_size: 11.0
, even though it's supposed to be 10px font. The PixelMplus12
variant on the other hand stays blurry at all sizes I've tried.
I wonder what's causing this to happen?
With Bevy main
/ cosmic-text
.
This cosmic-text
issue may be relevant: https://github.com/pop-os/cosmic-text/issues/279
Bevy version
0.12.0
[Optional] Relevant system information
AdapterInfo { name: "NVIDIA GeForce MX150", vendor: 4318, device: 7440, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "535.129.03", backend: Vulkan }
What you did
I am trying to display text in the joystix font.
What went wrong
The font is rendered blurry.
Additional information
To show this I wrote this short example that renders the text using the font under a png of how it should look:
This generates the following screenshot:
The png I used for the image: And the ttf file of the font is from here.