Page 1 of 1

[solved]strange lines with glsl

Posted: Sun Nov 09, 2014 8:59 am
by kornwaretm
hello everyone. i'm trying to use texture in an odd way, single texture for both color and normal map,and i put them side by side , half color half normal. to be exact 1/9 tolerance 3/9 color 1/9 tolerance 3/9 normal map and another 1/9 tolerance. here is one of my texture.

Image


why i did this? because obviously i need a lot of textures for single terrain, i tried to render 2D level created using tiled, and 8 textures used up. btw in glsl shader, i use these codes.

Code: Select all

float perNine = 0.1111111111111111111111111111111;//  (1.0 / 9.0);
//coupt lands
col_coord = ncoord * 25;
col_coord.x = mod(col_coord.x, perNine * 3.0);
col_coord.x = clamp(col_coord.x, 0.0, perNine * 3.0);
col_coord.x += perNine;
vec4 sCorrupt = texture2D(corrupt, col_coord) * sSplat.r;
col_coord.x += perNine * 4;
vec4 sCorruptNormal  = texture2D(corrupt, col_coord) * sSplat.r;
somehow i get weird blue lines

Image


i have tried clamp the coord, it doesn't help. how can i fix this?
thanks in advance

Re: strange lines with glsl

Posted: Sun Nov 09, 2014 9:28 am
by hendu
If you use texture arrays, the limit is around 2048 textures per slot, though it does up the hw requirement to DX10-level gpus.

But for your issue, it's repeat filtering going over the x-direction. You fix it by setting the texture's clamp mode to ETC_CLAMP_TO_EDGE.

Re: strange lines with glsl

Posted: Sun Nov 09, 2014 11:45 am
by kornwaretm
thanks for the reply, i have tried to set the texture layer TextureWrapU to ETC_CLAMP_TO_EDGE, and the line still appear.

Re: strange lines with glsl

Posted: Sun Nov 09, 2014 12:54 pm
by hendu
It not being a power of two might matter, also try setting both WrapU and WrapV. If still not, you'll need to debug it more.

Re: strange lines with glsl

Posted: Sun Nov 09, 2014 1:01 pm
by kornwaretm
thanks again hendu, i also suspecting power of two texture, since it is not power of two, but those strange line still appears (after i resize the image). i also try wrapU wrapV and all available mode for them, still no luck. i'm going to make a simpler test and inspect my shader.

Re: strange lines with glsl

Posted: Sun Nov 09, 2014 2:05 pm
by Matix522
Try to diable filters

Code: Select all

 
            buf->getMaterial().TextureLayer[x].BilinearFilter=false;
            buf->getMaterial().TextureLayer[x].TrilinearFilter=false;
            buf->getMaterial().TextureLayer[x].AnisotropicFilter =false;
 
may it help.

Re: strange lines with glsl

Posted: Mon Nov 10, 2014 5:46 pm
by BlindSide
Hi Korn,

I ran into this same issue once with texture splatting. I think it has to do with mip-maps and usage of the mod() function. Try playing around with texture2DLOD instead of texture2D and see how it goes.

Cheers,

Re: strange lines with glsl

Posted: Sat Nov 22, 2014 7:27 am
by kornwaretm
thanks BlindSide, texture2DLod remove all the stange lines. still confused about the "float lod" parameter, right now i'm using the inverted fog intensity value. problem solved, also this solution removes the maximum texture number restriction. exciting new things are coming :D

here is my new screeny
Image

thanks everyone