I have a surface that is laid out as 100 x 100 points, wrapping around in both spherical dimensions. I am computing the face normals for the 6 triangles surrounding each point, and then averaging the 6 face normals to arrive at a vertex normal. The normals work about 50% of the time, and I get banding the other 50% percent of the time. Here is the code. Do you see what I am doing wrong?

Hi !

I have not taken a closer look at the code, but a few things to look out for is that the winding order is the same for all triangles, if some of them has reversed winding order the normals get messed up for you.

A nice way to check that out is to show back facing triangles, use two sided lighting and make the “back” color different from the “front” color, that way so have a visual indication that your triangles are facing the right way.

Mikael