Original Post
I'm trying to figure out the best way to calculate surface normals for a surface. I had a vague recollection that the way you do this is calculate the normals for at the triangles that intersect at that vertex and combine them. In my situation, I have a fairly regular mesh that is almost like a grid. Each vertex on the grid intersects with six other triangles. I can easily determine the six vertices surrounding the center vertex that. The main complication is that the triangles are much closer to icosolese triangles than right triangles since they are sub-divided from the faces of an icosahedron. I'm not sure if that changes the calculation. My question is, is there an algorithm to take these seven vertices and compute the vertex normal for the one at the center? or do I have to calculate the triangle normals first? I'm still not sure what tangent space is, or how normal mapping is going to affect the problem, or if this article has all the answers: http://www.gamedev.net/reference/articles/article2264.asp This Post http://groups.google.com/group/microsoft.public.win32.programmer.directx.graphics/browse_thread/thread/8737cbab52062a98/ebaf84fa5cfe5aaf?lnk=gst&q=compute+normals&rnum=3#ebaf84fa5cfe5aaf suggests that I can "Make a tangent vector from neighbours in the X direction, and one from neighbours in the Z direction (or Y of your plane is XY), then take the cross product and normalize." "Cross product produces a vector that is perpendicular to the two input vectors. Point left index finger horizontally in front of you - that is tangent in X direction; lay right index finger over left finger and point away from you - that is tangent in Z direction. Visualize a third finger (or get a friend to help, or use other body part) pointing up from the cross-over point that is right-angles to both of your fingers... this is the normal vector that would be produced. " That sounds very close to what I'm trying to do, though it seems to me that I have three pairs of neighbors. Essentially, I have a fractally generated globe. I don't use perlin noise or any kind of linear function to generate the terrain; I use a recursive subdivision algorithm. What I want to do is burn the detail data into a texture, so I can display the globe at a lower detail. I was planning on using render-to-texture for this. Since it's not a function I can easily put an x/y value into, the only way for me to avoid the render-to-texture technique would be a sort of raytracing/raycasting method per pixel to generate the texture image, but it seems that the GPU would be way faster to do this on. What are the best resources for a render normal map to texture type technique? I found this one: http://www.gamedev.net/community/forums/topic.asp?topic_id=348397&whichpage=1�