normals for lighting when using triangle strips

Started by
1 comment, last by ph33r 19 years, 5 months ago
I am trying to set up a point light(D3DLIGHT_POINT). As far as I know my vertices need to have normals that show which direction is perpendicular to the triangle the vertices are part of. Here's my problem: I want to use triangle strips and normals. Each vertex will be part of several polygons that all have their individual orientations, right? How do I decide which one the vertex is going to use? Maybe it isn't appropriate to use strips in this situation, but I read that they are faster so I want to use them if possible. I hope that it is clear what my problem is and that I provided enough information. EDIT: changed vertexes to vertices, I demonstrated that I am a newbie again, sorry [Edited by - apprentice on November 25, 2004 1:58:00 PM]
Advertisement
If you want objects to appear curved, or smooth, like a sphere, you use the average normal of all the faces that share the vertex. If you want your object to appear hard edged like a cube, you need to create new vertices that have the same position, but have differing normals.
If you have a triangle, you should have 3 normals for each of the verts. All of them will point in the same direction to find there normal, build two vectors from point a-b and a-c and take the cross product of the two vectors.

Do that for all vertices in the mesh, and then take all normals that share a vertex and average them, to give a smooth rounded look like namethatnobodyelsetook already mentioned.

-Dave Neubelt

This topic is closed to new replies.

Advertisement