Jump to content
  • Advertisement
Sign in to follow this  
Terin

OpenGL How to prevent showing a grid?

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

I have an issue at the moment with my OpenGL engine. For whatever reason, I'm getting a thin black line in between tiles (the tiles are drawn down flat with no "Y" value. The tiles are being drawn in such a way that they should actually overlap a little (X and Z coordinates [Y is my Up/Down coordinate) all are plotted as whole numbers, so when I draw the tile at 0, 0, the Vertex's are from (0, 0) to (1, 1). http://kaiser-engine.com/wp-content/uploads/2010/02/Auto-Tiling.png Is there some kind of filter I should be applying? Or is there a way to remove this? At that zoom-level, things look OK -- not perfect, but the lines shouldn't be showing up period. It's not an issue with the tile's graphic. When I zoom in significantly, the lines become more pronounced and obvious. Any thoughts? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Thank you both very much.

That helped the problem a bit -- when it's not zoomed in too much, it looks alright. But when I'm zoomed in to about 160.0f, it still produces a hairline-edge. Is there anything else I could do?

Thanks!

Share this post


Link to post
Share on other sites
Do you have your textures all in separate files or are you reading them from a sheet? If the latter could be floating point errors when generating uv coords.

-me

Share this post


Link to post
Share on other sites
I'm building them into a sheet with SDL and then drawing, as to prevent issues with switching texture contexts half a bajillion times. When clamp to edge is used, does it clamp to the edge of the graphic sheet, or to the edge of whatever it's being drawn to? Is there any way to set a filter after that would blend two tile-edges together in the world space, rather than the texture?

Share this post


Link to post
Share on other sites
It clamps to the edge of the graphic sheet, so clamping won't help for tiles not located at the edge of the whole texture. Also, to get rid of that thin edge when you zoom in, you need wrapping, not clamping. The solution is to surround each tile in the sheet with a border, that has the color it's supposed to wrap towards. For example, if the right edge of the tile is red, and the left edge is yellow, and they're supposed to smoothly wrap, you need to add a yellow border on the right side, and a red border on the left side.

However, this still won't help if you want to blend smoothly to tiles with different colored edges. To do the world-space blend you're talking about, try drawing your scene without zoom first (1:1 pixel ratio), in which case the wrapping mode doesn't matter, and only then as a final step zoom the complete output image. So you render the world to a texture, then render that texture zoomed. It's usually the easiest solution if all tiles are drawn with the same scale.

Share this post


Link to post
Share on other sites
Quote:
The tiles are being drawn in such a way that they should actually overlap a little
If the tiles are overlapping, then you will get a hairline edge due to z-fighting. They should line up exactly.

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!