How does Font Rendering Work? | Game Engine Concepts #1
Join the Discord: https://discord.gg/4tHeAkxNg7
How does font rendering work in OpenGL (or DirectX, or Vulkan, etc)? What are the best techniques? Should you go with signed distance field rendering, font bitmap generation, or use the .ttf mathematical notation in the GPU? I attempt to answer these questions in this tutorial, giving a high-level overview of the simplest way to achieve font rendering (and efficient). I also touch on how to achieve more complex techniques to render fonts with greater fidelity, and have some articles and papers linked below to help aid you in that regard.
Links to My Java Implementation
FontTexture: https://github.com/ambrosiogabe/UntitledDungeonCrawler/blob/master/src/main/java/com/jade/renderer/fonts/FontTexture.java
CharInfo: https://github.com/ambrosiogabe/UntitledDungeonCrawler/blob/master/src/main/java/com/jade/renderer/fonts/CharInfo.java
FontRenderer: https://github.com/ambrosiogabe/UntitledDungeonCrawler/blob/master/src/main/java/com/jade/components/FontRenderer.java (This is only here for reference I really don't like the way this class is coded, however I will udpate it with a better implementation once I get around to it :) ).
Articles & Papers
Generating Fonts in Java: https://lwjglgamedev.gitbooks.io/3d-game-development-with-lwjgl/content/chapter12/chapter12.html
STB_Truetype: https://github.com/nothings/stb/blob/master/stb_truetype.h
Stack Overflow: https://stackoverflow.com/questions/5262951/what-is-state-of-the-art-for-text-rendering-in-opengl-as-of-version-4-1
Valve's Paper on SDF: https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf
Will Dobbie on Vector Textures: http://wdobbie.com/post/gpu-text-rendering-with-vector-textures/
Rendering of General Vector Graphics: http://hhoppe.com/ravg.pdf
---------------------------------------------------------------------
Website: https://ambrosiogabe.github.io/
Github: https://github.com/ambrosiogabe
Here are some books I recommend if you want to learn about game engine development more thoroughly. I do not profit off any of these sales, these are just some books that have helped me out :)
My Recommended Game Engine Books:
Game Engine Architecture: https://www.gameenginebook.com/
Game Physics Cookbook (Read this before the next physics book): https://www.amazon.com/Game-Physics-Cookbook-Gabor-Szauer/dp/1787123669
Game Physics (Ian Millington): https://www.amazon.com/Game-Physics-Engine-Development-Commercial-Grade/dp/0123819768
Game Programming Patterns (Free): https://gameprogrammingpatterns.com/
My Recommended Beginning Game Programming Books:
JavaScript Game Design: https://www.apress.com/gp/book/9781430247166
My Recommended Java Books:
Data Structures/Algorithms: https://www.amazon.com/Data-Structures-Algorithms-Java-6th-ebook/dp/B00JDRQF8C
LWJGL (Free, but I haven't read this thoroughly): https://lwjglgamedev.gitbooks.io/3d-game-development-with-lwjgl/content/
Outro Music: https://www.bensound.com/royalty-free-music