I think that you have to set the normals, Boby -----Ursprungligt meddelande----- Från: Madeti, Henu S. (UMR-Student) [mailto:[EMAIL PROTECTED] Skickat: sö 2003-10-12 17:11 Till: [EMAIL PROTECTED] Kopia: Ämne: [JAVA3D] appearance problem
Hey all, I’m having a problem with the appearance of a shape3d. I created a shape3d from a triangular array, which I obtained from object file geometry info. Now when I set appearance for this shape3d they do not work. Please help me out. I guess it’s the lighting problem which I have it enabled. Textureattributes work fine but not the lighting effects. Here is the piece of code TriangleArray ta1 = new TriangleArray ( 2709, TriangleArray.COORDINATES ); ta1.setCoordinates(0, coo1); s = new Shape3D(ta1); Material m = new Material(); Appearance a = new Appearance(); //texturing takes place fine Texture tex = new TextureLoader(texImage, this).getTexture(); a.setTexture(tex); TextureAttributes texAttr = new TextureAttributes(); texAttr.setTextureMode(TextureAttributes.MODULATE); a.setTextureAttributes(texAttr); a.setTexCoordGeneration( new TexCoordGeneration(TexCoordGeneration.OBJECT_LINEAR , TexCoordGeneration.TEXTURE_COORDINATE_3) ); //culling takes effect too PolygonAttributes pa = new PolygonAttributes(); pa.setCullFace(PolygonAttributes.CULL_NONE); a.setPolygonAttributes(pa); //appearance does not take effect m.setAmbientColor(1.0f, 1.0f, 1.0f); m.setDiffuseColor(1.0f, 1.0f, 1.0f); m.setSpecularColor(0.3f, 0.3f, 0.3f); m.setLightingEnable(true); m.setShininess(100.0f); a.setMaterial(m); s.setAppearance(a); objTrans.addChild(s); thanks venu