« first day (4997 days earlier)      last day (45 days later) » 

12:22 AM
I'm not sure what they're called
m_action = function { dosomething(); }
they're called "methods" I think
it's a function without a script ID or something
the variable type of m_action is Integer
 
 
5 hours later…
5:48 AM
Thats basically a delegate (they are called function variables in gamemaker)
https://manual.gamemaker.io/monthly/en/GameMaker_Language/GML_Overview/Method_Variables.htm
 
 
5 hours later…
10:24 AM
So, I would like to start doing font rendering, what are your recommendation for a bit of scalable (as in I can zoon in) without sacrificing quality, I don't need excessive zooming, something probably between 50% to 300% at most, since I want to play with UI a bit, and I never done any font rendering before myself (I mean I have used libraries before, but they were a black box, hopefully I will tackle this issue once and for all)
what I am much interested in, is the theory/math behind font rendering (if any), like I want to support basically ascii only for now, and I don't plan on supporting mobile, so basically PC (windows) and would like to understand how SDF or really any system for font rendering works, so I can implement it myself (I am using a software renderer so no GPU/shader)
 
 
2 hours later…
12:27 PM
Signed distance fields are a good way to go. Moderate complexity, and "good enough" over a wide range of scales. Plus the distance information can be used for effects like outlines/glows/shadows cheaply.
 
@DMGregory is there some source for reading about the theory (rather than using it) since using SDF is quite simple
 
The "state of the art" at the moment seems to be the Slug font rendering library, but you'd need to license it. It uses the true curves of the font, so it gets extremely accurate results, though with substantially higher complexity.
Amit Patel of Red Blob Games has been sharing his explorations with SDF font rendering recently. I haven't read it in depth yet, but his explainers are always excellent.
 
Cool, thank you!
I will have a look at it and see if I can find some extra intro-like explanations
 
If you want to go back to the source (🥁), you can read the original SIGGRAPH paper from Valve that popularized the technique
 
12:47 PM
@DMGregory I actually tried that, but I felt I did not understand it, because it first assumed I understand a lot of other stuff, I even went to the references. I am not sure what part of mathematics I am missing honestly,
for example, I don't understand why would alpha testing result in a wavy-like edges
 
1:47 PM
Imagine you have a 2x2 texel quad sitting on a diagonal edge. The top-right texel (x = 1, y = 1) is "inside" (alpha = 1), and the other three corners are "outside" (alpha = 0). In between these corners, bilinear filtering will give us alpha = x * y in this case.
That means if we want to trace the level set alpha = 0.5 as the "edge" of the letter, we can solve y = 0.5/x. This gives us a hyperbolic curve, rather than a straight line. Repeat for the next quad over, and we get a curve bending the other way, resulting in a wiggly line rather than a straight diagonal cutting between these texels.
Just knowing inside/outside doesn't tell us "how far inside/outside?" so there's not enough information for bilinear filtering to reconstruct the correct dividing line between them. For all it knows, the far diagonal corner is as far outside as the others, and so that stretches the level set line to be a compromise between all of them — pulling it too far to the opposite corner and resulting in that wavy shape.
 
2:06 PM
With a distance value, you know how much closer the divider line should be to one corner than another, so you can trace it more accurately (though still not perfectly, since the true distance field might include features smaller than the bilinear interpolation can fit. That's where multi-channel techniques come in, to approximate a complex distance field with multiple simpler ones)
 
 
3 hours later…
5:05 PM
Those are the kind of information I am hoping to learn, but considering how you answered me, I believe those kind of information are not usually contained in particular topic, but rather gained from experience.
 
5:17 PM
Thanks by the way, I do have a general idea about it now, though, a lot of the terminology you used are not very clear to me. Like what do you mean a texel quad sitting on a diagonal line? (a texel is a sample in a 2D texture) and a quad is 4 texels forming a square like shape (usually two triangle, 4 vertices).
Also, may I ask why would alpha be 1 and 0? this was something I also did not understand, I assume the font texture want to ensure no sampling outside the glyph texels, so the make any texel touching the glyph has an alpha of 1 and the other texels who don't touch any glyph have an
:( you can see why I wanted a resource to learn from, I feel I have at least 3 more questions, and I am really not sure where to start(so many questions in my mind about this), like I believe I know enough mathematics to connect the dots, but I don't know where those dots are...
 
5:30 PM
The formula you gave simplifies to x*y for the case I described — which is why I chose that particular assignment of alpha values: it makes the math simple to demonstrate the problem. (1-py)*((1-px)0 + px*0) + py*((1-px)0 + px*1) = py * px and the rest of the terms go to zero.
 
 
1 hour later…
6:41 PM
ah, I see, you were not using the color values, but the alpha values, yeah that indeed simplifies to that.
would you mind to expand on this:
> That means if we want to trace the level set alpha = 0.5 as the "edge" of the letter, we can solve y = 0.5/x. This gives us a hyperbolic curve, rather than a straight line. Repeat for the next quad over, and we get a curve bending the other way, resulting in a wiggly line rather than a straight diagonal cutting between these texels

I don't understand what do you mean by tracing the level set? I am seeing you are substituting an alpha threshold, and I know this becomes more like a level curve.
 
6:57 PM
The level set of a function is the set of x,y pairs where the function achieves a particular value. If we're using alpha testing with a cutoff threshold of a=0.5, the level set where alpha hits exactly that value becomes the dividing line between opaque and transparent rendering: between the fragments we keep and the fragments we discard.
Think of your alpha values as an elevation map. The topographic contours on that map are the level sets for various values of alpha (various elevations). Choosing a cutoff threshold changes which parts of the elevation are underwater (transparent) versus land (opaque). Any given choice of cutoff threshold gives us a particular level set as the shoreline curve dividing water from land, transparent from opaque.
 
Thanks!
this is all great info, very appreciated!
 

« first day (4997 days earlier)      last day (45 days later) »