PDA

View Full Version : Vertex Arrays and Normals



azcoder
05-24-2002, 05:28 PM
Simple Question:

Using Vertext Arrays, I can send 8 vertices and 36 indexes to render a cube without lighting. If I want to light the cube, do I need to send 24 vertices and 24 normals and 36 indexes?

Thank you for any info

V-man
05-24-2002, 09:06 PM
Whichever way you choose to render an object, for VA's you will have 1 normal per vertex, 1 tex coord (Tex Unit 0) per vertex, etc

Right now you have chosen not to share vertices across faces, so normal interpolation is not what you want Im assuming.

PS: accelerating cubes was actually suggested in opengl in the suggestions section. Shot dead on the spot!

V-man

azcoder
05-25-2002, 04:58 AM
I would like to share vertices across faces, but the shared vertex would have a different normal for each face. How can I share vertexes across faces and still have the proper normal used?

Thanks again for your help

knackered
05-25-2002, 07:25 AM
You can't.
You'll have to have duplicate vertices.

azcoder
05-25-2002, 07:43 AM
Thats what I was afraid of.

I am loading a .3ds file that stores shared vertices along with the face indexes. It does not store the normals, so to render it I was going to "unshare" the vertices, generate the normals, and send everything in an expanded form. Is there any way to have OpenGL calculate the normals for me automaticially? That way I will only send the shared vertices and the indexes?

Thanks again for any help

azcoder
05-25-2002, 05:26 PM
My question really is do I have to specify vertex normals to use lighting?

davepermen
05-26-2002, 12:05 AM
as lighting depends on the surface normal of each pixel (or in gl of each vertex), yes

don't be afraid of it..

V-man
05-27-2002, 08:03 AM
For organic models (smooth surfaces) you will probably want to average normals for a shared vertex of neighboring sufaces.

For non-organic models (a cube), you will be forced to duplicate vertices.

Maybe Studio Max has some output feature for "unsharing vertices"???

V-man