# Surface shading on an triangle

Let's assume that in a triangle we have computed the brightness on the vertices of a triangle and we have found that it is maximum.

Can any other point which lies on that triangle have more brightness than the maximum brightness on those vertices ?

That completely depends on how you are computing the shading. If you are then just linearly interpolating the shaded colours across the triangle, i.e. Gouraud shading then, clearly, the answer is "no".

However, if you are doing per-pixel shading by, say, interpolating normals and light directions, then you can easily get a brighter area away from the vertices.

• The second method is Phong shading model ? And could you elaborate more on how you conclude that in Gouraud Shading we cannot have brighter points and in the second method we can have brighter points ? May 26 '16 at 9:17
• @johnjohn gouraud shading is taking a weighted average of the colors of the vertices. While with per pixel you can have a point light near the middle of a large surface. The vertices won't get much light but the middle should have a lot of light. May 26 '16 at 10:08
• @johnjohn just to add to ratchet's comment, WRT Gouraud, just consider two points on a 2D graph where height represents brightness and connect them by a straight line segment. No point along the segment can be higher (i.e. brighter) than the higher end point. If you consider the edges of your triangle it shows that no point on an edge can be brighter than the end vertices. Now for any point inside the triangle just draw, say, a line through the point from edge to edge - the point inside can't be brighter. With per-pixel shading, however, you don't have linear interpolation. May 26 '16 at 13:53
• @SimonF So, to recap there are three methods of finding the brightness: 1) Firstly, calculate the dot product of normals and light vector for each vertex, then interpolate over triangle. 2) Interpolate normals then calculate the dot product with light vector for each point. 3) Interpolate gradient vectors then calculate the dot product with light vector. From these methods, which can give brightness bigger than the vertices? May 27 '16 at 18:50

Assuming you have almost any lighting model at all:

You cannot bound the view irradiance (light reflected from a surface location towards the eye/camera) by computing the irradiance at the vertices and bounding those, even if the surface is completely diffuse Lambertian and has no view-angle term.

Imagine a large floor triangle, and a point lighting near the center of the triangle, close to the surface. The center of the triangle is very bright, while the vertices - which are far away from the light source - are dark.

Alternatively, if you are just asking if a linearly interpolated quantity can exceed the value at any/all of the end points - then the answer is simply 'no' - your bounds are accurate. The key issue here is that irradiance is a non-linear function over the surface, but interpolation is linear

• what if we assume a directional light, whose direction does not depend on the position on the surface. What happens then ? May 27 '16 at 19:47
• @johnjohn same thing, the view direction is still affected by the surface. May 27 '16 at 20:35

I am supplementing the answer of others by adding a picture showing a Blinn and Lambert material applied to a triangle (the triangle has normals in different directions at the corners to show the difference in shading). There is one distant directional light in the scene.

Image 1: Image shows lighting on a triangle lit by directional light.

By comparing the samples in image 1 we can see that the highest color value can be somewhere in the center of the triangle. Which shows that the assumption in your question is generally invalid.

So no you can not generally assume that the corners are the maximum of a triangle. A shader with this property can be constructed but quite a few shaders have this property naturally.

• So there are three methods which you can find the brightness . 1) Firstly, calculate the dot product of normals and light vector for each vertex, then interpolate over triangle. 2) Interpolate normals then calculate the dot product with light vector for each point. 3) Interpolate gradient vectors then calculate the dot product with light vector. From these methods, which can give brightness bigger than the vertices? May 28 '16 at 8:00
• @johnjohn 2 and 3. 1 is Gouraud shading that is hardly used anywhere anymore because it does not look correct. May 28 '16 at 8:03
• So I assume from what you said that the order of interpolation (comes first in Gouraud Shading or comes second in the other methods) can lead to better shading results, only for the last two. May 28 '16 at 8:07
• @johnjohn Gouraud shading is a trick to compensate for the fact that hardware was not fast enough for the job. Nobody even back whan it was conceived thought it was any good. (well obviously if you use Gouraud on a mesh that has one triangle per pixel theres no difference) Since the lightning is heavily dependent on where the local normal points it means that any method that is locally per pixel calculated can have hot spots in other than corners. May 28 '16 at 8:11