Possible issue with Skybox

Hello Monkeys,

I was messing around with a custom skybox ( just custom images I had rendered out, and using the jME SkyFactory ) I had made a bit earlier today, and noticed from what I thought of as a bit of strange behavior. What was happening is this ( i’ll try to describe best i can in words ) if the fly cam was near a mesh object then a pan of 360 deg of the entire skybox rendered as intended, but if I backed the cam away from the mesh object and then tried to pan around the scene using fly cam, when looking away from the mesh object the skybox would disappear. This scene is not using any mesh objects besides a j3o structure, and has no terrain currently in the scene. Just an observation.

Could you try skyBox.setCullHint(Spatial.CullHint.Never);

this is already called in the skyFactory, but, i already noticed some strange behavior.

nehon said:
Could you try skyBox.setCullHint(Spatial.CullHint.Never);

this is already called in the skyFactory, but, i already noticed some strange behavior.

i did it, same thing.. its since the cullhint commit on render manager.


i’m gonna look into it

An update: when I ran the same scene a few minutes ago on my net book I did not have the same issue. Skbox seemed to render fine from quite a bit further distance also while panning around.

Netbook = windows 7 / nvidia ion.

Home PC = windows XP / nvidia n220.

No there is definitely an issue.

Do you attach the sky to a node before attaching it to the root node?

No, i was just using the sample code from the wiki:



assetManager, “Textures/Sky_1.dds”, false));[/java]


I was gonna say if you attach it to a node set the cullHint of the node to never…

but don’t do that on the root node.

Is there only the skybox in your scene?

or was there when you noticed the issue?

I have 2 other objects in the scene. This is what the scene looks like so far. I’m new so the code probably doesn’t look to neat :slight_smile:


public void simpleInitApp() {



Spatial GothicCottage = assetManager.loadModel(“Models/GothicCottage_1.mesh.j3o”);

GothicCottage.setMaterial((Material) assetManager.loadAsset(“Materials/gothicCottage_1.j3m”));

Spatial GothicCottageRoof = assetManager.loadModel(“Models/GothicCottageRoof.mesh.j3o”);

GothicCottageRoof.setLocalTranslation( new Vector3f( 3.3f, 7.1f, -3.7f ) );

GothicCottageRoof.setMaterial((Material) assetManager.loadAsset(“Materials/gothicCottage_1.j3m”));




Node N_gothicCottage = new Node(“gothicCottage”);




//Add Sun Light

DirectionalLight sun = new DirectionalLight();

// default (3.0f, -0.7f, 0.0f))

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




assetManager, “Textures/Sky_1.dds”, false));


The only way it can cull…is if you go away from the boundings of the scene and look at the sky

try that sky.setLocalScale(100);

Ok, I won’t be able to try on the other pc until later tonight. The issue doesn’t seem to be happening on the net book though. and on the home pc it would happen seemingly a short distance away from the model while facing away from the model, if I would pan back towards the model everything would render again. Im not at home now, so it’ll be awhile before I can try this, both machines are using the same jME project settings.

This seemed to fix the issue:


Spatial sky = (SkyFactory.createSky(

assetManager, “Textures/Sky_1.dds”, false));



Thanks nehon!

If any of the objects under the rootNode are not visible (like the house, etc), then when the objects are not visible the sky will disappear as well.

It is a known “issue”, the best way to handle it is to make sure you’re attaching the sky as close to the root as possible, and set all nodes from the sky to the root with cullhint.never.

Hi guys,

I’m having this trouble as well, while the setScale(100) solution works, I think that’s because as we increase the size of the sky (which is a large sphere or cube), it remains inside the camera’s visible area and therefore will not be culled.

I found that an alternative solution would be to move the sky also with the camera, something like:




Is this an acceptable solution? What about creating an alternative “root” node with just the sky in it?

yeah but it can be troublesome if for example you want to pick objects on the screen by casting rays.

You’ll always pick your sky.

Best way is to make sure the sky is never culled by setting cull hint on all nodes from the sky to root to CullHint.Never, another option is to attach the sky separately from the root node to the viewport using ViewPort.attachScene (sky still has cullhint.never set)