I think what you want is: sqrt(n.x*n.x + n.z*n.z) / n.y

Assuming the Y axis is up, this number will be 0 if the triangle is
perfectly horizontal, increasing to 1 where the triangle is at a 45
degree angle with horizontal, increasing to infinity where the triangle
is perfectly vertical. If you want an angle instead, try atan2(n.y,
sqrt(n.x*n.x + n.z*n.z)). This angle will be 0 when the triangle is
horizontal, to pi/2 when it is vertical.

Regarding “sloping down or up”…assuming your triangle are all facing upwards (as they should be for terrain triangles), this question has no meaning. It’ll be up if you move along the triangle one way, down if you move the other way. The triangle by itself has no intrinsic upness or downness.

Now, if some triangles face up and some face down, the above expressions will give you negative results for the down-facing ones. But I don’t think that’s quite what you want.

I need to calculate the slope/angle of a triangle, for my terrain engine.

Is this the right way to do it:

It seems to give me the correct results however I don’t get any sign information, so I don’t know if the face is sloping down or up :/

I guess I can get that information by checking the vertices, but is there another way? A more math correct way err..?

Thanks.