View Full Version : would it be useful to write a utility program that...
10-02-2000, 03:27 PM
it seems like if i'm going to use a vertex array i have to have only one normal per vertex. I guess(correct me if i'm wrong) that the normal is the average of the normals of the surfaces which touch that vertex.
if this is so would it be useful for me to write a program where i gave it my primitive type, indexes for vertices, vertex array, and it wrote a file with all the normals for each vertex?
or is there some built in way to do this? maybe opengl does it for you somehow? i'm real new, i don't know, and it seems like a ROYAL pain in the bottom to calculate all those dot products, average them, and turn them into unit vectros manualy. thanks.
10-02-2000, 10:33 PM
Well prepare yourself for a bit of pain in your behind :-). OpenGL won't do that for you for the classical reason that it works in immediate mode and doesn't have the faintest idea of the global geometry your sending it. It only "sees" one triangle at a time and forgets it once its rendered. Anyway, computing the normals like you said is one way (the most widely used) but generally, which faces you use when averaging your normals is something that can be controlled during the 3D modeling of an object as it contributes to the general aspect of the surface. Am I clear ?! You should take a look at how old 3D Studio or 3D Studio Max manages this (with smooth groups).
10-03-2000, 10:03 AM
Ok i follow. is there anytime when you don't average the normals? Can you think of anytime when you want hte mnormals to change while the program is runnning? thanks
10-03-2000, 10:29 AM
There are cases when averaging is not desired. For example, when lighting a cube. Each corner has 3 distinct normals in this case, which you must preserve in order to correctly light the cube. There are also cases when you may want the normals to be dynamically displaced for special lighting effects, or auto-texture coordinate generation effects (e.g. an environment map that distorts).
10-03-2000, 01:22 PM
oh ok,i see. thats interesting, thanks.
10-10-2000, 04:39 AM
Actually, averaging the surrounding polys won't give you the correct vertex normal. Most of the time it will be acurate enough, but sometimes, especially when using metaballs it is not accurate at all. There is a correct way of calculating it, but I don't remember.
10-13-2000, 10:44 PM
Just a bit of an addendumn.
Max's smoothing groups function is a bit kinky and not quite "right" (see the Maya implementation of Soft/Hard edges) but will work in a pinch. Be careful, though, as introducing discontinuities in your shading (i.e. using different normals at a vertex depending on the tri being rendered) will mean passing more vertices to GL.
Common "artist" uses of shading discontinuities are to reinforce seams in a model/texture (like between a shirt and the arm) and to make sharp edges really stand out. Half-life (and several other notable games) support smoothing groups from Max, all to great effect. Definitely worth the work if you can manage it.
10-15-2000, 07:53 AM
I seem to remember something about scaling the contribution of a face's normal by the area of that face divided by the total area of all the faces that reference the vertex...
does that make any sense ?! http://www.opengl.org/discussion_boards/ubb/wink.gif
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.