View Full Version : The proper way to average and render with normals
Currently I have created a plane using a text file containing xyz points. I have calculated normals for each quad in my plane and my lighting seems to be working fine. What I would like to do now is average my normals in order to get more of a curved surface to my plane as opposed to the jagged angles in my surface that I have now. Is this the sort of process I need to go through in order to impliment this:
Go through point list and create normals for each quad face.
Use quad normal averages to get vertex normals for each vertex.
When rendering assign vertex normal before each vertex.
Is this about right? Do I just forget about the quad normals that I have now?
Any help would be great. Thanks in advance.
05-22-2003, 08:51 AM
There is no "proper" way to do it. There are recommended ways gleaned from past experience. The way I've done it with my height field is to average normals from the surrounding quads (actually I use triangles but that doesn't matter). But I "weight" each normal by the angle that the adjacent sides make at the vertex I'm calculating the normal for. That's not necessarily 90 degrees (or 0.25 as the weighting factor) because the heights will vary in general from vertex to vertex.
And, of course, don't forget to turn on smooth shading.
05-24-2003, 06:55 AM
In addition to what cragwolf said, I also check the angle between the normals before blindly averaging them - if it above a certain threshold (I use 45 degrees) I don't average those normals. This allows you to preserve sharp edges/features etc. It adds a good deal of complication to the code, however, since sometimes at a vertex you want to have a different normal depending on which quad it is being drawn a part of. Strictly speaking, this is the only way to get the "right" normals. It does mean, however, that you cannot use triangle strips, etc. and must draw each primitive (quad, tri, whatever) individually. More work, slower, but more precise. Might not be neccessary for your model.
05-24-2003, 10:40 AM
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.