Face normals to Vertex normals... How?!

Started by
3 comments, last by CyberSlag5k 19 years, 2 months ago
AHOY! I have some problems with OGL normals, I made a small script to export models from 3DS, but the 3DS just export the face normals. Now I need to convert the face normals to vertex normals to use the index matrix. The big question is, how can I convert face normals to vertex normals?! Thanks!!!
Advertisement
I'm not an OpenGL expert, so I don't know if there is a pre-made function in OpenGL that will generate vertex normals for you. But the generic algorithm to find vertex normals when you have only face normals is to take each vertex, find all the faces that use that vertex, and average those face normals. That will be the normal for that vertex. You'll need to do that for every vertex in your mesh.

Hope that helps,

roger_hq
_____________________________http://www.deepbluefuture.com"Set Phasers to neuter...""2+2=5 for sufficiently large values of 2."
Here is a detailed article specifically designed for .3DS files and face/vertex normals. It has many algorithms that you will find useful.
Thanks for the help, I found some info in MAX Script help too :D
If you're still looking for the actual routine, for each vertex find every face that that vertex helps create and add the surface normals all together. Then just normalize it and you're done.
Without order nothing can exist - without chaos nothing can evolve.

This topic is closed to new replies.

Advertisement