Seams in tile based map

Started by
3 comments, last by CodeZero 15 years, 9 months ago
I'm using Direct3d to render a simple tile map for an Angband/NetHack type game. I'm using 1 large texture that contains every 32 x 32 tile for the game. I have the map chunked up into 16 x 16 blocks, each block having a vertex buffer with a triangle list to render. My problem is there are obvious seams between the tiles. After disabling any filtering for the texture, the seams are fewer and more random, but they are still there. They appear when you move about the map, zoom in, zoom out etc., and not just on 16x16 chunk boundaries. I have a feeling it has to do with the fact that I have to use float texture coordinates on such a large texture. ( 2048 x 2048 by the way ) Is there something I can do to still use the vertex buffer approach? I'm very new to DirectX but I know I can also copy rectangles from one surface to another. Is there an optimized way of doing that too, like with vertex buffers? Thanks
Advertisement
Quote:there are obvious seams between the tiles

Maybe a picture would help. Are the "seams" the clear color or a color from the texture?
Quote:I have to use float texture coordinates

Do you save or load non-floating-point tex coords? All texture coordinates are eventually floating point when they're rendered. Why is this a concern to you?
Quote:each block having a vertex buffer with a triangle list to render

Wow. If you use the same texture for every "chunk," you should consider a single vertex buffer for the entire map.

If you post some code, it would help the diagnosis.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

The common way to get around this is to put a texel-sized buffer around your tiles. Otherwise you'll always have problems with filtering and mipmaps, or even without filtering if you don't take special care to ensure your texture address doesn't cross a seam.
Problem solved - the seams were not the clear color but the color of the neighboring tile on the texture. I basically did what MJP and adjusted the texture coordinates by half a texel around the tile.

Thanks for the help guys.
Quote:Wow. If you use the same texture for every "chunk," you should consider a single vertex buffer for the entire map.


The reason for the chunks is so I can use frustum culling to only draw the chunks visible on screen.

This topic is closed to new replies.

Advertisement