SkyFactory: not displaying skyBox


this is my first post here, so I hope I won’t get roasted. Anyway, I’ve done the tutorials and I am trying to set up my first scene. I am using the skyFactroy to create a sky, however after attaching the sky to the rrot node, nothing happens (I am getting a black screen). I added a directional light and I am not getting any errors (meaning I am actuially finding the texture in the Textures folder). I believe I am missing something obvious.

In the simpleApp init method I am instantiating a world object and then calling the createWorld method.

Below is my code:

  private Game game;
  private Node rNode;

  public World(Game game){ = game;
      rNode = game.getRootNode();

  public void createWorld(int x, int z){
      for(int i=0;i<x;i++)
          for(int j=0;j<z;j++)

  private void initMaterials(){

  private void initLight(){
      DirectionalLight sun = new DirectionalLight();
      sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));

  private void createSky(){
      Texture skyTexture = game.getAssetManager().loadTexture("Textures/sky_1.jpg");
      rNode.attachChild(SkyFactory.createSky(game.getAssetManager(),skyTexture,Vector3f.UNIT_XYZ, SkyFactory.EnvMapType.SphereMap));

  private void createTerrain(int x, int z){

  } </>```

No, but it’s usually a good idea to read the sticky topics on a forum before posting… for example:

As to the rest, you haven’t shown us all of the relevant code.

You should put together a simple single class test case, perhaps based on the basic JME blue cube template but that’s not necessary.

When that works then you will get to start sorting out what’s different about your code. In the 0.001% chance that it doesn’t work then you have something easy to post here in its entirety and folks will more easily spot the step you missed.

I copy / pasted your method for initSky() and initLight() to test it out and I was able to see the sky, so it could be something in your main class that we aren’t seeing.

Depending on where the error lies in your main class, it could maybe work if you instead try to pass your “App” object over to your class like this:

private Game game;
private Node rNode;

private SimpleApplication app;

public World(Game game, SimpleApplication app){ = game; = app;
    rNode = app.getRootNode();

It might not fix the problem, but in cases like this you could pass the “App” over to your class in order to effectively and easily reference things from the main class like the rootNode or assetManager.

Thanks for the feedback. I’ll edit the post above.
I moved all the relevant code to the intiApp method, but nothing changed :frowning:
I am still not getting any errors. I also do not believe I need a light source for the sky, but I’m still putting it just in case.

    public static void main(String[] args) {
        Game app = new Game();
        AppSettings settings = new AppSettings(true);
        settings.setResolution(1920, 1080);

    public void simpleInitApp() {
          DirectionalLight sun = new DirectionalLight();
        sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
        Texture skyTexture = assetManager.loadTexture("Textures/sky_1.jpg");
        rootNode.attachChild(SkyFactory.createSky(assetManager,skyTexture,Vector3f.UNIT_XYZ, SkyFactory.EnvMapType.SphereMap));

    public void simpleUpdate(float tpf) {
        //TODO: add update code

    public void simpleRender(RenderManager rm) {
        //TODO: add render code

yep, you don’t need light to see the sky
there is nothing wrong with you code probably the probleme is with the image.
this one worked for me, can you try it.

1 Like

Interesting. It seems to have worked. I can see the texture now. It is not ideal, as it is inverted and and the entire texture is pinched/wrapped to a single point in the back (I suppose in the direction (0,0,1)). I will try this with a couple of other textures, perhaps will switch to a skybox.