Fredrik,

Unfortunately the lighting normals are only for the one face and thus
back faces don't get colored "properly".  As far as I know the only
solution is to cull backfaces and build duplicate geometry to model the
back face properly.

- John Wright
Starfire Research

Fredrik Andersson wrote:
Hello!

I got a Canvas3D with some light, DirectionalLight. I do not think there is
any strange with that.

But when I add an Shape3D and set the Appearance something like this:

appearance = createMaterialAppearance(new Color3f(colors[0], colors[1],
colors[2]));

GeometryInfo gi = null;
NormalGenerator ng = new NormalGenerator();
Stripifier st = new Stripifier();
gi = new GeometryInfo( GeometryInfo.POLYGON_ARRAY );

gi.setCoordinates(cordinates3D[i]);
int[] stripCount = { cordinates3D[i].length/3 };
gi.setStripCounts(stripCount);

shapes3Ds[i] = new Shape3D();
shapes3Ds[i].setAppearance( appearance );

ng.generateNormals(gi);
gi.recomputeIndices();

st.stripify(gi);
gi.recomputeIndices();

shapes3Ds[i].setGeometry(gi.getGeometryArray());

and below is how I create the apperance:


public Appearance createMaterialAppearance(Color3f color) { Appearance materialAppear = new Appearance(); PolygonAttributes polyAttrib = new PolygonAttributes(); polyAttrib.setCullFace(PolygonAttributes.CULL_NONE); materialAppear.setPolygonAttributes(polyAttrib);

       Material material = new Material();
       material.setDiffuseColor(color);
       materialAppear.setMaterial(material);

       return materialAppear;
   }

How ever when I rotate the Shape3D the object is black on the backside. I
thought that when the other side is exposed for the light it would reflect
the same color as the front side.

So if any one could explain why and how to solve it it would be great. I
hope you got all the info you need. My guess is that the problem is in
how i
create the appearance.

Best regards
Fredrik

_________________________________________________________________
Chatt: Träffa nya nätkompisar på Habbo Hotel
http://habbohotel.msn.se/habbo/sv/channelizer

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