Lighting calculation is a very expensive part of rendering, thereby it is important to understand how it can be done in an efficient way. It is also important to discuss aggressive approaches for an optimization of the process and trade-off related to them.
There are two main choices for GPU accelerated computation. It can be executed at fragment/pixel shader or at vertex shader. You can read more about shaders
here.
Due to inaccuracy occurred at the rasterization stage, the brightness calculated at vertex shader can be inaccurate. It is especially bad for calculation of specular lighting because the approach is not able to perform a precise transition of the highlight’s shape. Moreover, small highlights located in a center of polygons are completely lost in case of per vertex lighting. That is why per fragment lighting is the most common solution for modern 3D engines. It provides more accurate and smooth results. Nevertheless, calculations located at fragment/pixel shader are executed much more frequently, which makes the approach relatively slow. Therefore, per vertex lighting is preferred for intensive engineering and scientific visualizations, because performance there is significantly more important than photorealism.