Divisory lines with cubemap

Hi,
i’m using cubemaps with shaders, the problem that i found is that i have divisory lines between faces of the cube, i’ve tried on geforce and ati with same result. I set up cubemap in this way:

 
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB);
		glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB);
		glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB);

		glEnable(GL_TEXTURE_GEN_S);
		glEnable(GL_TEXTURE_GEN_T);
		glEnable(GL_TEXTURE_GEN_R);

		glTexParameterf(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameterf(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER,GL_LINEAR);
		glTexParameterf(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
		glTexParameterf(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);

		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);


 

Is this code wrong?

first :

  glTexParameterf(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER,GL_LINEAR);
  glTexParameterf(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  glTexParameterf(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);

the last call will overwrite the 2 firsts.

then about frame around cube faces, it sounds like a texture border problem, try this :
glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

It should look better. The absolute best way is to properly define texture borders matching the adjacent texture.
See http://home.planet.nl/~monstrous/skybox.html it is a bit old but very on topic.

The reason for the lines is that filtering of the cubmap faces doesn’t take texels of adjacent faces into account, as texture filtering is done in 2D after selecting the correct face of the cubemap.

On the ATI developer site you can find a paper and a tool for cubemap prefiltering. They adjust the textures to have homogenous texels at the borders so that the borders are barely visible.

I hope this isn’t too off topic:
Everyone is mentioning the CLAMP method, and basically having an additional line of edge pixels so the edges match up with the bordering cube edge -
With cubemapping I would hope they would resolve this (in my opinion) filtering issue.
Is there a reasonable way to deal with this yet? (I’m asking from the context of dynamic cubemaps for local area diffuse lighting effects)

Thanks! (if this pulls off topic I’ll start a new thread)

-Michael g.