Skybox questions

How large should my skybox be?



I am having trouble with the skybox in that, if I make it too small I can see it intersecting with the ground and such it gives horrible effects as hills emerge from behind it. However I made it larger and it started having some weird effects, like parts being black etc…



Should I just scale down everything else inside the skybox?



If the skybox can only be a certain scale cos of something inside jME i'll just scale down all the other objects.



Is there performance issues having a large skybox?



I would like to have a nice effect with the skybox stretching to the horizon, so that some far away things are visible, obviously I know that having these things rendered will have an effect on performance but i'm just wondering about the skybox. Or is it negligible?



I want to use custom images for my skybox. What resolution do they need to be?



At the moment I am using the skybox that is used in many jME examples (ie the one used in flagrush) but I want to change it and I don't know what resolution to make the images, I don't want to spend ages making a seamless skydome image that is the wrong size

You could, if this feature was available in jME, to make the skydome render last with z-test with z=1, then it will always appear behind everything. This is the ideal method to do it, since it reduces overdraw and doesn't have any of the artifacts you mentioned, this is the method used in jME3.

Since this is not supported in jME1/2, you're forced to work around it. One possible way is to render the skydome first and no z-test. It should work, use a ZBufferState and disable it (setEnabled(false)).

As momoko_fan said, the skybox needs to be rendered with a special zbufferstate, the jME Skybox already has such a ZBufferstate set.

It should not matter what size your skybox is.



If your skybox is intersecting your ground, something seems wrong with your set up.



Also your Skybox needs to always move with the camera.


Ahh ok I see, I'll check the code for the sky box.



However I have another question, I want to create a cloud box/dome that rotates. Basically I want a box or dome rendered with clouds and clear (opaque) sky patches that will show the sky box behind it. Should I try to do this with a second skybox within the first? or does anyone know of a better way to do it?

Also here is my zbufferstate that is created in initGame;


      scene = new Node("Scene graph node");
      /** Create a ZBuffer to display pixels closest to the camera above farther ones.  */
       ZBufferState buf = display.getRenderer().createZBufferState();
       buf.setEnabled(true);
       buf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);
       scene.setRenderState(buf);



and here is my skybox code;

   private void buildSkyBox() {
      
        skybox = new Skybox("skybox", 400, 400, 400);

        Texture north = TextureManager.loadTexture(
            TestSkybox.class.getClassLoader().getResource(
            "jmetest/data/texture/north.jpg"),
            Texture.MinificationFilter.BilinearNearestMipMap,
            Texture.MagnificationFilter.Bilinear);
        Texture south = TextureManager.loadTexture(
            TestSkybox.class.getClassLoader().getResource(
            "jmetest/data/texture/south.jpg"),
            Texture.MinificationFilter.BilinearNearestMipMap,
            Texture.MagnificationFilter.Bilinear);
        Texture east = TextureManager.loadTexture(
            TestSkybox.class.getClassLoader().getResource(
            "jmetest/data/texture/east.jpg"),
            Texture.MinificationFilter.BilinearNearestMipMap,
            Texture.MagnificationFilter.Bilinear);
        Texture west = TextureManager.loadTexture(
            TestSkybox.class.getClassLoader().getResource(
            "jmetest/data/texture/west.jpg"),
            Texture.MinificationFilter.BilinearNearestMipMap,
            Texture.MagnificationFilter.Bilinear);
        Texture up = TextureManager.loadTexture(
            TestSkybox.class.getClassLoader().getResource(
            "jmetest/data/texture/top.jpg"),
            Texture.MinificationFilter.BilinearNearestMipMap,
            Texture.MagnificationFilter.Bilinear);
        Texture down = TextureManager.loadTexture(
            TestSkybox.class.getClassLoader().getResource(
            "jmetest/data/texture/bottom.jpg"),
            Texture.MinificationFilter.BilinearNearestMipMap,
            Texture.MagnificationFilter.Bilinear);

        skybox.setTexture(Skybox.Face.North, north);
        skybox.setTexture(Skybox.Face.West, west);
        skybox.setTexture(Skybox.Face.South, south);
        skybox.setTexture(Skybox.Face.East, east);
        skybox.setTexture(Skybox.Face.Up, up);
        skybox.setTexture(Skybox.Face.Down, down);
        skybox.preloadTextures();
        scene.attachChild(skybox);
   }



What might I have done wrong to get it intersecting with the ground?

I tried using;

       buf.setEnabled(false);



but then all I see is the skybox?!  :(

are you missing a rootNode.updateRenderState() after you finished initializing your scene?


The skybox must be rendered first… Try skybox.setRenderQueueMode(Renderer.QUEUE_SKIP)

Core-Dump said:

are you missing a rootNode.updateRenderState() after you finished initializing your scene?


No that was further down in the init code I just didn't paste it here  :(

Momoko_Fan said:

The skybox must be rendered first.. Try skybox.setRenderQueueMode(Renderer.QUEUE_SKIP)


That solved it!  XD Woohoo! Well to be honest I didn't use your code, I just cut and pasted it in the front and this solved it so I didn't bother to implement your code.

Quick question though, should it be obvious that it needs to be rendered first? Because if it is then I'm missing it. If it isn't so obvious then fair enough, I haven't dissected the SkyBox code, so I'll accept it as one of those things.  :lol:

Thanks

It can also be a missing

rootNode.setRenderQueueMode(Renderer.QUEUE_OPAQUE);





It's one of those fun little quirks with jME :wink: