Emulating OpenGL Normals Calculation

Imagine we have a triangle ABC with normals a, b, c.
glShadeModel is set to GL_SMOOTH.

The question is:
from OpenGL point of view, what is the normal to a point p inside a triangle?

Why do I need this:
I slice a triangle in two, but I want the picture to look exactly the same way as before slicing. This extra tesselation is required for sophisticated coloring, we develop 3D graphs plotter. =)

AFAIK there is no ‘OpenGL normal’ to a point inside the triangle. OpenGL just uses vertex normals and does not interpolate the normals when rendering with GL_SMOOTH but interpolates the color values of the lighting equation.
I don’t understand why you cannot just calculate the interpolated or even the ‘correct’ normal and use that, as the result should be nearly the same as your original rendering and definitely more correct than OpenGLs color interpolation.
I also don’t get why this is an advanced question?

from OpenGL point of view, what is the normal to a point p inside a triangle?

GL typically does Goraud shading, which means that the lighting equation is evaluated only at the vertices. This, in turn, means that you can’t get perfect interpolation for tesselated vertices.

If you use a particular shader that interpolates normals and does lighting per pixel, then you can emulate the interpolation that that shader does. It’s pretty common to use the barycentric coordinates and interpolate the normals based on that.

jwatte,
Thanks a lot!

About barycentric coords:
If I have a point p and a triangle abc, and I know scalars k_1, k_2, k_3, such that:
p = a * k_1 + b * k_2 + c * k_3,
where k_1 + k_2 + k_3 = 1,
then the normal at p would be similar to
n(a) * k_1 + n(b) * k_2 + * k_3
(where [b]n/b denotes normal at point p)

Did I get it right?

Yes

Yes but you may need to renormalize the interpolated normal.