Texture repeat for stars texture

I am working on a space strategy game and would like to use apply a star sky texture on a sphere (it would be over a dome in land-based games) that surrounds everything… The problem is that I cannot make the texture repeat itself over the sphere (even using textureSky.setWrap(Texture.WrapMode.Repeat) )and the final result is a stretched texture…



How can I make the texture repeat itself over the sphere instead of being stretched over it?



Also, are there any reccomended wrappers and options for applying texture on planets?

i currently am toying with using a quad which is slightly larger than the camera's frustum values and moving it with respect to any movements the camera makes. i haven't quite finished it yet (still having a few issues in other areas that are a tad bit more important to my build) but when i do i will post the code.



just an idea for you to chew. :wink:

This would repeat the texture 9 times on the x-axis and 5-times on y-axis


textureSky.setScale(new Vector3f(9,5,0));



Hope that helped.



Gettinrim33 said:

i currently am toying with using a quad which is slightly larger than the camera's frustum values and moving it with respect to any movements the camera makes. i haven't quite finished it yet (still having a few issues in other areas that are a tad bit more important to my build) but when i do i will post the code.

just an idea for you to chew. ;)

That's very out-of-the-box-like thinking haha, I'll look forward to it

The setScale method worked fine but I still get the texture a little streched at the top and bottom of the sphere and 2 'dark holes' at the sides... Would mipmapping help me with this?

Hmm,…actually I don't know! How did you load your texture?



If I have to load a texture manually I do it like this:


       Texture tx_water1 = TextureManager.loadTexture(
            Utils.class.getClassLoader().getResource(
                  "test/res/my_water_2.png"),
            Texture.MinificationFilter.Trilinear,
            Texture.MagnificationFilter.Bilinear);

That's the code:


        TextureState tsSky = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
        tsSky.setEnabled(true);
        Texture tsky = TextureManager.loadTexture(
               Rebedelho.class.getClassLoader().getResource(
               "Models/stars.jpg"),
               Texture.MinificationFilter.Trilinear,
               Texture.MagnificationFilter.Bilinear);
        tsky.setWrap(Texture.WrapMode.Repeat);
        tsky.setScale(new Vector3f(9, 5, 0));
        tsSky.setTexture(tsky);
        pri.skyDome(0, "sky", universe, new Vector3f(0,0,0)).setRenderState(tsSky);


Even with the magnification and minification filters I get a result like this one (the 'black hole' is at the z axis):

Can you show a screenshot and your texture?

Here are the screenshot and texture: