← All resources

Partial Derivatives (ddx, ddy, fwidth) (Ronja)

Auto-discovered

Blog Intermediate

Ronja

Visit resource ↗

Description

Ronja’s tutorial 046 demystifies HLSL partial derivatives: ddx and ddy measure how a value changes across 2×2 pixel quads, and fwidth combines them for screen-space-aware filtering.

Demonstrates greyscale debug views, then builds an anti-aliased step (aaStep) that widens cutoffs by one pixel’s gradient - reducing jaggy fire, toon bands, and procedural edges versus raw step().

Includes a scrolling noise fire shader comparing step, aaStep, and smoothstep. Sample projects live in the ShaderTutorials GitHub repo under Assets/046_Partial_Derivatives.

Beginner-friendly Unity CGPROGRAM examples; frequently bookmarked when artists first hit shimmering procedural thresholds at oblique angles.