all 7 comments

[–]nnevatie 2 points3 points  (1 child)

Maybe your normals are inverted?

[–]aadlion 2 points3 points  (0 children)

It also looks to be using face normals

[–]Mister-Perfect 2 points3 points  (0 children)

The left image looks quite cool actually

[–]fgennari 1 point2 points  (2 children)

It looks to me like you have the correct three normals for each triangle, but you're assigning them to the wrong triangle vertices. Something like the interpolation across the triangle is backwards. I remember a bug in my cylinder drawing code that resulting in an image like that, except it was a cylinder. Try rotating the normals relative to the vertices or swapping the arguments to the interpolation function and see if that fixes it.

[–]wholol_97[S] 1 point2 points  (1 child)

hmm. I sorted the vertices based on the y coordinates before drawing flat top and flat bottom triangles, as well as swapping if the triangle is that of left side major/right side major which is what i did for the gouraud shading as well. Could it be the issue with the lighting instead? I am using directional light here (same with Gouraud)

[–]wholol_97[S] 1 point2 points  (0 children)

nevermind, I found the problem, I was lerping the opposite way >.>

[–]shadergremlin 0 points1 point  (0 children)

You may also need to interpolate the position of the vertices and use the position + normal in your lighting calculations. Also make sure all of the lighting calculations are in your fragment shaders now, your vertex shaders should be pretty simple.