I am creating my objects (all of which are rectangular boxes) by using
GeometryInfo class. However, in my scene the objects appear very strange:
There are very bad shadows and the objects seem to be
transparent. What is the reason of this? Is because of generating normals
or because of the lights? I have already generated the normals by using
the NormalGenerator class.
I have attached two views which is created exactly with the same code:
View1.jpg has 4 elements. There is no problem in the appearance of
these elements. However,
View2.jpg has many elements. And the appearance is very bad.
Is the problem related with:
Normal generation: I have already used NormalGenerator class
to generate my normals.
Lighting:
Graphic card:
Vertex specification: I have created all of my geometry by specifying
each face in anti-clockwise direction.
Anything else?
Thanks in advance
Murat Tanyer
PS: The light is near to the viewPlatform (a little bit at the right) pointing to the center of the scene.
Here are my code about GeometryInfo and appearance:
*******************************************************************************************
//CODE ABOUT GEOMETRYINFO
GeometryInfo gi = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
gi.setCoordinates(data);
gi.setStripCounts(stripCount);
gi.setContourCounts(contourCount);
Triangulator tr = new Triangulator();
tr.triangulate(gi);
gi.recomputeIndices();
NormalGenerator ng = new NormalGenerator();
ng.generateNormals(gi);
gi.recomputeIndices();
Stripifier st = new Stripifier();
st.stripify(gi);
gi.recomputeIndices();
// Create the pole appearance
Material poleMaterial = new Material();
poleMaterial.setLightingEnable(true);
Appearance app = new Appearance();
app.setMaterial(poleMaterial);
this.setAppearance(app);
this.setGeometry(gi.getGeometryArray());
****************************************************************************************************
<<inline: View1.jpg>>
<<inline: View2.jpg>>
