You need to add normals to your triangle if you want to light it.
 
David Yazel
http://www.magicosm.net
http://xith3d.dev.java.net/
"No matter how complicated it looks, in the end it is just a bunch of triangles"
----- Original Message -----
Sent: Wednesday, September 24, 2003 4:57 AM
Subject: Re: [JAVA3D] AW: [JAVA3D] Confused with the appearance

It doesn't work. Thanks anyway.
Boby

----- Original Message -----
From: "Dietrich, Harald" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 24, 2003 10:39 AM
Subject: [JAVA3D] AW: [JAVA3D] Confused with the appearance


Try adding this piece of code to your code:

  BoundingSphere bounds = new BoundingSphere();
  bounds.setRadius(Double.POSITIVE_INFINITY);

  Light light = new AmbientLight(true, new Color3f(Color.WHITE));
  light.setInfluencingBounds(bounds);
  objRoot.addChild(light);

  light = new DirectionalLight(true, new Color3f(Color.WHITE), new
Vector3f(0.5f, 0.5f, -1));
  light.setInfluencingBounds(bounds);
  objRoot.addChild(light);

If the object still does not get illuminated, I do not have any idea anymore
(I do not have any experience with 3DS files, so I don't know why its
working there)

Harald

-----Ursprüngliche Nachricht-----
Von: Robert Gomez-Reino [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 24. September 2003 10:06
An: [EMAIL PROTECTED]
Betreff: [JAVA3D] Confused with the appearance


Hi,
I had create a simple application in wich I load an sphere from a 3DS file,
in the same application y create a triangle of the same size with this code:

Shape3D shape = new Shape3D();
  TriangleStripArray geometry = new TriangleStripArray(4,
             TriangleStripArray.COORDINATES,
             new int[] {4});
  Point3d[] points = new Point3d[] {new Point3d(0.3, 0.3, 0),
        new Point3d(-0.3, 0.3, 0),
               new Point3d(-0.3, -0.3, 0),
               new Point3d(0.3, -0.3, 0)};
  geometry.setCoordinates(0, points);
  shape.setGeometry(geometry);
  Appearance appearance = new Appearance();
  ColoringAttributes ca = new ColoringAttributes();
  ca.setColor(new Color3f(1, 0, 0));
  appearance.setColoringAttributes(ca);
  Material material = new Material(new Color3f(0.2f, 0.2f, 0.2f),
       new Color3f(0.1f, 0, 0),
       new Color3f(1, 0.8f, 0.8f),
       new Color3f(1.0f, 1.0f, 1.0f),
       64);
  appearance.setMaterial(material);
  shape.setAppearance(appearance);
  objRoot.addChild(shape);

The sphere has reflection, shadows.... bu the triangle is completly red
without shadows, reflexion...(color set in the coloringAtributtes of the
appearance) and if delete the lines of the coloring attributes the traingle
is completly white. Why the appearance of this triangle is not been
displayed? The bounds are well definied.
Thanks,
Boby
===========================================================================
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".

===========================================================================
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