hide cube edges

I don’t want the edges of my cubes to appear as those horrible white lines separating them .

http://img689.imageshack.us/img689/4803/damncube.png

It’s probably some opengl option that I should enable/disable, but I failed to find anything in google .
It may also have something to do with overlapping edges (since the edges are not shared between cube faces) .
Anbody has some clues ?

Try with different texture wrapping.

How do your images look like before you read them?

You could also have z-fighting issues due to inappropriate far- and near-plane values

Ensure that the vertex coordinates are exactly equal. If you calculate the vertices for every quad, there is a good chance that slightly different coordinates (like a millionth off) are sent to the GPU, resulting in these visible seams.

bingo . (well, almost.)

I am using a texture Atlas, and the textures which are on the corner of my image (i.e. the position 0,0 on my PNG) are getting this whitey thing near two of the edges (the edges which are mapped to corner of the image) .

http://img97.imageshack.us/img97/480/bricks1.png

I don’t know if this expected, my texture mapping has no floating pointing rounding issues . I have a 256x256 image with 64x64 subtextures , so the texture coordinates are like (0,0) (0.25 , 0.25) .
This is the texture :

http://img213.imageshack.us/img213/6313/atlas1.png

I have solved it with a workaround, but I still can’t see why I should get this whitey thing when mapping near the border of my image .

it seems that the texture mapping is extrapolating a bit of what I have limited .

It does_not look good on the right/bottom, you see the brown of the adjacent sprites there.

You have to keep in mind that texcoord (0,0) will also result in texels from around (0,0), not starting with (0,0), so as you are wrapping your texture, you get white texels from the other side of the texture.

So you have to do some calculations:
for the left side of the first sprite: 00.25+(0.5/texture.w)
for the right side of the first sprite: 1
0.25-(0.5/texture.w)

hmmm thanks for the explanation . I didn’t even notice the right/bottom brown texture .
That’s exactly the workaround I was making, just that I was doing by intuition (and not exactly this value).

Appreciation ++;

I have not tried this myself but … perhaps you can create a 3D texture instead and stack your tile-like images in there. Then the wrapping should be OK and you can still use a single texture object.

On medium to low cards, 3D textures are a lot slower for access. Also, you still only have bilinear or nearest-neighbor filtering across the entire 3D texture, I’m pretty sure you can’t have bilinear filtering on each 2D slice and do nearest neighbor filtering to get discrete slices. The 3rd texture coordinate still has to be between 0 and 1, so you’d run into floating point errors.

There’s a new texture target called texture arrays that are meant to address these issues and act as atlases, but they are only in newer OpenGL versions.

Can I kindly ask what you’re developing there? ::slight_smile:

The most common solution (I think???) for using an atlas together with tiles is to add borders around the different tiles that are correctly wrapped. You just set the texture coordinates within the borders and the interpolation and wrapping should be fine.

I have no idea of how large the border should be but I guess that it depends on the texture sampler and mip-map settings.