Math question about fonts and orthographic zoom

Hi,

I use a font called Little_Title.font (a bitmap)
That font is used on Object labels.

I have a orthographic zoom :

go.set("#camera", "orthographic_zoom", 1*(math.pow(zoom_gap, zoom_state)))

zoom_gap value is 1.1.
zoom_state go from -20 to 20, with increments of 1, starting at zero (zoom in and zoom out).

I make the label keep the same size (for the player to be able to read it) with, basically, the same formula than the camera, but zoom-state is reversed :

go.set(tmp_Label, "scale.y", 1*(math.pow(zoom_gap, -zoom_state)))
go.set(tmp_Label, "scale.x", 1*(math.pow(zoom_gap, -zoom_state)))

That mean when the orthographic camera zoom in a direction, the labels zoom in the other direction with the same formula (just with a negative exponent).

More or less, it’s working : the map zoom-in and zoom-out while the label keep the same size.

It’s the “more or less” the problem :
When I zoom-in, the text become greyish and blurry, and after a while unreadable.
When I zoom-out, the text become more and more “white” and sharp.
Same size, just more blurry of more sharp.

I read about the “distance fonts”, but it is said it’s only resolve the problem in a zoom direction, and deeper the problem in the other…

I tried to uncheck “antialisasing” in the font settings, but that change nothing.

I suppose that’s because the math.pow formula can’t exactly reverse by just puting a negative exposant (basicaly, zoom pow 3 pow -3 != zoom) ? No, I’m not very good at maths. You can’t put chocolate on math.

I would like to hear about experience from people about that.
Edit : Spelling.

Can you share some screenshots please? And also a project where this can be tested.

Here’s the project on github.
https://github.com/Vampiloup/syzygie?tab=readme-ov-file
The images you ask for are the three “zoom” ones (0 pour default, min, and max).

Edit : Yes, the star’s appearance change with the zoom level.

Ah, I see. You zoom the camera to something like x6 zoom and then apply an “opposite scale” to the label. This will likely mess with the distance field shader. I would render the text in a separate pass, perhaps using gui nodes and use a world to screen calculation to know where to place the nodes.

I can put a Gui Object in the same collection than a normal one ?

That’s painful. Gui is really not made to follow normal objects.