> MIME-Version: 1.0
> Date: Thu, 8 Mar 2001 17:21:32 +0100
> From: BRANDY Cyril <[EMAIL PROTECTED]>
> Subject: [JAVA3D] Normal generation
> To: [EMAIL PROTECTED]
>
> Hi !
>
> I read a mesh from a file representing a plane (17000 vertices)
>
> I put this geometry in a TriangleArray. I have to set the normals for each
> face to have some shading, and i wonder if j3d is able to generate normals
> for each face.
>
> I try to compute the normals myself, but my vertices are not correctly
> ordered so some normals are not correctly oriented.
Yes, Java 3D has a NormalGenerator utility. However, if your
"vertices are not correctly ordered" then the utility will
have the same problem - can't tell what's the front of the
triangle and what's the back. You need to use consistent
"winding" of the vertices to get your normals correct. Once
you have that, the utilities can generate normals for you,
and even turn your individual triangles into strips to
render faster (see javadoc for GeometryInfo, NormalGenerator,
Stripifier).
If you can't correctly order the vertices of the triangle,
try two-sided-lighting - see javadoc for "Light" under "Two-
sided Lighting of Polygons."
-Paul
===========================================================================
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".