Smoothing normals

Hello all.

Hope this question is advanced enough to this forum :-).
I’m writing VRML 1.0 viewer (just for fun). Some days ago I ran into this normal smoothing problem: VRML 1.0 specs says that generated normals should be smoothed according to crease angle value. When there are two adjacent faces, and angle between them (==angle between their normals) < crease angle browser should average their respective normals, thereby obtaining smooth, Goraud shaded look. And this is OK if you have no more than two faces sharing same vertex.
Say (and this is very frequent case) that there are more than that, three faces, for example A B and C. They’re all sharing one common vector v. Angle between A and B < crease angle. Angle between B and C < crease angle. Angle between A and C > crease angle.
According to specs, I should average A and B normals in vertex v, and also average B and C normals in same vertex.
And that gives me two “concurrent” normals for face B.
I feel that averaging between them is not right solution, am I right?
And, if so, what is right?

Another idea I had was calculating something like “supernormal”, using all normals in given vertex (no matter how many there are).
I’d calculate it not by simple vector addition, but weighting each normal’s influence on “supernomal” (for example according to angular size of face). Then I’d average all normals which have angle between them and “supernormal” < ( crease angle / 2 ). Will it do?

Thanks for help.


If you need to combine smooth faces and non smooth faces, like you described, you need to duplicate the vertex which is causing the problem. You give one vertex the smoothed normal, and the other one (which is used by the face which stays flat) gets the face normal.
You can also do this if you have highly differing normals, but everything is smooth.

Just look out that the faces use the correct vertices.


OK, but I have two normals per vertex in same face. I know that I can use “separate” vertex for each face, this is obvious. But I can have only one vertex “v” per one face. And I have two normals for it :frowning:

If you have more than two triangles sharing an edge, you’re working with non-manifold geometry. Non-manifold geometry is a nightmare from many standpoints, and you should not allow it.

If you find it, make sure that one of the three polys is double-sided, and split it out from the others by duplicating verts.