Pixilation when rendering PNG through texture buttons

4.4

How do I make the text on my PNG’s stop appearing pixilated. In our game there are two hands that hold five cards. Currently our game does not render the text on the cards in high enough quality. We use nearest for our rendering.


In this image the cards should be at least somewhat readable. The names of the cards need to be readable.

In this image the one on the left should be readable and not pixilated.
Are there settings that we need to check? We’ve tried to render the text in engine but it looked exactly the same. Thank you for any help you can provide.

Have you tried changing the filter on the text specifically to something that isn’t “Nearest”? Each canvasitem has its own texture_filter property.

The text is on a png and I have tried every rendering on the texture button.

hi
1 - a TextureButton is a noob node, it should not be used for something like this where you need more than one button.
for this you want a normal Button and to create a theme.
in theme, you can set the states of the button, and for that you can use StyleBoxTextures.

StyleBoxTexture is very good because it allows you to treat a texture like a 9slice and do a bunch of other things, like set “margins”, or add a shadow.

since you are using images, for different buttons I would use a theme variation for each.

2 - for cards it is better to create a card scene and change the image and text. for this use a Control and Containers.
for example, a Button as the card with a theme, then a VBoxContainer, a Label, and TextureRects.

Button (with styleboxes you can expand or set an area of the button for the children to draw on, like margins)
    |->VboxContainer#clicking on all child nodes set to pass so the button can be clicked on
        |->Label (title)
        |->TextureRect (image)
        |->HBoxContainer
            |->Label
            |->TextureRect (symbol)
            |->Label

3 - text could be a different problem, you can’t prevent text from getting pixelated if it’s too small. the best that can be done is render it at a bigger size and then shrink it.
one thing that can be done is get a font that can be read at such small scales, like apple II, DOS or Commodore64 fonts that were originally designed to work at 16x8/16x12 character size (in pixels), but that’s the limit for a font, you can’t make it smaller and still readable.

4 - what is being pixelated is the “attack” text right? what some card games do is use images, or shorten the words so the font can be made bigger.
for example, in yougioh, attack and defense are ATK and DEF, while in heartstone and pixel games they use a hearth and a sword for attack and health.

3 Likes

Thank you very much for your suggestion we are now moving cards to this direction for modularity. We still have issues with pixelization but it looks like it will be easier to fix.

1 Like


This is looking much better thank you. We still would like to improve the rendering of the font now that it is rendered in engine.

it’s looking very nice.

I would add more border to the text of the cards, it will make the white contrast better with the color borders. the choice of font can also help.
here I used a serif font to make the text easier to read, and where the background has less contrast I used a dark and thick border.

It’s a bit of a pain, but I’d suggest considering having two versions of each card, one at each view scale. Godot’s text rendering is convenient, but it can get crunchy when you’re scaling below 1:1.

If you make a “small” card and a “large” card, they should both look great at their native scale.