Thomas,

Normals are "normal vectors". Normal is a mathematical way of saying
"perpendicular to". A Normal is therefore a vector that is perpendicular to
the plane that describes a surface.

The easiest way to generate Normals in Java 3D is to use the NormalGenerator
utility class (part of the com.sun utilities package).

Basically you have to populate a GeometryInfo class with the vertices (as
you described below) and then pass the GeometryInfo object to the
NormalGenerator class from which you can extract a GeometryArray that
includes normal vectors.

There are lots of online 3D graphics courses that describe normal vectors in
more detail. Best of luck!

Sincerely,

Daniel Selman

[EMAIL PROTECTED]
http://www.tornadolabs.com

> -----Original Message-----
> From: Discussion list for Java 3D API
> [mailto:[EMAIL PROTECTED]]On Behalf Of Thomas M Clarke
> Sent: 11 February 2000 14:38
> To: [EMAIL PROTECTED]
> Subject: [JAVA3D] Normals?
>
>
> What exactly are Normals? (I know there used to calculate which face gets
> lighting)
> And How do I define normals for example for the following TriangleArray:
>
>  private static final float[] verts =
>  {
>   -1.0f, 0.0f, 0.0f,
>   1.0f, 0.0f, 0.0f,
>   0.0f, 1.0f, 0.5f,
>
>   -1.0f, 0.0f, 0.0f,
>   0.0f, 0.0f, 1.0f,
>   0.0f, 1.0f, 0.5f,
>
>   1.0f, 0.0f, 0.0f,
>   0.0f, 0.0f, 1.0f,
>   0.0f, 1.0f, 0.5f,
>
>   -1.0f, 0.0f, 0.0f,
>   1.0f, 0.0f, 0.0f,
>   0.0f, 0.0f, 1.0f,
>  };
>
> (this is a shape that has four faces and makes up something like
> a pyramid)
> I just copy and pasted the above verts into the normal array to see what
> happened and it didnt exactly work:
>
>  private static final float[] normals =
>  {
>   -1.0f, 0.0f, 0.0f,
>   1.0f, 0.0f, 0.0f,
>   0.0f, 1.0f, 0.5f,
>
>   -1.0f, 0.0f, 0.0f,
>   0.0f, 0.0f, 1.0f,
>   0.0f, 1.0f, 0.5f,
>
>   1.0f, 0.0f, 0.0f,
>   0.0f, 0.0f, 1.0f,
>   0.0f, 1.0f, 0.5f,
>
>   -1.0f, 0.0f, 0.0f,
>   1.0f, 0.0f, 0.0f,
>   0.0f, 0.0f, 1.0f,
>  };
>
> I then created the shape with the following code:
>
>   Tarray = new TriangleArray(12, TriangleArray.COLOR_3 |
> TriangleArray.COORDINATES | TriangleArray.NORMALS);
>   Tarray.setCoordinates(0, verts);
>   Tarray.setNormals(0, normals);
>   app = new Appearance();
>   mat = new Material(aColor, eColor, dColor, sColor, shinyness);
>   app.setMaterial(mat);
>   shp = new Shape3D(Tarray, app);
>
>
> Thank you
>
> Thomas M Clarke
>
> ==================================================================
> =========
> 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