Sign in to follow this  

filtering between two textures

This topic is 4691 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it possible to let the 3D card filter between the sides of two textures so that you can't see a joint between two different textures that are tileable to each other? I hate these joints especially between two textures of a skybox.

Share this post


Link to post
Share on other sites
Yes, by using multitexturing and appropriate texture coordinates. Alternatively, by using overlapping geometry and multipass blending. both can be used in eg. terrain rendering for smooth tile texture transitions.

BUT: if you get visible edges on a skybox, then this is a bug in your code. Skybox joints are 100% avoidable without resorting to any kind of blending or multitexture tricks, simply by applying accurate texture coordinates and borders.

Share this post


Link to post
Share on other sites
If your textures are perfectly tilable then I think that you need to set how your card handles the edges of a texture. IIRC for OpenGL this is GL_CLAMP_TO_EDGE.

I'm not 100% sure. It's been a while for me

Share this post


Link to post
Share on other sites
Yeah, as Sander said, I think you will need to make sure your tiling is set to clamp mode. If it is in some kind of "tile" or "wrap" mode, the bilinear filtering will cause the texels at the left edge of the texture to be blended in to the texels at the right edge, as you approach U coordinate 1.0, for instance. At U 1.0, a pixel would be rendered with a 50/50 mix of the left and right edges - if you are using a tile mode. Unless you have made both the left and right edges of your texture tile very well with the second texture, you'll see a seam.

Probably it's better to use a clamp mode. If you get your coordinates lined up perfectly, you should be able to avoid a seam, but I think you will also see extra "redundant area" of a constant color at the edges that may be visually noticeable. For terrain, you might also consider switching to a more flexible system using some kind of alpha blending, so that you don't have to worry about these issues and you don't have to work really hard to make different textures tile against one another. For a skybox, you can probably make it work acceptably with clamp; you could also consider using a cube map, and just selecting a texel based on the direction. If you do that you don't need to worry about generating texture coordinates and you can use any geometry.

Share this post


Link to post
Share on other sites
CLAMP_TO_EDGE is not sufficient to remove all seams. Basically, you need to create a 1 texel border around each side of the skybox, and fill it with the values from the respective opposite connected edge. Then, adjust the texcoords in such a way, that this extra border is just outside of the box geometry edges. Now, bilinear filtering will smoothly interpolate accross edge boundaries, without leaving the slightest seam.

Share this post


Link to post
Share on other sites

This topic is 4691 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this