Hello Alexei,
>
[...] I went searching for *practical* examples on the internet and
> found very few.
There are quite a few examples on youtube, and most of them use 8-bit
buffers to represent SDF.
I don't think we have to align the format with OpenGL. We can convert
the SDF data to any format in OpenGL, so I don't think we need to align.
In the blog you mentioned the OpenGL texture format is probably GRAY8.
> The blog post that I mentioned is okay with GRAY8 unevenly split at 192,
> which brings the question of units too. The units or scale of SDF do not
> seem to be important.
For most cases negative values are simply ignored, therefore uneven splitting
is okay. But, that might not be the case in every scenario. The units are not
important, as long we can create acceptable interpolation to render text.
> Finally, I am not sure if you realize that FreeType gray coverage
> [...] I wonder if we really need 16 bits for acceptable
> interpolation. Probably not.
I do know about the FreeType's antialiased rendering, the 'bsdf' renderer
takes advantage of the coverage values to generate SDF.
As for the number of bits, even behdad told me that 8 bits is enough to
And even some other SDF generators use 8 bits to represent the final SDF
output data
:
I did test 8 bit SDF today, and the final rendering output is
similar to 16 bit. For my testing I used 3.5 fixed point representation,
Finally, we can definitely use 8 bit output to represent SDF and render
acceptable text using it. Now, we can either eliminate the current 16 bit
output, or, we can keep both 16 and 8 bit output. What do you think will be
the better option ? I think we should keep a single output (probably 8 bit)
and later add an option to directly output floating point data (if we decide
to add floating point calculations to FreeType)
Anuj