Face normals to Vertex normals... How?!
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!!!
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
Hope that helps,
roger_hq
Here is a detailed article specifically designed for .3DS files and face/vertex normals. It has many algorithms that you will find useful.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement