I figured out my problem with Goraud shading on a surface created via a
TriangleArray.
The problem was due
to the fact that I was setting the normal at each triangle vertex to be
equal to the vector that is normal to the plane of the triangle.
Any given triangle in my mesh thus had 3 identical normals at each of its
vertices,
resulting in flat shading across each triangle.
In order to get more realistic shading across my surface, I'm going to try
the strategy of setting the normal at each vertex to be the average of the
normals
of all the triangles that contain that point. Since the mesh of my surface
is roughly HCP (hexagonal close packing),
at each point in the mesh (except along the surface boundary),
I'll obtain a normal by averaging the normals to the 6 triangles that
surround the point.
Since I'm new to 3D graphics, could anyone tell me whether this is something
that is
commonly done? Are there more sophisticated techniques (like weighting)?
Or am I completely missing the boat?
Thanks,
- Jim Robertson
-----Original Message-----
From: Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED]]On Behalf Of James Robertson
Sent: Friday, November 17, 2000 5:59 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Gouraud shading problem
I'm new to shading and can't get Gouraud shading to work with a
TriangleArray.
I've added lighting, have set default ColoringAttributes and Material in the
Appearance, and have enabled and set coordinates and normals in the
geometry.
I'm still getting flat shaded triangles. Other than this lack of Gouraud
shading,
the image appears OK. I'd appreciate any tips or pointers to example code.
Thanks,
Jim Robertson
===========================================================================
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".