them bleeding colours

Blitz3D Forums/Blitz3D Programming/them bleeding colours

Abomination(Posted 2004) [#1]
I am trying to do something like "create a grid" by "Matty".
http://www.blitzbasic.com/codearcs/codearcs.php?code=950

(You create a tiled, single surface mesh, using one texture.)

But the colours of the adjacent tiles are bleeding in.
All the tiles should be of one colour, but it looks as if they are outlined.
Is there a way to prevent this?


Gabriel(Posted 2004) [#2]
Kind of. You can load the texture with U and V clamping flags enabled. You can also trying playing with the UV coordinates a little to hide the bleeding. It's somewhat imperfect though. You can't disable the filtering altogether though.


Abomination(Posted 2004) [#3]
hmm... I don't want to use more textures than one...
I don't see how using the clamping flags will help, since all the u-v-coordinates range from 0 to "allmost" 1.
If I would use a texture with a single line of horizontal tiles, I could avoid the vertical bleeding. That would solve half my problem ;)
... tricky... ;(


Gabriel(Posted 2004) [#4]
As I said, it basically comes down to setting the uv coordinates so that you leave a border around each tile on the texture. Yes, that messes up the seamless tiles, but you'll have to account for that when making the texture. It's not perfect, but it's the best we can do without an option to disable texture filtering altogether ( which would be nice. )


Afrohorse(Posted 2004) [#5]
I'm currently doing the same thing, making up a tile based world using one texture page made up of lot's of subtextures.

Firstly the problem is caused by two things - the texture filtering taking into account the surrounding pixels and blends them together and also mip-mapping which, with each mip-map, a filter is appied which also blends together the surrounding pixels.

You can virtually stop the bleeding by adding a 2 pixel border around each sub-texture in the texture page and alter the UV's to fit by bringing them in by two pixels -

UVpinch# = 2.0*(1.0/TexturePageSize#)

The 2 pixel border must be as though the texture is repeated, which can be done in the great Image packer app, using the repeat border type :- http://www.blitzbasic.com/toolbox/toolbox.php?tool=54 (using a little function I did - shameless plug ;) ).

It is also handy for putting together the texture pages in the first place.

So, for example - I use 124x124 source textures for my tile based world. I use image packer to add the 2 pixel borders and build up a 512x512 texture page that contains 16 sub-textures, then use this texture page directly in the game.

You can't stop the bleeding completely because of the mip-maps, but adding a 2 pixel border seems to fix it most of the time. You can always experiment with different border sizes the image packer allows you to do that, see what works for your game...

hope that helps,


Abomination(Posted 2004) [#6]
Great man... Thanks!
For now I use a 1 tile wide texture (32*1028)
Now only the top and bottom line of pixels of a sub-texture can cause trouble, so only the v's have to be adjusted.( by only one pixel, because I am not rotating the view)

But this method limits my amount of tiles, so I wil try your suggestion next.


Zenith(Posted 2004) [#7]
Yeah, I wish there was a way to select the different filtering options, like bilinear, trilinear, animorphic(or whater) or none!


Zenith(Posted 2004) [#8]
[none] specifically ;)