Vertex Normals for Lightmap calculations

Started by
1 comment, last by SlimTimmy 20 years, 7 months ago
Hello, I want to build a lightmap for my terrain. (I''m using heightmaps) But which Triangles should I select to generate a vertex normal? 0 1 2 3 4 5 6 7 8 Ok. Now i want to calculate the Vertex Normal of 4. Which Triangles should I use to do this? The Triangles 3,4,1 / 1,4,5 / 5,4,7 / 7,4,3 ? But when i take these, the result looks not very good. Please help
Advertisement
Construct your grid of triangles from the vertices. When this is done, loop through all the vertices, and average the normals of all faces that are used by that vertex. This will give you the results you require.

Let's see if I can draw this:

0--1--2| /| /||/ |/ |3--4--5| /| /||/ |/ |6--7--8 


To get the vertex normal for vertex 4, average the surface normals of the following triangles:

314, 412, 425, 634, 647, 745

These are all the triangles that include vertex 4.

That should do it.


BTW, Yay to me for producing my first ever ASCII art!

EDIT: dammit, got the pic right, and screwed up my tags!


[edited by - blacksheep on September 3, 2003 4:22:06 PM]
Thanks.
But sometimes it looks not very good. Can anyone show me, where I can find a tutorial based on this problem of the generation of Lightmaps for Terrain. (i don''t want to generate shadows, I already looked at the tutorial at gamedev)

This topic is closed to new replies.

Advertisement