public static Spatial createSky(AssetManager assetManager, Texture texture,
            Vector3f normalScale, EnvMapType envMapType, float sphereRadius) {
        if (texture == null) {
            throw new IllegalArgumentException("texture cannot be null");
        }
        final Sphere sphereMesh = new Sphere(10, 10, sphereRadius, false, true);

        Geometry sky = new Geometry("Sky", sphereMesh);
        sky.setQueueBucket(Bucket.Sky);
        sky.setCullHint(Spatial.CullHint.Never);
        sky.setModelBound(new BoundingSphere(Float.POSITIVE_INFINITY, Vector3f.ZERO));
        sky.setShadowMode(ShadowMode.Off);

        Material skyMat;
        switch (envMapType) {
            case CubeMap:
                // make sure it's a cubemap
                if (!(texture instanceof TextureCubeMap)) {
                    Image img = texture.getImage();
                    texture = new TextureCubeMap();
                    texture.setImage(img);
                }
                skyMat = new Material(assetManager,
                        "Common/MatDefs/Misc/Sky.j3md");
                break;
            case SphereMap:
                skyMat = new Material(assetManager,
                        "Common/MatDefs/Misc/SkyNonCube.j3md");
                skyMat.setBoolean("SphereMap", true);
                break;
            case EquirectMap:
                skyMat = new Material(assetManager,
                        "Common/MatDefs/Misc/SkyNonCube.j3md");
                skyMat.setBoolean("EquirectMap", true);
                break;
            default:
                throw new IllegalArgumentException("envMapType=" + envMapType);
        }
        skyMat.setVector3("NormalScale", normalScale);
        texture.setMagFilter(Texture.MagFilter.Bilinear);
        texture.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
        texture.setAnisotropicFilter(0);
        texture.setWrap(Texture.WrapMode.EdgeClamp);
        skyMat.setTexture("Texture", texture);
        sky.setMaterial(skyMat);

        return sky;
    }
Create a sky using the given cubemap or spheremap texture.

@param assetManager from which to load materials
@param texture to use
@param normalScale The normal scale is multiplied by the 3D normal to get
a texture coordinate. Use Vector3f.UNIT_XYZ to not apply and
transformation to the normal.
@param envMapType see {@link EnvMapType}
@param sphereRadius the sky sphere's radius: for the sky to be visible,
its radius must fall between the near and far planes of the camera's
frustum
@return a new spatial representing the sky, ready to be attached to the
scene graph
jme3-core/src/main/java/com/jme3/util/SkyFactory.java