There is implementation of signed distance field feature for starling 1.x, but there is not one for second starling, fixed with new extension.
Wow, very useful extension, thanks.
Does this only work with black color or will it work with any other color too ??
@Aditya, yes, extension respect standart vertrex color attribute and allow change font color to any other like default MeshStyle.
Ok... so basically we can have bitmap fonts on feathers and can get the quality of vector embedded fonts !!
If this works.. then we can have some performance gain right ?!!!
And yes and no
Sorry but this technique is not silver bullet, it allow you render middle-size bitmap font to large-size with pretty result, but you can't take small font as base - distance fields data within bitmap will be lost while downscale, and you can't gain good result with such fonts.
But yes, this way has more performance as embedded fonts renderer.
And how's the performance? Shader's a bit more complex and I guess that, even for smaller fonts, you need larger textures (what's the reasonable size?). Also, is it possible to have some effect pre-rendered with this approach (things like glow, blur, etc.)?
Performance of the most SDF shaders is pretty good (not much slower than just a normal texture fetch). You can also modify the shader to do things like outlines, glows and drop shadows quite easily.
1. This shader performance is pretty enougth - I make fast tests on my old HTC Desire, and results was a little bit worse as usual MeshStyle (with disable batching ). Only one thing confuses me - what batching signed distance field need more complex shader code, but in result - you still will not be able to batch signed distance TextField with rest meshes (standart MeshStyle).
If you want I can provide more complex performance tests, but I don't see much benefit from them (as you say bit more complex shader take bit more time)
2. Resonable size of bitmap font depends on font =) If you need calligraphic or antiqua font - you need prepare larger bitmas as for simple sans-serif. For demo I use Lobster font with 32px height, with sans-serif I got pretty good result with 24px. I recommend simple pickup optimal size for needed font.
3. I have plans to add stroke and glow effects, but only after I get more user experience with this extension, and can understand needs. But this feature make shader twice complex.
Alexandr, thanks a lot for your efforts! That's great work, and I'm extremely happy to see you're making such great use of Starling 2's MeshStyles!!
However, it seems that we two have had the exact same idea at the same time, because I'm currently working on the same thing.
It's actually very far already, I even added support for glow, outline and drop shadow effects. So don't put too much effort into those effects! I'll probably even make this an integral part of Starling.
Nevertheless, I will definitely look into your code and see how you approached this! And I'd be glad about a code review of my version, once it's out. I'll post that here in this thread!
As promised, I just pushed the DistanceFieldStyle to GitHub. It's now part of the "starling.styles" package!
All information to be found here:
Alexandr, I took the freedom of recreating your demo with my extension - I hope you're fine with that!
Holy sh*t, this is huge And are all of these effects "free", like there's no additional cost to render shadow, stroke, glow?
Only cost you need to pay - break batching, this is low cost for this amazing styles
Thank you, this Demo will warm my soul
I mark extension page as obsolete (after 5 days :-D) and add link to DistanceFieldStyle manual. If someone want to see simplified implementation of distance field - welcome.
I think this topic is closed.
Thanks again, Alexandr, for writing the extension, even though it had a very short live.
In any case, anybody who wants to understand what's going on under the hood to make this work, have a look at Alexandr's code! It's a very concise implementation that will work well, much easier to read than my version (which has to intermix all the effect stuff).
You must log in to post.