Derivatives arise frequently in graphics applications. To meet this need we have added symbolic differentiation as a built-in language feature in the HLSL shading language, available in the June 2010 DirectX SDK release (a much-improved version is in the Windows 8 SDK preview). The symbolic derivative is computed at compile time so it is available in all types of shaders (geometry, pixel, vertex, etc.). The algorithm for computing the symbolic derivative is simple and has reasonable compilation and run-time overhead. The latest preview implementation is described in this paper, Symbolic Differentiation On The GPU, which also has several detailed example HLSL programs. This is joint work with Mark Finch and John Rapp. Tutorials on this work were presented at GDC 2011 by Kev Gee (“Direct 3D 11: Symbolic Derivatives and HLSL”) and at GameFest 2011 by Mark Finch: Symbolic Differentiation in HLSL.
The source code for the Examples of HLSL Symbolic-Differentiation Programs download includes an interactive editor for generating procedural geometric models, and several DirectX examples showing how to use the symbolic differentiation feature to generate the geometry and texture detail at runtime.