There are two basic parts to simulating (or faking) shadows: computing where the shadows are, and creating geometry (or textures) to serve as the shadow.

A polygon specified without material properties can be used as a shadow polygon, called a colored shadow polygon. The color of the shadow polygon, specified by either geometry or with a ColoringAttributes object, is chosen to appear as the object in shade.

This program illustrates how to simulate the Shadow by shadow ploygon.

 // Define a Shadow Polygon Class
public class SimpleShadow extends Shape3D {

      SimpleShadow(GeometryArray geom, Vector3f direction, Color3f col,
        float height) {

      int vCount = geom.getVertexCount();
      QuadArray poly = new QuadArray(vCount, GeometryArray.COORDINATES
          | GeometryArray.COLOR_3);

      int v;
      Point3f vertex = new Point3f();
      Point3f shadow = new Point3f();
      for (v = 0; v < vCount; v++) {
        geom.getCoordinate(v, vertex);
        shadow.set(vertex.x + (vertex.y - height) * direction.x,
            height + 0.0001f, vertex.z + 
            (vertex.y - height) * direction.y);

        poly.setCoordinate(v, shadow);
        poly.setColor(v, col);


public BranchGroup createScene(){
    // This is the plane object which has the Shadow
    Shape3D plane = new LitQuad(new Point3f(-0.3f, 0.6f, 0.2f),
        new Point3f(-0.3f, -0.3f, 0.2f),
        new Point3f(0.6f, -0.3f, -0.3f), 
        new Point3f(0.6f, 0.6f, -0.3f));
    // Create a Shadow Polygon object
    Shape3D shadow = new SimpleShadow((GeometryArray) plane.getGeometry(),
        direction, new Color3f(0.2f, 0.2f, 0.2f), -0.5f);
    // Add the Shadow Polygon object into the scene