having trouble making my tiles seemless in-game

Started by
9 comments, last by Deyja 17 years, 9 months ago
I've created a seamless isometric tile, ok, just fine in that department. Now, I tried two different methods to make it so I can connect them in-game. 1) I used black, and then a bright pinkish color, and keyed those bg colors out of the image when I D3DXCreateTextureFromFileEx. I tried .bmp, .png, .jpg; these formats simply had speckled backgrounds, but were not completely keyed with the pinkish colors (I figured because the image was not saved truly due to compressing [but the bitmap??]. The black did sort of just fine, but for around the edges of the actual texture pixels, which happened to be grass. 2) I saved the image as a .png with a black, then white, background. Opened up Photoshop and used the magic eraser tool to get rid of the bg color and save as a .png. The same thing happened and their was still bits of background color along the edges of the grass pixels. I'm at a complete loss how to make this tile (or any tiles) seamless. The textures *are* seamless but not "in-game" which is a custom 2d engine (<-most likely the prob). Any help would be greatly appreciated. -stealthgate
Advertisement
Are the tiles scaled in any way when you draw them in-game? I ran into this problem when working on my tile maps. There's a small edge of color around them on certain video cards or when they are scaled in any way other than 100%.

I got this to go away by doing two things.

1) When I create my textures, I load them with no filters (Filter.None) on them. I want pixel-perfection!

2) Before I call my draw code, I use the following settings:
graphics.D3DSprite.Begin(SpriteFlags.None);graphics.D3DDevice.SamplerState[0].MinFilter = TextureFilter.None;graphics.D3DDevice.SamplerState[0].MagFilter = TextureFilter.None;


This seemed to resolve my issues with the problem you're describing. Try it out.
I've come across this problem too! Maxamor is right, it's easy to have your game "scale" your bitmaps without you knowing it. For example, if your using the "Blt" function, and the dimensions in your rect.dest don't match the dimensions in your rect.source, that is one way it can happen. But it might be something much simpler. Your grass tile might LOOK like it's completly bordered by black, but it really isn't. Keep in mind that if the value of the color is off by even 1 then the transparency won't work. In other words the color might LOOK black, but it's really dark dark dark grey. Using PhotoShop I found that it likes to add a certain fuzziness to all edges. So you might want to try going over the edges pixel by pixel and make absolutly sure that all black pixels are really black. Hope this helps.
I'm glad to see this problem isn't one that's few and far between - good thing headaches like this are shared! I found out exactly what was going on. I was rendering the model to an image with anti-aliasing enabled (as available in 3ds max at least), and my map filters were ridiculously high (for me) 2.0! Thanks for the heads-up Maxamor!

I didn't know either than scaling could give some problems...I am NOT going to forget that one - never again do I want to waste time on such a problem that needs an idiot fix!

thanks guys!
Yes, that "fuzziness" is the filtering. It may be set to Filter.Normal or Filter.Linear which all blur it a bit. So if you're trying to get pixel-perfect sprites and tiles turn Filtering off completely like the code in my previous post does.
Hey, by the way, I'm having trouble DRAWING seemless tiles myself. There seems to be plenty of tools out there to seamlessly draw square tiles, but I havn't found anything good to compose seamless diamond (isometric) tiles. Any leads?
Draw a seamless square tile, rotate it 45', and scale it vertically.
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
Quote:Original post by Anonymous PosterThere seems to be plenty of tools out there to seamlessly draw square tiles


There are? I'm gonna go have a look for them now, but before I forget, and in case I can't find any, what kind of tools are we talking about?
Photoshop's pattern maker can automagically create seamless textures/tiles.
Quote:Original post by Deyja
Photoshop's pattern maker can automagically create seamless textures/tiles.


Not sure if I used that or Photoshop's "Tilemaker". Whichever one it was, was rubbish. All it did was blur the edges... Not what I want.

This topic is closed to new replies.

Advertisement