4
$\begingroup$

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 ?

$\endgroup$
5
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ 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 ? $\endgroup$ – john john May 26 '16 at 9:17
  • $\begingroup$ @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. $\endgroup$ – ratchet freak May 26 '16 at 10:08
  • $\begingroup$ @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. $\endgroup$ – Simon F May 26 '16 at 13:53
  • $\begingroup$ @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? $\endgroup$ – john john May 27 '16 at 18:50
3
$\begingroup$

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

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

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.

Lighting on a triangle lit by directional light

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.

$\endgroup$
  • $\begingroup$ 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? $\endgroup$ – john john May 28 '16 at 8:00
  • 1
    $\begingroup$ @johnjohn 2 and 3. 1 is Gouraud shading that is hardly used anywhere anymore because it does not look correct. $\endgroup$ – joojaa May 28 '16 at 8:03
  • $\begingroup$ 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. $\endgroup$ – john john May 28 '16 at 8:07
  • 1
    $\begingroup$ @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. $\endgroup$ – joojaa May 28 '16 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.