Normal from Height Godot

Help me fix the shader. Tested in Expression visualshader

void NormalFromHeightWorld(float In, out vec3 Out)
{
vec3 worldDirivativeX = ddx(Position * 100);
vec3 worldDirivativeY = ddy(Position * 100);
vec3 crossX = cross(TangentMatrix[2].xyz, worldDirivativeX);
vec3 crossY = cross(TangentMatrix[2].xyz, worldDirivativeY);
vec3 d = abs(dot(crossY, worldDirivativeX));
vec3 inToNormal = ((((In + ddx(In)) - In) * crossY) + (((In + ddy(In)) - In) * crossX)) * sign(d);
inToNormal.y *= -1.0;
Out = normalize((d * TangentMatrix[2].xyz) - inToNormal);
}