Problem with sky

I wanted to create a sky in the background of my scene, therefore I used the following code:

[java]rootNode.attachChild(SkyFactory.createSky(

assetManager, "Textures/skybox.jpg", false));[/java]



The problem is that I can´t see the sky, this is the way mentioned in the sky advanced tutorial on this page, do I have to do something else in addition to the code above?



Thanks in advance

Hi!! maybe you forgot to turn on the lights.

Here is an Example



[java]

package jme3test.helloworld;



import com.jme3.app.SimpleApplication;

import com.jme3.math.Vector3f;

import com.jme3.light.DirectionalLight;

import com.jme3.util.SkyFactory;





public class HelloSkyTest extends SimpleApplication {



public static void main(String[] args) {

HelloSkyTest app = new HelloSkyTest();

app.start();

}





@Override

public void simpleInitApp() {

//a ver el cielo

rootNode.attachChild(SkyFactory.createSky(

assetManager, "Textures/Sky/Bright/BrightSky.dds", false));





// You must add a light to make the model visible

DirectionalLight sun = new DirectionalLight();

sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));

rootNode.addLight(sun);

}



}

[/java]

uh no the sky material does not need light.

I think the problem is more in your texture. SkyBox works with a cube map, i doubt your jpg file is a cube map.

You can try to map it as a sphere (pass true instead on false in the createSky method) but the result might not be what you want.

You can use the sky available in the text data of JME.

Or you can create your own cube map following this tutorial :

http://www.cgtextures.com/content.php?action=tutorial&name=cubemaps

I downloaded the picture from the skytutorialsite shouldn´t this work?

I was doing a little research after trying to load the texture you said.

And got a warning : Cubemap textures must contain 6 data units



searching the forums i found this:



http://hub.jmonkeyengine.org/groups/general-2/forum/topic/skyfactory-cubemap-texture-must-contain-6-data-units/

http://hub.jmonkeyengine.org/groups/graphics/forum/topic/skyfail/


  • i’m tried with another image and it didn’t work…


  • i searched for an image to use and tested it:

    [java]rootNode.attachChild(SkyFactory.createSky(

    assetManager, "Textures/3188.jpg", true));[/java]



    worked fine.



    After that i tried to do my own cube map and did it by using the tools mentioned in the previous links.



    Hope you find this usefull.

You can also use 6 separate skybox textures to create a sky, see the TestSkyLoading class.

1 Like