By default, the background of a Java 3D virtual universe is solid black. However, you can specify other backgrounds for your virtual worlds. The Java 3D API provides an easy way to specify a solid color, an image, geometry, or a combination of these, for a background.

This program demonstrates how to use a geometry with Texture as the background of the virtual world. As the texture file, the file "background.jpg" is required.

 public BranchGroup createSceneGraph() {

    BranchGroup objRoot = new BranchGroup();
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0),100.0);
    Background bg = new Background();
    BranchGroup backGeoBranch = new BranchGroup();
    Sphere sphereObj = new Sphere(1.1f, Sphere.GENERATE_NORMALS
        | Sphere.GENERATE_TEXTURE_COORDS, 45);
    Appearance backgroundApp = sphereObj.getAppearance();

    TextureLoader tex = new TextureLoader("background.jpg", new String(
        "RGB"), this);
    if (tex != null) {

    return objRoot;