Crisp Pixel Fonts in Unity: No Blur, Effects in Whole Pixels

Last reviewed

Short answer

Pixel fonts blur or lose pixels in Unity when glyphs are rendered from a distance field, sampled with filtering, drawn at a size that is not a whole multiple of the font's pixel grid, or placed at fractional positions. TextMesh Pro keeps them crisp only in raster mode, where its outline and shadow effects are not available.

UniText detects a pixel font on import and renders it one atlas texel per font pixel with nearest sampling. Strokes, glows, shadows, bold and animation all step in whole font pixels, and fonts made only of bitmap strikes render through the same path.

The usual options

  • TextMesh Pro in raster mode. The Raster and Hinted Raster render modes bake a non-antialiased bitmap. The usual recipe sets the sampling size to the font's design size, point filtering and the Bitmap shader, and uses only whole multiples of the design size, since sizes in between render incorrectly.
  • No effects on bitmap text. TextMesh Pro's bitmap shaders have no outline or shadow; those come from distance-field data, which rounds the corners of pixel glyphs.
  • UI Toolkit. TextCore font assets support bitmap render modes with the same per-asset setup.
  • Bitmap formats. Unity imports .ttf, .otf, .ttc and .dfont files, so classic BDF and PCF bitmap fonts have to be converted first.

How UniText renders pixel fonts

  • Automatic grid. A font whose outlines sit on a pixel grid gets its pixels per em on import, 8 for an 8 px font. Detect Pixel Grid re-runs detection, and the value can be set by hand.
  • Exact pixels. Glyphs rasterize once at one texel per font pixel and render with nearest sampling and hard edges. Sizes that are whole multiples of the grid are pixel-exact, and the Inspector warns about other sizes.
  • Effects in whole pixels. A 1 px stroke is a full one-pixel ring, a glow steps per pixel, and bold grows by whole pixels.
  • Snapped motion. Snap To Pixel Grid rounds glyph positions and every offset from shadows, extrusion, wave, shake and reveal to whole font pixels, so animation steps like sprites. Turn it off for smooth sub-pixel motion.
  • Bitmap-only fonts. Fonts that contain bitmap strikes without outlines render at their strike size through the same path.
  • Device pixels. A canvas with Pixel Perfect enabled also aligns the text origin to the device pixel.

Questions

Do I need a separate font asset per size?

No. One pixel font asset serves every size; sizes that are whole multiples of its grid stay pixel-exact.

Can pixel text still use other languages?

Yes. Characters the pixel font lacks fall back to the next font in the stack or to a system font, so a Latin pixel font can sit next to Japanese or Arabic fallback text.

Check it in your project

Run the browser demo, follow the setup guide, or compare the free version with the licenses.

Related problems