Multiple lighting normals per polygon

How do I do this? I’ve read that this gives a more smoothed shading for a polygon.

At the moment I enter one single lighting normal per polygon, after which I give the vertexes to OGL.

And how would this work with vertex/normal arrays?

TY

Hi

Im glad you brought this up, because when i was writing a 3d model converter my end result came up with a normal coordinates for each and every vertex and not just a polygon.

heres a few lines from the model file

// Polygon 1
Material: 1
vertex1: -0.0418246 0.173909 -0.00149998 0.414447 0.849863 -0.325526 0.109375 -0.0234375
vertex2: -0.126289 0.191196 -0.0225 0.245542 0.259048 -0.934132 0.28125 -0.109375
vertex3: -0.11108 0.204185 -0.00149997 0.711149 0.702689 0.0222779 0.21875 -0.109375

// Polygon 2
Material: 1
vertex1: -0.0418246 0.173909 -0.00149998 0.414447 0.849863 -0.325526 0.109375 -0.0234375
vertex2: -0.11108 0.204185 -0.00149997 0.711149 0.702689 0.0222779 0.21875 -0.109375
vertex3: -0.0641145 0.143036 0.0265 0.216828 0.438474 0.872196 0.21875 -0.0078125

x,y,z,normalx,normaly,normalz,u,v is the layout of each vertex.
as you can see from the above numbers, there is a normal for each vertex. And it renders fine

At first i thought it was a bug and i was gonna look into it but now im thinking it supposed to be like that.

Nice name mister Gee. he he.

Well, when you compute per vertex normals, yes you will have a normal value per polygon vertex. Unless if you are generating only one normal per polygon.

Q. Why would you do this one normal per polygon thing?
A. All primitive polygons in OGL are flat so, you could use a normal value per polygon vertex, and if you are using triangles for example, you will only need a third of the storage space.

But this will give you a bunch of jacked up flat surface dice looking lighting if you draw one normal vertex per polygon.

Q. How do you fix this?
A. You will use average normals. This are computed by adding the normal values for each of the polygon vertices that are common to more than one polygon. Then you divide this value by the number of common polygon vertices value you added.

After this, all you need to know is that you will have to acess a normal value per polygon vertex and that same normal value is used by different polygons that share a vertex. For this, you could use a buffer of indeces.

What I have just explained is known as normal map. Go to ati’s web page and they have a some very good stuff on this.
Also, read the common pitfalls in ogl available here.

[This message has been edited by mancha (edited 12-07-2002).]

[This message has been edited by mancha (edited 12-08-2002).]