So, as I understand it, colors and lighting and all that stuff are applied to triangles based on the normal vectors of the vertices. The fragment shader will interpolate between the normal vectors to smoothly apply lighting and coloring across the entire triangle. If you want to make a low poly effect (basically meaning an effect where you don't have this interpolation) you can give each triangle its own vertices that all have the same normal vector so then lighting and coloring will be applied the same across that triangle. The problem with this is that to render the same mesh you need 6 times as much vertex data, which is obviously not ideal. My question is, is there a way to make the fragment shader not interpolate between normals and instead just use one normal for shading the entire triangle.
You could use the ddx and ddy functions of the fragment shader to get two tangent vectors of the surface plane. You could then calculate the cross product of that to find the normal vector for that flat surface. This could then be used to do flat shading for that surface. The problem with this is that it's super demanding as you would need to be calculating a normal for every fragment. So, ideally, I wouldn't want to do this solution either.
You could use the ddx and ddy functions of the fragment shader to get two tangent vectors of the surface plane. You could then calculate the cross product of that to find the normal vector for that flat surface. This could then be used to do flat shading for that surface. The problem with this is that it's super demanding as you would need to be calculating a normal for every fragment. So, ideally, I wouldn't want to do this solution either.