Why are the normals not constant

I don’t completely understand what DDX and DDY do, but why don’t you just get PixelNormalWS and calculate the dot product with Z? Wouldn’t that give the result you want?