PDA

View Full Version : texture clamping problem



henon
12-21-2002, 08:21 AM
since i got really big textures about 1500x1000
pixels, i divided them up into many 256x256 textures and applied them to as many quads.

because of linear filtering i get the problem, that the seams between the patches are messy/visible. so i clamped the textures, to achieve a better filtering result.

the actual problem is, that my textures are just half as bright in the clamped region as the original texture. this ends up in dark visible seams. what could be the reason for this undesired clamping result?

thanks, Henon

roffe
12-21-2002, 10:30 AM
the actual problem is, that my textures are just half as bright in the clamped region as the original texture. this ends up in dark visible seams. what could be the reason for this undesired clamping result?
[/B]

When tiling textures,like you are trying to do, I learned a technique a while ago the worked very well.
I am assuming that, when you split up your textures, you make two textures facing each other have the same border texels? This is a must since you use linear filtering. In linear filtering the texel in the middle of the texture is the only texel with its original color.
Even this will not give you satisfying results though. The trick is to stretch the border texels half a pixel. This way a border will only have one pixel(two halfs).Here is an excellent explaination of this technique: http://www.fractalscape.org/TextureSeams

henon
12-21-2002, 11:12 AM
hmm, there must be an easier way.

when tiling a large image you get linear filtering artefacts if you use GL_REPEAT wrap function.

my approach is: clamping! should work, because the error is REALLY NOT NOTICABLE.


my problem is, that the border pixels of my textures which were created with clamping are exactly the last row of pixels as it should be but TOO DARK.

Anyone had problems with clamping?

harsman
12-22-2002, 03:37 AM
Sound like your using GL_CLAMP which will make your edge pixels take on the texture border color. The default border color is black which would darken your edge texels. Use CLMAP_TO_EDGE instead and you'll be fine. CLAMP_TO_EDGE is an extension to OpenGL 1.1, but it's standard since 1.2 I think. There are many old threads in theseforums (at least in advanced) about the difference between CLAMP and CLAMP_TO_EDGE so a search would probably turn up lots of info.