Countering linear filtering errors..

Started by
8 comments, last by LeGreg 18 years, 3 months ago
Evening all, Am hoping someone from this part of forum-land can give me some ideas on getting rid of these sorts of errors: It's a simple grid of quads with part of a texture applied. Seems that the texture addressing for the filtering is causing them to stop tiling seamlessly. It works fine with regular point filtering: So I'm pretty sure it's a case of bilinear filtering addressing texels that cause it to go screwy. I've tried the usual things with offsetting the texture coordinates so that it's not addressing pixels outside of the tile (or wrapping around), but in this instance it hasn't made any difference [sad] The only thing I've got left to try is modifying the artwork to have a gutter/repeated border so that it addresses the correct pixel. That's a tiny bit annoying as it makes creating the art a whole lot more tedious/difficult. Anyone got any other ideas? Cheers, Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Advertisement
Right, well to answer my own question - the gutter method works... but it means that I have to correct a programming problem in the data, which will do for now but I don't like it.

Anyone got anything to add? [smile]

Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

I'm pretty sure you can use texture borders to solve that. I've not done it before though, so don't quote me on it.
If at first you don't succeed, redefine success.
Quote:Original post by python_regious
I'm pretty sure you can use texture borders to solve that. I've not done it before though, so don't quote me on it.

Too bad, I just quoted you [lol]

Anyway, by texture borders do you mean a D3D/OpenGL feature or some more general algorithm?

I double checked, but from what I can find there isn't any way of setting the border to anything other than a constant colour.

Cheers,
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Have you tried using centroid sampling to fix your problem?
Texture borders won't help (as we said there are constant). There's a new concept of texture border coming up but that isn't close to what you need.

I try to address a similar problem in my voxel terrain tutorial : how to make
tile things that don't tile. Of course your problem is different in nature but you could think of a similar solution.



Here's what this look like, the problem is on the borders of the individual quads, color on one side doesn't match color on the other one.
Not much you can do with that geometry unless you want to pay a huge amount of processing in the pixel shader to try to make it look right (and centroid has nothing to do with it since it's only for the multisampling case that we haven't hit yet).

Here's a proposition :



You add additional quads on the border between two quads with a different textures that don't match. The additional quad has two textures setup to it, but the blending factor is linearly interpolated between borders so that the stitching look almost invisible.

Hope that helps.

LeGreg
Thanks for the replies [smile]

LeGreg - that's an interesting idea, but I don't think it'll achieve what I'm after. I basically need some form of "wrap around" addressing. The problem occurs when you have two identical tiles next to each other - on the border they should (effectively) sample each other, but they don't.

I think, for now, I'll stick with my 'gutter' solution - it works fine, just strikes me as more of a hack than a correct solution.

Cheers,
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Check out the Atlas Comparison Viewer on nVidia's website here. That sounds a lot like what you're trying to do - at least it will suffer similar edge problems. For my money though, their demo doesn't quite get rid of all the edge glitches (the edge pixels of quads are often totally wrong).
Quote:Original post by ZQJ
Check out the Atlas Comparison Viewer on nVidia's website here. That sounds a lot like what you're trying to do - at least it will suffer similar edge problems. For my money though, their demo doesn't quite get rid of all the edge glitches (the edge pixels of quads are often totally wrong).

That's a fairly interesting white paper - only had a quick scan read of it, but it could well be useful. Thanks!

Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Quote:Original post by jollyjeffers
LeGreg - that's an interesting idea, but I don't think it'll achieve what I'm after. I basically need some form of "wrap around" addressing.


That's basically what it does. You just have to replace "N textures" with "individual texture" in the description above. Left border overlaps right borders for a few texels and is linearly blended between the two so that the stitching is invisible.

LeGreg

This topic is closed to new replies.

Advertisement