• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Vertex Normals for Lightmap calculations

## Recommended Posts

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

#### Share this post

##### Share on other sites
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]

#### Share this post

##### Share on other sites
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)

• ### Forum Statistics

• Total Topics
628282
• Total Posts
2981805

• 9
• 10
• 11
• 17
• 14