View Full Version : Bad transparency or something

26-07-2005, 10:48 PM
Hey to all you out there. I've just started working on a 2d platform game, and to help me with that, I've decided to use GLXtreem. I've made some gfx and a mapmaker and have created a testmap I want to display with GLXtreem. I load all my gfx from a res-file created using the small program you get with GLX and displa it on the screen.

It all looks fine untill you look at some of the tiles wich uses transparency. Well I guess it's because the tiles uses transparency. dunno. But the tiles don't fit nicely with the other tiles. I've scaled all my tiles by 2, and it's not an option not to do that. Can anyone tell me what the problem is, and most importantly how to solve it.

I've uploaded a screenshot so that you can see what I mean.

http://img108.imageshack.us/img108/3935/badtrans1zl.th.png (http://img108.imageshack.us/my.php?image=badtrans1zl.png)

Sorry for some of my poor english.

27-07-2005, 12:00 AM
Looks like filtering artifacts to me. When bilinear filtering is used four neighboring texels are sampled to determine fragment color, in a case you?_Tre textures one dimension is say 64 pixels and it is scaled so texture coordinate at screen pixel is say 64.5 then texels from both sides of the texture will be sampled and if one has alpha 1 the other 0 then the pixel you might expect to be transparent might turn out to have alpha of 0.5
To combat this use larger texture with additional free space between borders,
or keep pixels on screen proportional to texels, meaning exactly same size or n * original size, so no inbetween values get generated,
or try using clamping texture coordinates:
this has to be done for every texture.
From the looks of it you use a lot of small textures, for better performance you should asemble smaller tiles into larger textures.

27-07-2005, 09:17 AM
That sounds about right. The filtering is sampling the texels from the other side of the texture due to wrapping. Clamp the texture and the artifacts should go away, or at least be minimized.

But then, if you are doing a retro game, you should probably turn filtering off completely. That would give you the pixellated retro look.