Java Code Examples for com.jme3.scene.Geometry#setQueueBucket()

The following examples show how to use com.jme3.scene.Geometry#setQueueBucket() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestBlendEquations.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Adds a "transparent" quad to the scene, that shows an inverse blue value sight of the scene behind.
 */
private void createLeftQuad() {
    Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

    // This color creates a blue value image. The effect will have a strength of 80% (set by the alpha value).
    material.setColor("Color", new ColorRGBA(0f, 0f, 1f, 0.8f));

    // Result.RGB = Source.A * Source.RGB - Source.A * Destination.RGB
    // Result.A   = Destination.A
    material.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Custom);
    material.getAdditionalRenderState().setBlendEquation(RenderState.BlendEquation.Subtract);
    material.getAdditionalRenderState().setBlendEquationAlpha(RenderState.BlendEquationAlpha.Add);
    material.getAdditionalRenderState().setCustomBlendFactors(
            RenderState.BlendFunc.Src_Alpha, RenderState.BlendFunc.Src_Alpha,
            RenderState.BlendFunc.Zero, RenderState.BlendFunc.One);

    leftQuad = new Geometry("LeftQuad", new Quad(1f, 1f));
    leftQuad.setMaterial(material);
    leftQuad.setQueueBucket(RenderQueue.Bucket.Transparent);
    rootNode.attachChild(leftQuad);
}
 
Example 2
Source File: TestBlendEquations.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Adds a "transparent" quad to the scene, that limits the color values of the scene behind the object.<br/>
 * This effect can be good seen on bright areas of the scene (e.g. areas with specular lighting effects).
 */
private void createRightQuad() {
    Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    material.setColor("Color", new ColorRGBA(0.4f, 0.4f, 0.4f, 1f));

    // Min( Source , Destination)
    material.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Custom);
    material.getAdditionalRenderState().setBlendEquation(RenderState.BlendEquation.Min);
    material.getAdditionalRenderState().setBlendEquationAlpha(RenderState.BlendEquationAlpha.Min);

    // In OpenGL no blend factors are used, when using the blend equations Min or Max!
    //material.getAdditionalRenderState().setCustomBlendFactors(
    //        RenderState.BlendFunc.One, RenderState.BlendFunc.One,
    //        RenderState.BlendFunc.One, RenderState.BlendFunc.One);

    rightQuad = new Geometry("RightQuad", new Quad(1f, 1f));
    rightQuad.setMaterial(material);
    rightQuad.setQueueBucket(RenderQueue.Bucket.Transparent);
    rootNode.attachChild(rightQuad);
}
 
Example 3
Source File: TestPostWater.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void createBox() {
        //creating a transluscent box
        box = new Geometry("box", new Box(50, 50, 50));
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", new ColorRGBA(1.0f, 0, 0, 0.3f));
        mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
        //mat.getAdditionalRenderState().setDepthWrite(false);
        //mat.getAdditionalRenderState().setDepthTest(false);
        box.setMaterial(mat);
        box.setQueueBucket(Bucket.Translucent);


        //creating a post view port
//        ViewPort post=renderManager.createPostView("transpPost", cam);
//        post.setClearFlags(false, true, true);


        box.setLocalTranslation(-600, 0, 300);

        //attaching the box to the post viewport
        //Don't forget to updateGeometricState() the box in the simpleUpdate
        //  post.attachScene(box);

        rootNode.attachChild(box);
    }
 
Example 4
Source File: SkeletonControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void showSkeleton(boolean flag) {
    if (flag) {
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Green);
        mat.getAdditionalRenderState().setDepthTest(false);
        SkeletonWire sw = new SkeletonWire(skeleton);
        Geometry skeletonWireGeom = new Geometry("skeletonWire", sw);
        model.attachChild(skeletonWireGeom);
        skeletonWireGeom.setMaterial(mat);
        skeletonWireGeom.setQueueBucket(Bucket.Transparent);
    } else {
        if (skeletonLineNode != null) {
            skeletonLineNode.removeFromParent();
            skeletonLineNode = null;
        }
    }
}
 
Example 5
Source File: TestPostWater.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void createBox() {
        //creating a transluscent box
        box = new Geometry("box", new Box(new Vector3f(0, 0, 0), 50, 50, 50));
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", new ColorRGBA(1.0f, 0, 0, 0.3f));
        mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
        //mat.getAdditionalRenderState().setDepthWrite(false);
        //mat.getAdditionalRenderState().setDepthTest(false);
        box.setMaterial(mat);
        box.setQueueBucket(Bucket.Translucent);


        //creating a post view port
//        ViewPort post=renderManager.createPostView("transpPost", cam);
//        post.setClearFlags(false, true, true);


        box.setLocalTranslation(-600, 0, 300);

        //attaching the box to the post viewport
        //Don't forget to updateGeometricState() the box in the simpleUpdate
        //  post.attachScene(box);

        rootNode.attachChild(box);
    }
 
Example 6
Source File: WelcomeScreen.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void setupSkyBox() {
    Mesh sphere = new Sphere(32, 32, 10f);
    sphere.setStatic();
    skyBox = new Geometry("SkyBox", sphere);
    skyBox.setQueueBucket(Bucket.Sky);
    skyBox.setShadowMode(ShadowMode.Off);

    Image cube = SceneApplication.getApplication().getAssetManager().loadTexture("Textures/blue-glow-1024.dds").getImage();
    TextureCubeMap cubemap = new TextureCubeMap(cube);

    Material mat = new Material(SceneApplication.getApplication().getAssetManager(), "Common/MatDefs/Misc/Sky.j3md");
    mat.setBoolean("SphereMap", false);
    mat.setTexture("Texture", cubemap);
    mat.setVector3("NormalScale", new Vector3f(1, 1, 1));
    skyBox.setMaterial(mat);

    ((Node) SceneApplication.getApplication().getViewPort().getScenes().get(0)).attachChild(skyBox);
}
 
Example 7
Source File: BaseMaterialEditor3DPart.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
/**
 * Change the {@link Bucket} in the {@link EditorThread}.
 *
 * @param bucket the new bucket.
 */
@JmeThread
protected void changeBucketTypeImpl(@NotNull final Bucket bucket) {

    final Geometry testQuad = getTestQuad();
    testQuad.setQueueBucket(bucket);

    final Geometry testSphere = getTestSphere();
    testSphere.setQueueBucket(bucket);

    final Geometry testBox = getTestBox();
    testBox.setQueueBucket(bucket);
}
 
Example 8
Source File: TestShaderNodesStress.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void simpleInitApp() {

    Quad q = new Quad(1, 1);
    Geometry g = new Geometry("quad", q);
    g.setLocalTranslation(-500, -500, 0);
    g.setLocalScale(1000);

    rootNode.attachChild(g);
    cam.setLocation(new Vector3f(0.0f, 0.0f, 0.40647888f));
    cam.setRotation(new Quaternion(0.0f, 1.0f, 0.0f, 0.0f));

    Texture tex = assetManager.loadTexture("Interface/Logo/Monkey.jpg");

    Material mat = new Material(assetManager, "Common/MatDefs/Misc/UnshadedNodes.j3md");
  //Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

    mat.setColor("Color", ColorRGBA.Yellow);
    mat.setTexture("ColorMap", tex);
    g.setMaterial(mat);
    //place the geoms in the transparent bucket so that they are rendered back to front for maximum overdraw
    g.setQueueBucket(RenderQueue.Bucket.Transparent);

    for (int i = 0; i < 1000; i++) {
        Geometry cl = g.clone(false);
        cl.move(0, 0, -(i + 1));
        rootNode.attachChild(cl);
    }

    flyCam.setMoveSpeed(20);
    Logger.getLogger("com.jme3").setLevel(Level.WARNING);

    this.setAppProfiler(new Profiler());

}
 
Example 9
Source File: TestColoredTexture.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
    Quad quadMesh = new Quad(512,512);
    Geometry quad = new Geometry("Quad", quadMesh);
    quad.setQueueBucket(Bucket.Gui);

    mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
    quad.setMaterial(mat);
    guiNode.attachChildAt(quad, 0);

    nextColor = ColorRGBA.randomColor();
    prevColor = ColorRGBA.Black;
}
 
Example 10
Source File: TestColoredTexture.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
    Quad quadMesh = new Quad(512,512);
    Geometry quad = new Geometry("Quad", quadMesh);
    quad.setQueueBucket(Bucket.Gui);

    mat = new Material(assetManager, "Common/MatDefs/Misc/ColoredTextured.j3md");
    mat.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
    quad.setMaterial(mat);
    guiNode.attachChildAt(quad, 0);

    nextColor = ColorRGBA.randomColor();
    prevColor = ColorRGBA.Black;
}
 
Example 11
Source File: HelloMaterial.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void simpleInitApp() {

  /** A simple textured cube -- in good MIP map quality. */
  Box cube1Mesh = new Box( 1f,1f,1f);
  Geometry cube1Geo = new Geometry("My Textured Box", cube1Mesh);
  cube1Geo.setLocalTranslation(new Vector3f(-3f,1.1f,0f));
  Material cube1Mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  Texture cube1Tex = assetManager.loadTexture("Interface/Logo/Monkey.jpg");
  cube1Mat.setTexture("ColorMap", cube1Tex);
  cube1Geo.setMaterial(cube1Mat);
  rootNode.attachChild(cube1Geo);

  /** A translucent/transparent texture, similar to a window frame. */
  Box cube2Mesh = new Box( 1f,1f,0.01f);
  Geometry cube2Geo = new Geometry("window frame", cube2Mesh);
  Material cube2Mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  cube2Mat.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
  cube2Mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);  // activate transparency
  cube2Geo.setQueueBucket(Bucket.Transparent);
  cube2Geo.setMaterial(cube2Mat);
  rootNode.attachChild(cube2Geo);

  /** A bumpy rock with a shiny light effect. To make bumpy objects you must create a NormalMap. */
  Sphere sphereMesh = new Sphere(32,32, 2f);
  Geometry sphereGeo = new Geometry("Shiny rock", sphereMesh);
  sphereMesh.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres
  TangentBinormalGenerator.generate(sphereMesh);           // for lighting effect
  Material sphereMat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
  sphereMat.setTexture("DiffuseMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond.jpg"));
  sphereMat.setTexture("NormalMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond_normal.png"));
  sphereMat.setBoolean("UseMaterialColors",true);    
  sphereMat.setColor("Diffuse",ColorRGBA.White);
  sphereMat.setColor("Specular",ColorRGBA.White);
  sphereMat.setFloat("Shininess", 64f); // [0,128]
  sphereGeo.setMaterial(sphereMat);
  //sphereGeo.setMaterial((Material) assetManager.loadMaterial("Materials/MyCustomMaterial.j3m"));
  sphereGeo.setLocalTranslation(0,2,-2); // Move it a bit
  sphereGeo.rotate(1.6f, 0, 0);          // Rotate it a bit
  rootNode.attachChild(sphereGeo);
  
  /** Must add a light to make the lit object visible! */
  DirectionalLight sun = new DirectionalLight();
  sun.setDirection(new Vector3f(1,0,-2).normalizeLocal());
  sun.setColor(ColorRGBA.White);
  rootNode.addLight(sun);
}
 
Example 12
Source File: TestDepthFuncChange.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void simpleInitApp() {
    viewPort.setBackgroundColor(ColorRGBA.DarkGray);
    flyCam.setMoveSpeed(20);
    
   
    //top of the screen
    //default depth func (less or equal) rendering.
    //2 cubes, a blue and a red. the red cube is offset by 0.2 WU to the right   
    //the red cube is put in the transparent bucket to be sure it's rendered after the blue one (but there is no transparency involved).
    //You should see a small part of the blue cube on the left and the whole red cube
    Box boxshape1 = new Box(1f, 1f, 1f);
    Geometry cube1 = new Geometry("box", boxshape1);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", ColorRGBA.Blue);
    
    cube1.setMaterial(mat);
    rootNode.attachChild(cube1);
    cube1.move(0, 1.5f, 0);      
    
    Geometry cube2 = cube1.clone(true);
    cube2.move(0.2f, 0 , 0);    
    cube2.setQueueBucket(RenderQueue.Bucket.Transparent);
    cube2.getMaterial().setColor("Color",  ColorRGBA.Red);
    rootNode.attachChild(cube2);
    
    //Bottom of the screen
    //here the 2 cubes are clonned and the depthFunc for the red cube's material is set to Less
    //You should see the whole bleu cube and a small part of the red cube on the right
    Geometry cube3 = cube1.clone();
    Geometry cube4 = cube2.clone(true);
    cube4.getMaterial().getAdditionalRenderState().setDepthFunc(RenderState.TestFunction.Less);       
    cube3.move(0,-3,0);
    cube4.move(0,-3,0);
    rootNode.attachChild(cube3);
    rootNode.attachChild(cube4);
    
    //Note that if you move the camera z fighting will occur but that's expected.
            
    
}
 
Example 13
Source File: TestBloomAlphaThreshold.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void simpleInitApp()
{
	// put the camera in a bad position
	cam.setLocation(new Vector3f(-2.336393f, 11.91392f, -10));
	cam.setRotation(new Quaternion(0.23602544f, 0.11321983f, -0.027698677f, 0.96473104f));
	// cam.setFrustumFar(1000);

	Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");

	mat.setFloat("Shininess", 15f);
	mat.setBoolean("UseMaterialColors", true);
	mat.setColor("Ambient", ColorRGBA.Yellow.mult(0.2f));
	mat.setColor("Diffuse", ColorRGBA.Yellow.mult(0.2f));
	mat.setColor("Specular", ColorRGBA.Yellow.mult(0.8f));
	mat.setColor("GlowColor", ColorRGBA.Green);

	Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
	matSoil.setFloat("Shininess", 15f);
	matSoil.setBoolean("UseMaterialColors", true);
	matSoil.setColor("Ambient", ColorRGBA.Gray);
	matSoil.setColor("Diffuse", ColorRGBA.Black);
	matSoil.setColor("Specular", ColorRGBA.Gray);

	teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
	teapot.setLocalTranslation(0, 0, 10);

	teapot.setMaterial(mat);
	teapot.setShadowMode(ShadowMode.CastAndReceive);
	teapot.setLocalScale(10.0f);
	rootNode.attachChild(teapot);

               Vector3f boxMin1 = new Vector3f(-800f, -23f, -150f);
               Vector3f boxMax1 = new Vector3f(800f, 3f, 1250f);
               Box boxMesh1 = new Box(boxMin1, boxMax1);
	Geometry soil = new Geometry("soil", boxMesh1);
	soil.setMaterial(matSoil);
	soil.setShadowMode(ShadowMode.CastAndReceive);
	rootNode.attachChild(soil);

	Material matBox = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
	matBox.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
	matBox.setFloat("AlphaDiscardThreshold", 0.5f);
   
               Vector3f boxMin2 = new Vector3f(-5.5f, 8f, -4f);
               Vector3f boxMax2 = new Vector3f(-1.5f, 12f, 0f);
               Box boxMesh2 = new Box(boxMin2, boxMax2);
	Geometry box = new Geometry("box", boxMesh2);
	box.setMaterial(matBox);
               box.setQueueBucket(RenderQueue.Bucket.Translucent);
	// box.setShadowMode(ShadowMode.CastAndReceive);
	rootNode.attachChild(box);

	DirectionalLight light = new DirectionalLight();
	light.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
	light.setColor(ColorRGBA.White.mult(1.5f));
	rootNode.addLight(light);

	// load sky
	Spatial sky = SkyFactory.createSky(assetManager, 
                       "Textures/Sky/Bright/FullskiesBlueClear03.dds",
                       EnvMapType.CubeMap);
	sky.setCullHint(Spatial.CullHint.Never);
	rootNode.attachChild(sky);

	fpp = new FilterPostProcessor(assetManager);
	int numSamples = getContext().getSettings().getSamples();
	if (numSamples > 0)
	{
		fpp.setNumSamples(numSamples);
	}

	BloomFilter bloom = new BloomFilter(GlowMode.Objects);
	bloom.setDownSamplingFactor(2);
	bloom.setBlurScale(1.37f);
	bloom.setExposurePower(3.30f);
	bloom.setExposureCutOff(0.2f);
	bloom.setBloomIntensity(2.45f);
	BloomUI ui = new BloomUI(inputManager, bloom);

	viewPort.addProcessor(fpp);
	fpp.addFilter(bloom);
	initInputs();

}
 
Example 14
Source File: HelloMaterial.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void simpleInitApp() {

  /** A simple textured cube -- in good MIP map quality. */
  Box boxshape1 = new Box(new Vector3f(-3f,1.1f,0f), 1f,1f,1f);
  Geometry cube = new Geometry("My Textured Box", boxshape1);
  Material mat_stl = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  Texture tex_ml = assetManager.loadTexture("Interface/Logo/Monkey.jpg");
  mat_stl.setTexture("ColorMap", tex_ml);
  cube.setMaterial(mat_stl);
  rootNode.attachChild(cube);

  /** A translucent/transparent texture, similar to a window frame. */
  Box boxshape3 = new Box(new Vector3f(0f,0f,0f), 1f,1f,0.01f);
  Geometry window_frame = new Geometry("window frame", boxshape3);
  Material mat_tt = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  mat_tt.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
  mat_tt.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);  // activate transparency
  window_frame.setQueueBucket(Bucket.Transparent);
  window_frame.setMaterial(mat_tt);
  rootNode.attachChild(window_frame);

  /** A cube with its base color "leaking" through a partially transparent texture */
  Box boxshape4 = new Box(new Vector3f(3f,-1f,0f), 1f,1f,1f);
  Geometry cube_leak = new Geometry("Leak-through color cube", boxshape4);
  Material mat_tl = new Material(assetManager, "Common/MatDefs/Misc/ColoredTextured.j3md");
  mat_tl.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
  mat_tl.setColor("Color", new ColorRGBA(1f,0f,1f, 1f)); // purple
  cube_leak.setMaterial(mat_tl);
  rootNode.attachChild(cube_leak);
  // cube_leak.setMaterial((Material) assetManager.loadAsset( "Materials/LeakThrough.j3m"));

  /** A bumpy rock with a shiny light effect. To make bumpy objects you must create a NormalMap. */
  Sphere rock = new Sphere(32,32, 2f);
  Geometry shiny_rock = new Geometry("Shiny rock", rock);
  rock.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres
  TangentBinormalGenerator.generate(rock);           // for lighting effect
  Material mat_lit = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
  mat_lit.setTexture("DiffuseMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond.jpg"));
  mat_lit.setTexture("NormalMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond_normal.png"));
  mat_lit.setFloat("Shininess", 5f); // [0,128]
  shiny_rock.setMaterial(mat_lit);
  shiny_rock.setLocalTranslation(0,2,-2); // Move it a bit
  shiny_rock.rotate(1.6f, 0, 0);          // Rotate it a bit
  rootNode.attachChild(shiny_rock);
  /** Must add a light to make the lit object visible! */
  DirectionalLight sun = new DirectionalLight();
  sun.setDirection(new Vector3f(1,0,-2).normalizeLocal());
  sun.setColor(ColorRGBA.White);
  rootNode.addLight(sun);

}
 
Example 15
Source File: SkyFactory.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static Spatial createSky(AssetManager assetManager, Texture west, Texture east, Texture north, Texture south, Texture up, Texture down, Vector3f normalScale, int sphereRadius) {
    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));

    Image westImg = west.getImage();
    Image eastImg = east.getImage();
    Image northImg = north.getImage();
    Image southImg = south.getImage();
    Image upImg = up.getImage();
    Image downImg = down.getImage();

    checkImagesForCubeMap(westImg, eastImg, northImg, southImg, upImg, downImg);

    Image cubeImage = new Image(westImg.getFormat(), westImg.getWidth(), westImg.getHeight(), null);

    cubeImage.addData(westImg.getData(0));
    cubeImage.addData(eastImg.getData(0));

    cubeImage.addData(downImg.getData(0));
    cubeImage.addData(upImg.getData(0));

    cubeImage.addData(southImg.getData(0));
    cubeImage.addData(northImg.getData(0));
    
    if (westImg.getEfficentData() != null){
        // also consilidate efficient data
        ArrayList<Object> efficientData = new ArrayList<Object>(6);
        efficientData.add(westImg.getEfficentData());
        efficientData.add(eastImg.getEfficentData());
        efficientData.add(downImg.getEfficentData());
        efficientData.add(upImg.getEfficentData());
        efficientData.add(southImg.getEfficentData());
        efficientData.add(northImg.getEfficentData());
        cubeImage.setEfficentData(efficientData);
    }

    TextureCubeMap cubeMap = new TextureCubeMap(cubeImage);
    cubeMap.setAnisotropicFilter(0);
    cubeMap.setMagFilter(Texture.MagFilter.Bilinear);
    cubeMap.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
    cubeMap.setWrap(Texture.WrapMode.EdgeClamp);

    Material skyMat = new Material(assetManager, "Common/MatDefs/Misc/Sky.j3md");
    skyMat.setTexture("Texture", cubeMap);
    skyMat.setVector3("NormalScale", normalScale);
    sky.setMaterial(skyMat);

    return sky;
}