# vertex normals

Hi, I want to use a Normal for each Point of my scene. Does anyone know how to calculate them? I’ve just worked with Normals for each Triangle, but that’s not what I want …
THANX

Well actualy what is the good of those vertex normals , explain for beginner please…

Hi !

There are a number of ways to cheat, but still look’s ok, have a look at the Graphics Gems code to have a look on how it can be done, there is an example of code that calculates the vertex normals for a mesh of polygons.

Google should also give you a good set of hits.

Mikael

Originally posted by Tea:
Well actualy what is the good of those vertex normals , explain for beginner please…

Hi !

If you have a sphere for example and just use surface normals (all vertex normals point in the same direction), you get a pretty ugly sphere (unless that’s what you want) because you can see each triangle the sphere is built from.

If you calculate vertex normals you get a smooth sphere (or at least it look’s smooth to som extent). because it makes the colors behave like the triangle is a curved surface.

You do this by modifing the vertex normals to average between the triangles that use that vertex.

Mikael

Originally posted by mikael_aronsson:
[b] Hi !

If you have a sphere for example and just use surface normals (all vertex normals point in the same direction), you get a pretty ugly sphere (unless that’s what you want) because you can see each triangle the sphere is built from.

If you calculate vertex normals you get a smooth sphere (or at least it look’s smooth to som extent). because it makes the colors behave like the triangle is a curved surface.

You do this by modifing the vertex normals to average between the triangles that use that vertex.

Mikael

[/b]

Good example. But this not useful for objects like walls, floors(couse of their low count triangles).

First you should have an ordered structure of your geometric data. I used half-edge data-structure: www.flipcode.com/tutorials/tut_halfedge.shtml

After that just loop around each vertex, add all the normals of the adjacent polygons and then normalize it.