Technical Notebook

Graphics & Math Notes

Implementation snippets on shader filtering, sampling patterns, and numerical geometry.

Screen-space derivatives for anti-aliased SDFs

Using fwidth(d) normalizes distance gradients cleanly across arbitrary perspective transforms without precomputing zoom-dependent feather thresholds:

float edge = max(fwidth(d), 1e-4);
float alpha = clamp(0.5 - d / edge, 0.0, 1.0);

Halton sequences vs. void-and-cluster blue noise

Screen-space tiled blue noise decorrelates low-sample Monte Carlo variance into high-frequency grain that temporal accumulation resolves rapidly.

Gauss-Legendre quadrature for cubic Bézier arc length

A 5-point Gauss-Legendre rule yields sub-0.01% arc-length error across non-degenerate cubic segments with only five derivative evaluations.