Maybe this is a bug.
How do you do this mirroring ??
transform3D.setScale(-1) ? ( I guess the Java3D develop. team never imagined a negative scaling hehehehe )
If so, may you can try another way as reverting X axis of the shapes, as below :
 
private void mirrorShapeXAxis(Shape3D sh)
{
  Appearance app =  sh.getAppearance();
  if (app != null)
  {
   PolygonAttributes polyA = new PolygonAttributes();
   polyA.setCullFace(polyA.CULL_FRONT);
   app.setPolygonAttributes(polyA);
  }
 
  GeometryInfo gi = new GeometryInfo((GeometryArray)sh.getGeometry());
  Point3f[] coords = gi.getCoordinates();
 
   // mirror in X axis
  for(int i=0; i<coords.length;i++)
  {
   coords[i].x = - coords[i].x;
  }
  gi.setCoordinates(coords);  
  // it reverse the normals - not mirror like
  //NormalGenerator ng = new NormalGenerator();
  //ng.generateNormals(gi);
  //gi.recomputeIndices();

  sh.setGeometry(gi.getGeometryArray());
 }
 
 
Please report if it works or not.
 
Alessandro
 
 
 
 
----- Original Message -----
From: "Nick Stark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 09, 2003 10:09 AM
Subject: [JAVA3D] Inverted Normals Question

> Hi -
>
> I have a set of objects, all of whose normals are initially correct (all
> lighting looks as it should).
>
> However, I apply a mirror transform to some of the objects, and when
> viewing the new objects, it appears that the normals have been inverted on
> the geometry.  The lights still look correct for the objects that were not
> mirrored, but the objects that are mirrored have dark faces and bright
> backsides.  The objects have not moved to such a position where this should
> be the case, though.  Is there some issue with the 3D API or is this a
> problem that any of you have encountered before?
>
> Thanks for any help.
>
> Nick
>
> ===========================================================================
> 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