It is defined in the math of the normal calculation itself and it obeys the
winding rule.

Given points P1, P2 and P3 in that order then the calculation of the normal
first picks one of those points, say P2.

We then subtract each of the other two vectors so we have a

V1 = P2-P1
V2 = P2-P3

Now you cross those two vectors

N = V1.CROSS(V2)

The normailize the normal

N.NORMALIZE

So you can see that based on this you will get the same answer no matter
which vertex you pick. BUT...

if you change the sequence, and there is only one other way to sequence 3
points, it will reverse the direction of the normal.

So the rule is the normal formed from the plane determines what is the back
face and front face.  So the sequence that the points are specified
determine what is front facing, and the sequence is clock wise or CCW based
on a view aligned to the viewer.

So the rule of thumb is to look straight at the front of the face and use
the 3 points in a clockwise rotation.

Now backfacing and front facing polygons are not necessarily the same thing
as the normal used for lighting.  The face normal (which we described above)
determines if it is backfacing (as in the back is to the camera).  The
lighting normal is often an average normal for a vertex shared by more than
one face.  The relationship of this normal to the light source is used to
modulate the vertex colors, hence causing shading.

Hope that is helpful.

Dave Yazel



-----Original Message-----
From: Edward Hetherington [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 12:00 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Definition of normals


Can anyone point me to J3D's definition of normals? Or a definition of
normals
in general?

I don't understand why the normal's direction for a vertex depends on the
order
in which the vertices are defined.

For instance, a TriangleStripArray defined with coordinates and normals:
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0
faces out from the origin, while
0.0, 0.0, 1.0,
0.0, 1.0, 0.0,
1.0, 0.0, 0.0
faces inwards.

It seems that when the vertices are ordered so that the first three are
defined
clockwise when viewed from the origin, a positive normal points away from
the
origin. But when the same vertices are defined counterclockwise, a positive
normal faces inward.

Thanks

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to