1 The derivative of the terrain function with respect to X and Z is used to compute the surface normal via cross product, which determines illumination based on dot product with the sun direction.
“the derivative with respect to X which gives us the slope and tangent in the X Direction and the derivative with respect to Z which gives us a slope and a tangent in the C Direction now the cross product of these two tangents is perpendicular to the surface so let's call it the normal vector”