Texture Artifacts - Help me with this and i'll have your children!!

Started by
13 comments, last by GameDev.net 17 years, 10 months ago
Hi Guys, I've been working on generating lightmaps and I keep getting artifacts on the sides of my polygons and i've no idea where they are comming from. Please see the image below: As you can see, there are artifacts on the sides of the poly - i've included the lightmap texture i'm using on the right - the yellow border correspond to the uvs. Can anyone help me with this? It's driving me insane - I can't see any reason why this should be happening? It appears to happen when the UVs span a pixel - any comments or suggestions would be really appreciated. Actually - i've just tried aligining the uvs to the nearest pixel - and it still happens :( Please, Please someone help!!! Also, the red borders on the lightmap will later be filled with the adjacent pixels - i've filled them with red to enhance what's going on. Kind Regards, Chris
Advertisement
When you create the texture, did you specify clamp to edge?

In OpenGL, for a 2D texture:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
Hi Tabby,

Thanks for replying, yes I have - in fact i've tried it with pretty much every possible comination of texture parameters and it still goes all wierd :(

Kind Regadrs,

Chris
That's definitely DXT compression artifacts. Your red color interferes with the compression process... each 4x4 block can only have 2 unique colors, the other 2 are interpolated from those.

You shouldn't compress lightmaps really anyway, it'll just look ugly.

How many textures are you overlaying? It's strange to me that the blue texels are significantly larger than those which make up the light map's grey(ish) texels.

Edit: Ahh, compression, that would explain the deviance in grey's purity.
Hi Guys,

Texture compression???? I'm using opengl and i've loaded all the extensions at runtime - would this activate it texture compression without specifically specifying it?
I'm not sure what is causing those artifacts, but on another note I don't see why you are shifting your uv's in by more than half a pixel on the right and bottom sides of the lightmap texture.

If you are going to give the surrounding red pixels the colour of their nearest neighbour then this should completely remove any bleeding that occurs with filtering and there is no need for the half pixel uv shrink hack. [smile]

Regards,
ViLiO
Richard 'ViLiO' Thomasv.net | Twitter | YouTube
No texture compression is enabled by default, unless it's overrode by the graphic driver itself through some user setting.

So I'm assuming the impurity is from the JPEG compression of the screenshot, and isn't actually displayed when the information is still lossless.

Baring that, is it indeed just one texture per pass? Have you checked the actual raw data in RAM to see if those pixels really aren't just simply blue and the green and red aren't being filled?

Are you using a BGRA colour format? Or RGBA?
Quote:Original post by ViLiO
I'm not sure what is causing those artifacts, but on another note I don't see why you are shifting your uv's in by more than half a pixel on the right and bottom sides of the lightmap texture.

If you are going to give the surrounding red pixels the colour of their nearest neighbour then this should completely remove any bleeding that occurs with filtering and there is no need for the half pixel uv shrink hack. [smile]

Regards,
ViLiO


It's probably your mip mapping that's causing the problem. Try without mipmapping, and also try duplicating the pixels at the edge like ViLiO mentioned.
I'm 100% sure that the large scale banding that you are seeing is because DXT (S3TC) compression is being applied at some stage. You may want to check your driver control panel, some quality parameter may be forcing texture compression.

This topic is closed to new replies.

Advertisement