Maybe you are confused by Wolfram’s notation. The two vectors in his notation are u and v. The components for U are thus U_x (U subscript x), U_y and U_z. So… the “x’s” are actually U_x and V_x.
no, no, getting it is all part of the trick bcause then you’ll understand MORE stuff, and that has to be a good thight.
It’s kinda like this: the decimal number 1234 can also be written as 11000 + 2100 + 310 + 41, right? Well, a three-dimensional vector <1, 2, 3> can be written as 1*<1, 0, 0> + 2*<0, 1, 0> + 3*<0, 0, 1>. So… when dorbie says that the x component of a normal is A (where A is u.yu.z - u.zu.y), the y component is B and the z component is C, then what he’s saying is you can decompose the vector like so: A*<1, 0, 0> + B*<0, 1, 0> + C*<0, 0, 1>. the X^ from wolfram is just short-hand for writing <1, 0, 0>, i.e. a vector in the x-direction.
make sure your normals are correct with respect to your geometry. The cross product of two vectors u & v will generate a normal with the ‘right-hand rule’. If you point your index finger of your right hand in the direction of u and stick your middle finger at right angles to your palm and point it in the direction of v then sticking your thumb up into the air is the cross product of u and v. This trick works because you can only rotate your middle finger so far and so you’re compelled to rotate your hand to get your fingers pointnig in u and v… and as you do so, your thumb will change direction accordingly.
Why is this important to know? Because if you haev two vectors, u and v, and computed the crossproduct(u, v) and crossproduct(v, u) (note the change in ordering), then you’ll get two vectors in opposite directions.
So, the problem you have, I think, is that you’re sometimes computing the wrong normal.
to fix this,
decide on a winding order for your veritices. I suggest counter-clockwise (the opengl default).
make sure all your triangles are in couter-clockwise order, and
make sure you compute the normals in the right order for your winding.
for example, if you choose counter clockwise, then the front side of your triangle would look like
0
|\
| \
1--2
(0, 1, 2 travel counterclockwise). You could compute the normal as crossProduct(1-0, 2-0) and get a normal pointing towards you (since you’re looking down at this triangle).
If you ensure that your winding order is ALWAYS clockwise then you can always comute your nromals that way and gauarantee they point outwards.