I thought that if there are no Lights (Ambient, Direction, etc.) in the
scene then Shapes with Appearances which define a Material would not be
seen.  I thought you had to have at least an AmbientLight in the scene to
see the Shape.

But I commented out *all* Light objects and I can still see the object.  It
is still red and has different shades of red depending on the orientation of
the object's surface plane to the view. (I set normals in all the objects.)

Why?

At one point, I thought I *had* to have an AmbientLight (to get general
gray-like, flat illumination) plus attach a DirectionalLight to the
ViewPlatform to see the object with color and color shading.  But now it
seems to work without any lights defined at all?  What am I forgetting and
how lights work?

Below is my appearance definition.

Cheers,
Bob Gray

     Appearance A = new Appearance();

     RenderingAttributes RA = new RenderingAttributes();
     RA.setDepthBufferEnable(true);
     A.setRenderingAttributes(RA);

     // We want the Planes to have their color defined
     // using materials.

     Material theMaterial = new Material();
     theMaterial.setCapability(Material.ALLOW_COMPONENT_READ);
     theMaterial.setCapability(Material.ALLOW_COMPONENT_WRITE);

     theMaterial.setLightingEnable(true);
     theMaterial.setShininess(PAA.shininess);

     theMaterial.setDiffuseColor(PAA.diffuseColor);

     theMaterial.setAmbientColor(PAA.ambientColor);
     theMaterial.setEmissiveColor(PAA.emissiveColor);
     theMaterial.setSpecularColor(PAA.specularColor);

     A.setMaterial(theMaterial);

     // Setup polygon attributes
     PolygonAttributes PlyA = new PolygonAttributes
                (PolygonAttributes.POLYGON_FILL,
             PolygonAttributes.CULL_NONE, 0.01f, true);

     A.setPolygonAttributes(PlyA);

     // Setup Treansparency

     TransparencyAttributes TA = new TransparencyAttributes
               (PAA.transparencyType, PAA.transparencyValue);
     TA.setCapability(TransparencyAttributes.ALLOW_VALUE_READ);
     TA.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE);
     TA.setCapability(TransparencyAttributes.ALLOW_MODE_READ);
     TA.setCapability(TransparencyAttributes.ALLOW_MODE_WRITE);

     A.setTransparencyAttributes(TA);

     return(A);

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