Sky like rendering for quads

I have a hard time figuring something rather simple out, I want to render a sun/moon on a sky sphere. The sun/moon is basically just a textured quad. Now billboarding it is rather easy, but what I can’t figure out is how to get it to render behind everything and always keep it at the same distance as the player. Basically it should behave the same as the Sky, being small and being rendered behind every other “object”.

I tried understanding and using the code from the JME Sky but soon hit my limits when it comes to understanding the rendering pipeline and shader code. My current state is that I have a quad which I place far away and move it with the player. I tried “applying” the shader of the sky to it, but that did nothing (as in it is not being rendered, because I don’t understand what exactly happens in the shader).

Can somebody point me in the right direction on how to achieve that? Did I even manage to express my question correctly?

Try setting


on your Material.

Did you put your sun/moon in the sky rendering bucket?
Spatial.setQueueBucket(Bucket.Sky) or something.

The more I think about it, the hard it becomes to explain.

I have the following setup:

public class CelestialObjectSpatial extends AbstractSkySpatial {
    public CelestialObjectSpatial(...) {
        Texture2D texture = new Texture2D();
        // Texture setup here.
        Material material = new Material(assetManager, "someShaderLikeUnshaded.j3md");
        // Material setup here.
        quad = new Quad(5, 5);
        Geometry geometry = new Geometry();
        geometry.setModelBound(new BoundingSphere(Float.POSITIVE_INFINITY, Vector3f.ZERO));
                -(quad.getWidth() / 2),
                -(quad.getHeight() / 2));
        geometry.lookAt(new Vector3f(
                -(quad.getWidth() / 2),
                -(quad.getHeight() / 2)),
        // The control makes sure that this moves with the camera.
        addControl(new CameraAttachingControl());

Now this works, for the most part, but the object itself feels and looks close, for example when the camera is turned. It does not “feel” like it is an object far away. What I’d like is, I guess, that it behaves like it is far away on the horizon, like it is a texture painted on a far away sphere, like the Sky.

Mh, did make it any clearer?

So did you solve the “render behind everything else” issue?
Is this still a technical question or is it now about aesthetics?
A screenshot could say more than a thousand words. :slight_smile: