Advertisement

visible texture borders

Started by July 07, 2001 06:27 PM
4 comments, last by penetrator 23 years, 7 months ago
i subdivided an image of 4096*4096 pixel generated with Bryce in 1024 tga textures, and applied them to my terrain engine. It looks okay, except for some lines you can see between almost every texture border. If i zoom in and out, sometimes these thin lines appear and disappear, but when you fly over the terrain you can see them and they make me so angry. So, i don''t know if it is a Z-buffer problem, or if it is something "normal" (i remember the same artifact on some flight simulators ...) glHorizon_Project

www.web-discovery.net

Perhaps do you need to use this extension?
http://www.ati.com/na/pages/resource_centre/dev_rel/sdk/RadeonSDK/Html/Info/Extensions/EXT_texture_edge_clamp.html
Advertisement
Solved !

I changed:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

to:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );

and now the ugly lines are gone ! GL_NEAREST render the texture sharper than GL_LINEAR (which blur the texture) , but i don''t understand yet why that solved the problem !

anyway i''m happy !

;-)

glHorizon_Project



www.web-discovery.net


happy ... i said it too fast ...
yes , lines are gone, but just because texture are rendered sharper, you can see very clearly the pixels which compose the texture itself.
So: or i get nice blurred texture but gaps over the terrain

or

i get pixelated textures and no nasty gaps

mmmhhh bah !

glHorizon_Project



www.web-discovery.net


Ok heres why you get those nasty borders with linear filtered textures. Nothing to complex, simply that the linear filter interpolates between to texels to make every thing look smooth when texel to pixel isnt one-one, now the problem comes from when it has to intepolate the edge, what value should it use in its calculation if thre isnt a texel in the texture for that picture? I dont know what it does it may use an average of the whole image repeat the edge or something ewse completely. Either way when you have to textures next to each other the edges will be calculated differnetly and hence a visible edge will be seen.
When you turn it to GL_NEAREST, this filtering doesnt happen hance the problem goes away.
One way to get round this would be to put in the border of each texture the corisponding texels from each of its neighbours, a bit of a pain to do but would work. I''m sure there are other ways out the, so look around(sorry I hate it when people post replies saying look around, but well I cant think ofanything else to say and I havent time to look my self).

Well I hope that helps, it may not be techniaccly corect but I hope it gives the meaning of what I Mean its sunday and writing descent scenteces is a skill I''m lacking.
Hi ''penetrator''.

I''ve read somewhere that you have to duplicate bordering pixels. At each of the four texture borders, first and the second pixel rows and columns must have the same colour.

Then you manipulate texture coordinates so that they don’t start at ‘0’ (first pixel) but from the second bordering pixel. And for the other border side, do not use 1.0 but calculate texture coordinate to finish at the second to border pixel.

Pho


This topic is closed to new replies.

Advertisement