Sky size

Ok, so I have created my first sky (after following the JME tutorial). What I don’t quite understand is how the sky dome’s size is determined. After all, increasing / decreasing the sphere’s radius doesn’t seem to affect my “world” or “sky” size. Any thoughts?



Sphere skyMesh = new Sphere(10, 10, 1000, false, true);

skySphere = new Geometry(“Sky”, skyMesh);

skySphere.updateModelBound();

skySphere.setQueueBucket(Bucket.Sky);



Material skyMaterial = new Material(assetManager, “Common/MatDefs/Misc/Sky.j3md”);

TextureKey key = new TextureKey(“assets/Textures/Sky/sunset.jpg”, true);

key.setGenerateMips(true);

Texture tex = assetManager.loadTexture(key);

skyMaterial.setTexture(“m_Texture”, tex);

skyMaterial.setVector3(“m_NormalScale”, Vector3f.UNIT_XYZ);

skyMaterial.setBoolean(“m_SphereMap”, true);

skySphere.setMaterial(skyMaterial);

The size does not matters!!! for skybox anyway :stuck_out_tongue:



Objects in the sky bucket are render with a depth buffer forced to 1.0. So it will always be rendered in the far no matter the size of the sky box.



But, be careful, the skySphere spacial in the scene graph DOES have this size. so if you move out of the sphere and that it append to not be in the view frustum anymore, the scene graph will cull it, and your sky will disappear.

A good way to prevent this behavior is to set the skySphere to never be culled.



skySphere.setCullHint(Spatial.CullHint.Never);

1 Like

Ok, I see. Out of curiosity: why is the depth buffer forced to 1? The problem that I’m having is that the sky eventually comes “too close” (i.e. the texture is just blown up as a zoom in too close. Is there any way to prevent this? Or will I just have to limit my zoom?

javatar said:
Ok, I see. Out of curiosity: why is the depth buffer forced to 1?

To always be in the farthest plane

your zoom problem is strange...try to remove this line key.setGenerateMips(true);

I had already tried that. To no avail. Once I zoom in too close, the world (water + sky) simply invert…

???

could you post a screenshot please?

Sure thing.



Offset:



Zoom 1:

Zoom 2:

Too far:



Thanks!

wow!!!

you broke the forum layout :stuck_out_tongue:



How do you do your zooming?

Uuups, should have cropped the first two.



I just use the flyCam:



flyCam.setMoveSpeed(10);

flyCam.setDragToRotate(true);

Ok i think i know what’s going on

you are zooming with the mouse wheel.

With the flyByCamera, the mouse wheel increase or decrease the FOV angle.

When it reaches 0, the view flip.



You should move the camera position to zoom, and always keep the default FOV.

1 Like

That makes sense :slight_smile: Cheers.