Derivative Shader Here
// Calculate gradient vec2 gradient = vec2( dot(dUVdx, dUVdx), dot(dUVdy, dUVdy) );
This review explores the utility, performance characteristics, and hidden pitfalls of programming with derivatives. derivative shader
Are derivatives expensive?