I'm experimenting with a forward+ rendering setup, where I loop over a list of lights to apply in the pixel shader. If a given light has shadows enabled, I sample the shadow map for that light directly in the loop. I'd like to use EVSM shadow maps with anisotropic filtering, so I need the ddx/ddy of the texture sample position.
I'm thinking I can compute ddx/ddy of the world position outside the lighting loop, and then transform these derivatives into shadow map space using shadow matrix for each light. This seems like it would work, but might be expensive. Are there any other/better tricks for getting approximate derivatives to use?