GL_CLAMP_TO_EDGE problem

Started by
15 comments, last by krez 14 years, 11 months ago
try using GL_NEAREST, whilst it will look blocky (+ post a screenshot)
Advertisement
GL_NEAREST solves the problem, but it looks really ugly with grass... And the problem is solved because GL_NEAREST doesn't sample pixels at all, so it doesn't matter to him if you set GL_WRAP, GL_CLAMP, GL_CLAMP_TO_EDGE...
Quote:Original post by Brother Bob
Quote:Original post by Sik_the_hedgehog
Quote:Original post by CTPAX
I guess nobody here can answer me this...

I would, but my reply would be on an outdated method which probably has a better alternative already. The problem you have is that the last texel in one texture doesn't get filtered with the first texel of the next texture - so the former gets extended and then the latter appears sudden of all, without any blending at all.

I wonder if that helps at all.

That is my guess as well. For the two tiles next to each other to blend seamlessly, the filtering in the borders needs access to the texels from the neighboring tiles to blend with. Can be solved by replicating the tile data from adjacent tiles into other tiles. For example, if a tile is 32x32 texels, make it 34x34, where the outer border corresponds to the texel values of the neighboring tiles. Texture coordinates can then select the center 32x32 tile, while keeping filtering proper in the border case.

That would work if it is guaranteed that the surrounding tiles have always the same exact textures. I don't think it's his case though (remember he said he'd expand on it to generate larger meshes).

Quote:Original post by CTPAX
Thanks for the reply, guys, but it didn't help.. It's updated method of course, if you have a better way, please help me... GL_CLAMP_TO_EDGe is version 1.3 I think...

Er, what I was gonna say was using texture borders and GL_CLAMP, that's what they were made for XD But then again, I bet there's a better method now. My knowledge is mostly from 1.1, I seriously need to relearn the API, but I don't have time x_x

Quote:Original post by krez
Maybe I'm missing something here, but why don't you just use GL_REPEAT? That would blend the edges with the opposite sides.

That would blend against the edges of the opposite side of the texture of that same tile. He needs it to blend with the edge of the texture of the tile next to it. Using GL_REPEAT will just make it look worse.
Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.
The problem with the borders is that they are black... You can set the border color, but the result will be very ugly... You could see from an airplane where the texture ends... I don't know why they did it like that...
Quote:Original post by Sik_the_hedgehog
Quote:Original post by Brother Bob
Quote:Original post by Sik_the_hedgehog
Quote:Original post by CTPAX
I guess nobody here can answer me this...

I would, but my reply would be on an outdated method which probably has a better alternative already. The problem you have is that the last texel in one texture doesn't get filtered with the first texel of the next texture - so the former gets extended and then the latter appears sudden of all, without any blending at all.

I wonder if that helps at all.

That is my guess as well. For the two tiles next to each other to blend seamlessly, the filtering in the borders needs access to the texels from the neighboring tiles to blend with. Can be solved by replicating the tile data from adjacent tiles into other tiles. For example, if a tile is 32x32 texels, make it 34x34, where the outer border corresponds to the texel values of the neighboring tiles. Texture coordinates can then select the center 32x32 tile, while keeping filtering proper in the border case.

That would work if it is guaranteed that the surrounding tiles have always the same exact textures. I don't think it's his case though (remember he said he'd expand on it to generate larger meshes).

You have to design your tiles so all borders can connect. You just don't make this work with any arbitrary set of tiles. It is a problem that must be solved, and ensuring adjacent tiles connect is something you must design. I don't see that as unrealistic to have tile borders of the same kind to be identical.
How about making the tiles slightly overlapping and blending between the textures on the transitions? I've read a tutorial that implements this, but I can't seem to find the link...

[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]

Ah yeah I misinterpreted the entire thread, my bad...
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])

This topic is closed to new replies.

Advertisement