Seamless skybox texture

Started by ilich, December 12, 2014, 01:15:43 PM

Previous topic - Next topic

ilich

Hello!
I develop a panoramas engine based on JPCT. Adding textures for skybox (one texture per side), I get a black seams on skybox planes joins. Is there any way to make skybox seamless?
Thanks


EgonOlsen

That's caused by flaws in the subpixel accuracy of the gpu combined with rounding errors when creating the sky box. I've never seen it being so obvious though. Which size have you used for the sky box? A quick hack would be to not clear the frame buffer but only the zbuffer at each frame. That doesn't really fix it of course, but it might become less obvious. I'll look into the issue in more detail later.

ilich

Skybox size is 1024. But it doesn't matter - problem ocured both for 256 skybox as 65536 skybox. All textures are 256x256.
I have tried your workaround like this

        @Override
        public void onDrawFrame(GL10 gl) {
...
            //fb.clear(Color.WHITE);
            fb.clearZBufferOnly();
...
}

but it takes no effect.

EgonOlsen

If your framebuffer's color was white before, then this can't be the issue. Because your lines are obviously not white. Can you upload your textures in native resolution somewhere? Maybe it's an issue with them.   

EgonOlsen

#4
Looking at the right side of your screen shot, it actually looks like as if parts from the opposite side of the texture are bleeding in. This can happen only if clamping has been disabled on the textures. By default, the SkyBox class enables it. Are you disabling it afterwards or are you replacing the textures?

ilich

I have enabled bleeding and GOT SOME MAGIC - joins goes seamless. Looks like problem solved. Thanks a lot!

ilich

Egon, could you tell me for stronger understanding what bleeding realy do?

EgonOlsen

You mean clamping? It limits the actual texture coordinates to a [0..1] interval. The sky boy uses texture coordinates between [0..1] but the bilinear filtering usually makes the coordinates go slightly below 0 and above 1 (the mentioned "bleeding"). When clamping is disabled (which is default), these coordinates will wrap to the other side of the texture. With clamping enabled, they will be clamped at 0 and 1.
The SkyBox class actually enables clamping for the textures that the sky box uses, but if one changes them afterwards, it can't do it for those textures.

ilich