View Full Version : Drawing Normals for arcs

10-25-2010, 03:39 AM
I am using lighting for my project for which I have to define normals first. Its easy to define for cubes,as we know the direction already with glNormal(1,0,0)...etc But what should I do in case of Arcs, How should I approach for this?
Suppose I have rendered ring. For this I have constructed two curves on X-Y plane with one having radius more than other, and then again constructed two more curves with shifted Z distance. Then I joined these curves by GL_QUAD.
Now how should I generate normal vectors for these surfaces?
Thanks in advance.

10-25-2010, 09:15 PM
I don't know whether anyone can say what you "should" do, but there can be any number of suggestions for what you "can" do.

First, for smooth shading, normals are typically applied to vertices rather than to surfaces. I am assuming that is what you really want to do (but I can't possibly know what you want since you haven't told us). On the other hand, if you want to maintain sharp looking edges between primitives, then apply normals to each face. (That might really mean apply the normals to each vertex, but that no vertices can be shared between primitives, since each primitive (i.e., quad) would need each of its vertices to have the same normal, which would be different from the normals of the neighboring primitives.)

One easy and general way is to compute the normal of each of your quad primitives, and then after normalizing each of them, average the normals of all the faces that meet at each vertex, and store that averaged normal (after normalization) with the vertex.

You can use the cross product to calculate the normal of any plane that can be defined by three points (such as, three corners of a quad).

Anirban Talukdar
10-25-2010, 10:08 PM
Are you interested in a torus calculating vertices and their normals?