Jump to content
  • Advertisement
Sign in to follow this  
Hydrael

Ugly texture seams with mip-mapping

This topic is 4855 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

Hello everyone, I have a problem with mip-mapping combined with a texture tileset. I use a 2048x2048 Texture which contains 16 512x512 tiles. This tileset is used for terrain rendering - meaning: I have 16 different ground types which I assign by changing the TexCoords. That way I'm able to texture a huge heightmap with only one single glBindTexture. Works pretty good at great performance, but I do get some ugly seams which look like this: Screenie 1 At a distance following effect is caused: Screenie 2 I found out, that the problem lies in the mip-map generation. Is there any way to fix that problem? Maybe with custum mip-map levels like in a DDS File. Thanks for any help in advance

Share this post


Link to post
Share on other sites
Advertisement
It is filtering that is causing that problem. The graphics card has no idea what you are tryin to do, so it just filters the entire texture. You are using a float for the texture coords aswell arent you? Floats are never entirely accurate, so that could be part of your trouble aswell. Shame your idea isn't really working, I quite like it. I just do multiple passes in my terrain engine for using different textures.

Share this post


Link to post
Share on other sites
I agree, I reckon it's the filtering. What's happening, is that when your texture is filtered to make the mipmap, pixels at the border of one texture are being filtered with pixels at the border of the other textures.

Have you considered having a border area in each texture that is not used, perhaps repeating the edge pixels?

Share this post


Link to post
Share on other sites
That's what I feared :(
I will try and see, if changing my floats to doubles will do anything, but I doubt it.

@Oxyacetylene:
I don't know if I understand your suggestion right. Do you mean, the tiles should not directly be adjacent to another, but to have a couple of pixels in between, which just repeat the border pixels of the surrounding tiles?

Share this post


Link to post
Share on other sites
Yeah, as long as the border areas are big enough, and aren't being used by any of the textures, I reckon that would have a chance of fixing the problem.

I don't know how well this would work for the smaller mipmap levels.

You might be better off going with your original suggestion, and manually creating the mipmap levels yourself in an art program. Obviously, you'd have to take measures to stop this from happening in the art program as well.

Share this post


Link to post
Share on other sites
Thanks a lot, I guess I will give that a try :D

Regarding the custum mipmaps: Do you, by any chance, know any links to literature about creating custum mipmap levels? I've googled around a bit, but haven't found anything on how to do that.

Share this post


Link to post
Share on other sites
This is why I don't like to use other people's libraries... Sure I reinvent the wheel, but at least I know how to do it. Check out glTexImage2D(), since it's exactly what you're looking for.

Share this post


Link to post
Share on other sites
Yes, I just stumbled upon the second parameter of glTexImage2D() as well ;)
Today or tomorrow I will implement some custom mipmaps and tell how it worked - thanks a lot :D

Share this post


Link to post
Share on other sites
Good luck with your implementation. I know mine's completely broken, although it does produce some cool effects. ;)

Share this post


Link to post
Share on other sites
Ok, I almost got it working now by using custum (but automatic generated) mipmap levels:

Mipmap level 512x512:


Mipmap level 64x64


Mipmap level 4x4 (zoomed in):


Down to this level I believe it should work, because I initially have a 4x4 Tileset and so every tile should have its own pixel. As you can see the two grass tiles have a green pixel for example.
The problem I now have is, that the texture won't appear on the geometry. I figure that's because I'm not going all the way down to 1x1 mipmap level - but if I would, I'd have the same problem again.
Can I somehow tell OpenGL that 4x4 is the lowest mimap level, or use the same texture for the lower levels?

Just in case that also doesn't work, I guess I will have to rearrange my internal way of storing vertices to be able to sort visible triangles by texture, use multitexturing and just batch render the geometry by texture

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!