Jump to content
  • Advertisement
Sign in to follow this  
CodeZero

Seams in tile based map

This topic is 3634 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!