(Resolved) How to do a 2D sky not infinitely distant? (Alternatively, How to put gui objects behind

I want a starry sky background, but a sky box does not work for what I want for the following reason: my camera is always facing (0,0,-1) and its movements consist only of translations along all other axes (moving up/down/left/right and zooming in/out [which is just moving +z/-z), and I want the background to not be treated as infinitely distant so that it scrolls by similar to the rest of the scene but at a slower rate.

I have a png file I made to test this, and I created a Picture which I applied the png to, set its size to very big (tried a few sizes ranging from 1000 to 10000), and set its distance to z=-900 (it exists along the x,y plane, facing (0,0,1)). The only problem with this is that, since the image is scaled to fit and the pixels in the image are not a 1-to-1 mapping to the pixels on the screen, it looks terrible as you zoom or move around and the white dots disappear or reappear because of the distance.

I tried adding it to the guiNode at the same distance, thinking that I could then have that 1-to-1 mapping of texture pixels to guiNode units (guiNode units being 1 pixel each) and moving it around from there, but it appears that objects in the guiNode are rendered on top of objects in the rootNode regardless of depth; not what I was expecting.

Does anyone know of any ways to accomplish a non-infinitely distant sky in this manner? If there is some way I get get a guiNode element to be rendered behind my scene, that would be good enough and I could get the effect working from there, but I was not able to find a way to do that.

Not that it matters for the context of the problem, but just because the context might seem odd, I’ll note that it’s a space view. The camera looks down on nearby stars and planets which are arranged on the (x,y,0) plane, and the background is the distant stars. The max speed of the camera is light years per second, so I will need the distant sky texture to move too.

You say that when you zoom in or out some stars start disappearing. Did you try enabling mipmapping? If I recall, by default is disabled for Pictures since they are not supposed to be zoomed in and out. Load the stars texture manually and then set it on the Picture via setTexture, this should keep mipmapping enabled on it.

It doesn’t directly solve your asked question… but maybe you can still use a sky box in the sky bucket and just rotate it in the appropriate directions as the player moves around. It would look to be scrolling then.

Thank you for that. I did not realize that there was such a fundamental difference with Picture and that such a difference was my problem, so I’ll just used Quad instead. Every time I want something rectangular and 2D, I think of Picture since I stumbled onto that before I realized jME had a Quad class.



Either way, yes, the mipmapping was the problem. Thank you.