Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Divisory lines with cubemap

  1. #1
    Intern Contributor
    Join Date
    Mar 2005
    Posts
    64

    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:
    Code :
    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?

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Divisory lines with cubemap

    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.

  3. #3
    Member Regular Contributor
    Join Date
    Mar 2001
    Posts
    466

    Re: Divisory lines with cubemap

    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.

  4. #4
    Intern Newbie
    Join Date
    Apr 2000
    Posts
    44

    Re: Divisory lines with cubemap

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •