[solved]strange lines with glsl

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

[solved]strange lines with glsl

Post 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
Last edited by kornwaretm on Sat Nov 22, 2014 7:28 am, edited 1 time in total.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: strange lines with glsl

Post 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.
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Re: strange lines with glsl

Post 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.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: strange lines with glsl

Post 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.
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Re: strange lines with glsl

Post 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.
Matix522
Posts: 15
Joined: Wed Jul 02, 2014 11:48 am
Location: Poland

Re: strange lines with glsl

Post 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.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Re: strange lines with glsl

Post 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,
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Re: strange lines with glsl

Post 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
Post Reply