On Thu, 13 May 1999 15:13:55 +0300, Samuli J�rvel� wrote:

>I'm a beginner with the Java3D, and I have managed to create a class which
>reads object information from a file, and it is exported from 3D Studio into
>ASCII format. This file contains vertex coordinates and indices for the
>faces that the object consists of. The coordinates are read into an
>Point3f-array, and the indices into an int-array. When a new
>IndexedTriangleArray is created with these arrays, it does work fine. The
>object is rendered just like it should be, but the shading isn't.
>I guess it's the matter of the normals, but I'm not sure how can I calculate
>the normals for each vertex.
>Any help or example is welcome!
>
>Samuli J�rvel�
>
Hi Samuli,

you are right, you need  normals for shading. As you have 3 points of each triangle, 
you 
can build 2 vectors which are lying in the same plane like the triangle. now take the 
cross product of this 2 vectors, and you will get the normal of the triangle. you must 
assign this normal to each point of the triangle. disable culling and enable normal 
flipping to see both sides of the triangle.

Gernot
[EMAIL PROTECTED]

=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to