Normals

Hello all!

Im calculating normals for every vertex, but in the end, it looks almost as if I was using GL_FLAT instead of GL_SMOOTH, anyway
the way I calculate them is:
C
|\
| \
|__\B
A

A normal:

v1=B-A
v2=C-A
nv=cross(v1,v2)
d=sqrt((vn.x * vn.x) + (vn.y * vn.y) + (vn.z * vn.z))
vn.x/=d
vn.y/=d
vn.z/=d

B Normal:

v1=C-B
v2=A-B
nv=cross(v1,v2)
d=sqrt((vn.x * vn.x) + (vn.y * vn.y) + (vn.z * vn.z))
vn.x/=d
vn.y/=d
vn.z/=d

C Normal:

v1=A-C
v2=B-C
nv=cross(v1,v2)
d=sqrt((vn.x * vn.x) + (vn.y * vn.y) + (vn.z * vn.z))
vn.x/=d
vn.y/=d
vn.z/=d

I think this is the right way to do it, isnt it?

Thx

All of the above calculate the same normal, the normal of the face. If you want smoothed normals: calculate all face normals, then for each vertex average the face normals of the faces that use that vertex.

Dam, i feel dumb :expressionless:
Thx, ur very right