   Mipmapping creates artifacts on mesh edges
  I am having some trouble with mipmapping.  When I enable it, some artifacts are appearing on the edges of polygons.Here is the bit of code I'm using to generate the mipmaps:gluBuild2DMipmaps(GL_TEXTURE_2D, 4, surface->w, surface->h, format, GL_UNSIGNED_BYTE, surface->pixels);glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);I'm also rendering using GLSL.  What can I do to make those edges disappear?   
  That's because the texture filter uses information around each pixel and averaging color values when minimizing the texture. That's why some of the unused (probably black) texture space interferes with the color data. You could try padding the edges of each object surface in the texture map with the edge color so that the colors would extend a few pixels beyond. I don't really know how to explain this clearly without some sort of sample texture maps.   ;  It's practically the same problem that you can run into when generating texture atlases. Take a look here to see how naive filtering can introduce artifacts into texture atlases when using mipmapping: http://http.download.nvidia.com/developer/NVTextureSuite/Atlas_Tools/Texture_Atlas_Whitepaper.pdf   ;  The magnification filter can't use mipmaps, so change it to GL_LINEAR or GL_NEAREST. You could also try to use trilinear filtering as minification filter:glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);Also, gluBuild2MipMaps can do strange things with your textures and isn't recommended these days. Take a look at the automatic mipmap generation functions in OpenGL like glGenerateMipmapEXT.If the above doesn't work try setting the texture wrap modes to GL_CLAMP_TO_EDGE. It can make a difference depending on how your models are textured.   ;Quote:Original post by imbusyThat's because the texture filter uses information around each pixel and averaging color values when minimizing the texture. That's why some of the unused (probably black) texture space interferes with the color data. You could try padding the edges of each object surface in the texture map with the edge color so that the colors would extend a few pixels beyond. I don't really know how to explain this clearly without some sort of sample texture maps.I think imbusy has it figured out.  The edges are being caused by the texture layer that is applying baked ambient occlusion.  The mapping looks like this:The edges are showing up because when the image gets scaled, the texture map doesn't "fit" as well, and some of the surrounding black pixels start showing up.  The baked ambient occlusion was created in Blender, which does pad each polygon with about 1 extra pixel of color.  That works fine at the image's natural resolution, but its just not enough at the lower resolutions apparently. My solution to the problem to skip generating mipmaps for the baked ambient occlusion layer, but to continue generating them for the base texture, such as the bricks on the building.  I also took some of the filtering advice and added it.  Here is the new code snippet:if (mipmaps) {gluBuild2DMipmaps(GL_TEXTURE_2D, 4, surface->w, surface->h, format, GL_UNSIGNED_BYTE, surface->pixels);glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);} else {glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);};  Another fine point is to ensure that you are setting your texture coordinates correctly -- for example, if you want the texture to be read from a rectangle in the upper left corner that is 16x16 pixels, correct coordinates are (0.5,0.5)-(15.5, 15.5), not (0,0)-(15,15) or (0,0)-(16,16). These incorrect coordinates can cause filtering to weight pixels which should be outside the desired texture more heavily than they should, which can exacerbate the types of issues you are seeing, however its unlikely to be the only source of such problems unless perhaps filtering is set to NEAREST.   ;  When baking the texture, make it have an alpha-channel. With GIMP, dilate the texture, this will create the extra border. Blurs and such would do.But now I checked, Blender has a setting to increase that 1px border. It's in the Buttons_Window/Render_buttons/Bake/Margin. Increase that to 5-16 px (depending on the atlas size and complexity), and you'll be fine.   