I am a newcomer to 3D programming and have recently started using the Java
3D toolkit. I have been most pleasantly surprised at how easy it is to use
and how well the runtime environment performs, even on puny PC hardware. 

My application is to depict geological surfaces for the oil industry. I have
imported the surfaces as arrays of x,y,z coordinates into Point3f items,
then loaded these into a GeometryInfo class. Using the NormalGenerator, I
have a nice smooth depiction of the surface but I can only see it when
viewing it from below (i.e. lower Y axis values). When I move to a position
above the plane of my geological surface, it becomes tranparent. Any ideas
how to render the surface so that I can see it from above and below?


Here's a sample of the code which generates the surface:

                GeometryInfo gi = new
GeometryInfo(GeometryInfo.POLYGON_ARRAY);
                gi.setCoordinates(p3faTemp);
                gi.setStripCounts(intaStrips);
                gi.setColors(colors);
                gi.setContourCounts(null);
                NormalGenerator ng = new NormalGenerator();
                ng.generateNormals(gi);
                shape.setGeometry(gi.getGeometryArray());
                Appearance app = new Appearance();              
                Color3f aColor  = new Color3f(0.1f, 0.1f, 0.1f);
                Color3f eColor  = new Color3f(0.0f, 0.0f, 0.0f);
                Color3f dColor  = new Color3f(0.1f, 0.1f, 0.1f);
                Color3f sColor  = new Color3f(1.0f, 1.0f, 1.0f);
                Material m = new Material(aColor, eColor, dColor, sColor,
120.0f);
                m.setLightingEnable(true);
                app.setMaterial(m);
                shape.setAppearance(app);

Here's a sample of the code which lights the scene

                // Set up the ambient light
                Color3f ambientColor = new Color3f(1f, 0.5f, 0.5f);
                AmbientLight ambientLightNode = new
AmbientLight(ambientColor);
                ambientLightNode.setInfluencingBounds(bounds);
                objRoot.addChild(ambientLightNode);

                //Shine it with two colored lights.
                Color3f lColor1 = new Color3f(1f, 1f, 1f);
                Color3f lColor2 = new Color3f(1f, 1f, 1f);
                Vector3f lDir1  = new Vector3f(-1.0f, 1.0f, -1.0f);
                Vector3f lDir2  = new Vector3f(1.0f, 1.0f, 1.0f);
                DirectionalLight lgt1 = new DirectionalLight(lColor1,
lDir1);
                DirectionalLight lgt2 = new DirectionalLight(lColor2,
lDir2);
                lgt1.setInfluencingBounds(bounds);
                lgt2.setInfluencingBounds(bounds);
                objRoot.addChild(lgt1);
                objRoot.addChild(lgt2);:

Regards,

John Shields
Aberdeen, Scotland

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

Reply via email to