Dark line artifact along edges of the shaded mesh

I have implemented an algorithm to calculate vertex normals by taking the normalized average of all its adjacent triangles. I have subdivided a cube two times with catmull clark and checked the shading. If you look close at the first image you can have these dark lines than run along the topological edges of the mesh (defined in the second picture).

Is this normal (no pun intented) and have to do with vertex normals being just an approximation of surface normals? If so why exactly does these artifacts occur? Or have I probably done something wrong with how I calculated the normals?

• Looks like the optical illusion known as en.wikipedia.org/wiki/Mach_bands Aug 6 '21 at 9:41
• @lightxbulb I see thanks! I just wanted to clarify. I see clear mach bands where's the edge between the light and shadow. And I meant along the topological edges that you can see defined in the second picture. These are mach bands then too right? Whatever reason might be behind the issue, this causes very ugly shading. Do you know if there're any ways to avoid this? Maybe use different shading algorithm in fragment shaders? Aug 6 '21 at 19:49
• I think the issue is a disconitnuous derivative, which you see there. I assume that if your normals are proper (I am not certain about that), and one uses non-linear interpolation (e.g. slerp with 3 vectors) then one should be able to get the proper shading. This is too expensive however, and people usually opt to just increase the triangle count. Aug 6 '21 at 20:07
• Here is an interesting blog on this subject (and interpolation in general): asawicki.info/… Aug 6 '21 at 21:14
• @pmw1234 While I liked the blog I am not sure how quadrilateral interpolation is relevant to the question, maybe I am missing something. On a side note, this may be relevant: researchgate.net/publication/… Aug 6 '21 at 21:20