← All resources

Perfecting anti-aliasing on signed distance functions

Auto-discovered

Blog Intermediate

Visit resource ↗

Description

Perfecting anti-aliasing on signed distance functions is a July 2025 technical blog post on blog.pkh.me that derives practical AA and blur formulas for SDF shapes in shaders.

It covers SDF sign conventions, the unit-gradient property of a well-formed distance field, and linearstep opacity ramps. Transition width is chosen from screen resolution or from derivatives such as fwidth and length(dFdx,dFdy). The post compares L1 versus L2 pixel estimates, linear versus smoothstep ramps, and linear versus OkLab color blending, then gives copyable GLSL recipes for centered AA, blur, and outer AA.

It is aimed at intermediate shader authors who already evaluate SDFs and want screen-correct edges in 2D or mapped 3D. Familiarity with GLSL fragment derivatives helps.

Access is a free HTML article with diagrams, animated figures, and complete one-liner formulas.

It is useful as a single reference that replaces hardcoded smoothstep constants with widths tied to SDF gradients and pixel footprint.