Having experimented a bit with the texture seams, I think this is the
reason for it:

Once upon a time, artists created the texture pages for Warzone 2100.
The tiles were fine and tiled perfectly (well, almost). Then the
developers turned on linear filtering, and noticed that there were
suddenly nasty seams between the tiles. They figured that this was
caused by linear interpolation not working at the texture sides,
either because there were no more pixels to compare with, or because
the next pixels belonged to other tiles and gave the wrong values. So
they decided to only use pixels 1...63 instead of 0...64, which left a
one pixel border around the tile which could be used for linear
interpolation.

Then the source was released, and we decided to increase the allowed
zoom level. Now suddenly we notice that the tiles do not quite match
when zoomed very closely. This is because when the original developers
created the one pixel border, the new, slightly smaller tiles no
longer tiled perfectly. However, as long as you did not zoom all the
way in, this was hardly noticable. Making things even more difficult
was the addition of anisotropic filtering, which means that you take
into account more pixels to mak linear filtering generate better
results when rotating the tile at odd angles to the viewer. This means
a one pixel border may not be sufficient after all.

Apparently the "correct" solution to this problem involves using the
OpenGL texture border feature, which I can find almost no
documentation of, and which apparently causes some graphics cards to
drop to software mode (like my Intel X3000). Not using texture pages
(atlases) helps, since you won't be reading pixels from other tiles,
but it is from what I can tell, not enough. Once you turn on linear
filtering, edges appear no matter what, perhaps because the filter
does not know that we try to keep pixels on the edge matching pixels
on the edge of the other tile.

I have currently set linear filtering to off and removed the 1...63
texture coordinate hack, so that you can see what I found as the best
tiling solution. However, the lack of linear interpolation really
shows in the much worse interpolation (more pixelated textures).

There are some solutions I can see:
 * We scale all tiles down to N-2 dimension (ie 126x126, 62x62, etc.)
and add a nicely calculated border around the tiles that is used for
interpolation only. Then we readd the 1..63 hack, and explicitly turn
off anisotropic filtering for terrain tiles. By scaling down, we
ensure that the tiles remain tile-able.
 * We do as above, but either stop using texture pages, or find
another way to keep anisotropic filtering from messing with
neighbouring tiles. I do not know what clamp modes it respects.
 * We change the way tiles are drawn, by overlapping the edges and use
blending technique (such as splatting) to create transitions.
Depending on the technique, it may require map changes, a very
unfortunate requirement.
 * We write a custom GLSL shader to blend tiles. This would require
support for at least OpenGL 1.5. It can be optional, but the result
for people without it would be bad if they can't have linear filtering
on.

Thoughts?

  - Per

_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to