AnswerBun.com

How to scale signed distance field fonts properly?

Computer Graphics Asked by Endanke on August 27, 2021

I have a setup where I’m rendering a bunch of characters on a canvas with an SDF font. The users can zoom in to see the details of the smaller texts, but currently the smaller characters are quite pixelated. (See the image below.) I’m looking for an approach to improve their quality.

Based on these comments I believe SDF fonts are not really good for small text rendering:

I’m wondering if there’s any viable workaround. For example, would it make sense to somehow reuse the larger characters by rendering them in a separate texture and scaling them down? Because when I zoom out, the larger characters look a lot better as they get smaller, I believe the problem might be that the SDF font cannot be interpolated on a too small scale.

My setup is based on these resources:

I’ve already tried generating mipmaps which didn’t really make any difference.

Scale comparison

One Answer

After some trials I've realized my problem was a programming error and not an actual issue with SDF fonts.

Originally I was rendering the numbers on the texture of the canvas, which had a fixed scale. I thought that it will redraw the quads during the zoom but it wasn't the case. After I've separated the character drawing from the canvas and scaled them separately they finally look sharp.

The linked comments about the small text rendering was slightly misleading. They do have some issues with smaller scale, but that's only the case when the view is zoomed out.

Answered by Endanke on August 27, 2021

Add your own answers!

Related Questions

BRDF for point lights should not return values over 1

1  Asked on August 27, 2021 by emil-kabirov

   

Dynamic Array in GLSL

3  Asked on January 13, 2021 by archmede

   

Combine box shadow with a signed distance field

0  Asked on January 2, 2021 by weichsem

       

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir